/[oroborus]/oroborus/src/getopt.h
ViewVC logotype

Diff of /oroborus/src/getopt.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.2 by dreamind, Sun Jul 7 03:17:41 2002 UTC revision 1.3 by dreamind, Mon Jul 15 08:23:07 2002 UTC
# Line 34  extern "C" Line 34  extern "C"
34     Also, when `ordering' is RETURN_IN_ORDER,     Also, when `ordering' is RETURN_IN_ORDER,
35     each non-option ARGV-element is returned here.  */     each non-option ARGV-element is returned here.  */
36    
37    extern char *optarg;          extern char *optarg;
38    
39  /* Index in ARGV of the next element to be scanned.  /* Index in ARGV of the next element to be scanned.
40     This is used for communication to and from the caller     This is used for communication to and from the caller
# Line 48  extern "C" Line 48  extern "C"
48     Otherwise, `optind' communicates from one call to the next     Otherwise, `optind' communicates from one call to the next
49     how much of ARGV has been scanned so far.  */     how much of ARGV has been scanned so far.  */
50    
51    extern int optind;          extern int optind;
52    
53  /* Callers store zero here to inhibit the error message `getopt' prints  /* Callers store zero here to inhibit the error message `getopt' prints
54     for unrecognized options.  */     for unrecognized options.  */
55    
56    extern int opterr;          extern int opterr;
57    
58  /* Set to an option character which was unrecognized.  */  /* Set to an option character which was unrecognized.  */
59    
60    extern int optopt;          extern int optopt;
61    
62  #ifndef __need_getopt  #ifndef __need_getopt
63  /* Describe the long-named options requested by the application.  /* Describe the long-named options requested by the application.
# Line 81  extern "C" Line 81  extern "C"
81     one).  For long options that have a zero `flag' field, `getopt'     one).  For long options that have a zero `flag' field, `getopt'
82     returns the contents of the `val' field.  */     returns the contents of the `val' field.  */
83    
84    struct option          struct option
85    {          {
86  # if defined __STDC__ && __STDC__  # if defined __STDC__ && __STDC__
87      const char *name;                  const char *name;
88  # else  # else
89      char *name;                  char *name;
90  # endif  # endif
91      /* has_arg can't be an enum because some compilers complain about                  /* has_arg can't be an enum because some compilers complain about
92         type mismatches in all the code that assumes it is an int.  */                     type mismatches in all the code that assumes it is an int.  */
93      int has_arg;                  int has_arg;
94      int *flag;                  int *flag;
95      int val;                  int val;
96    };          };
97    
98  /* Names for the values of the `has_arg' field of `struct option'.  */  /* Names for the values of the `has_arg' field of `struct option'.  */
99    
100  # define no_argument            0  # define no_argument            0
101  # define required_argument      1  # define required_argument      1
102  # define optional_argument      2  # define optional_argument      2
103  #endif                          /* need getopt */  #endif                                                                                                  /* need getopt */
104    
105    
106  /* Get definitions and prototypes for functions to process the  /* Get definitions and prototypes for functions to process the
# Line 132  extern "C" Line 132  extern "C"
132  /* Many other libraries have conflicting prototypes for getopt, with  /* Many other libraries have conflicting prototypes for getopt, with
133     differences in the consts, in stdlib.h.  To avoid compilation     differences in the consts, in stdlib.h.  To avoid compilation
134     errors, only prototype getopt for the GNU C library.  */     errors, only prototype getopt for the GNU C library.  */
135    extern int getopt (int __argc, char *const *__argv,          extern int getopt (int __argc, char *const *__argv,
136                       const char *__shortopts);                                                                                   const char *__shortopts);
137  # else                          /* not __GNU_LIBRARY__ */  # else                                                                                                  /* not __GNU_LIBRARY__ */
138    extern int getopt ();          extern int getopt ();
139  # endif                         /* __GNU_LIBRARY__ */  # endif                                                                                                 /* __GNU_LIBRARY__ */
140    
141  # ifndef __need_getopt  # ifndef __need_getopt
142    extern int getopt_long (int __argc, char *const *__argv,          extern int getopt_long (int __argc, char *const *__argv,
143                            const char *__shortopts,                                                                                                          const char *__shortopts,
144                            const struct option *__longopts, int *__longind);                                                                                                          const struct option *__longopts, int *__longind);
145    extern int getopt_long_only (int __argc, char *const *__argv,          extern int getopt_long_only (int __argc, char *const *__argv,
146                                 const char *__shortopts,                                                                                                                           const char *__shortopts,
147                                 const struct option *__longopts,                                                                                                                           const struct option *__longopts,
148                                 int *__longind);                                                                                                                           int *__longind);
149    
150  /* Internal only.  Users should not call this directly.  */  /* Internal only.  Users should not call this directly.  */
151    extern int _getopt_internal (int __argc, char *const *__argv,          extern int _getopt_internal (int __argc, char *const *__argv,
152                                 const char *__shortopts,                                                                                                                           const char *__shortopts,
153                                 const struct option *__longopts,                                                                                                                           const struct option *__longopts,
154                                 int *__longind, int __long_only);                                                                                                                           int *__longind, int __long_only);
155  # endif  # endif
156  #else                           /* not __STDC__ */  #else                                                                                                           /* not __STDC__ */
157    extern int getopt ();          extern int getopt ();
158  # ifndef __need_getopt  # ifndef __need_getopt
159    extern int getopt_long ();          extern int getopt_long ();
160    extern int getopt_long_only ();          extern int getopt_long_only ();
161    
162    extern int _getopt_internal ();          extern int _getopt_internal ();
163  # endif  # endif
164  #endif                          /* __STDC__ */  #endif                                                                                                  /* __STDC__ */
165    
166  #ifdef  __cplusplus  #ifdef  __cplusplus
167  }  }
# Line 170  extern "C" Line 170  extern "C"
170  /* Make sure we later can get all the definitions and declarations.  */  /* Make sure we later can get all the definitions and declarations.  */
171  #undef __need_getopt  #undef __need_getopt
172    
173  #endif                          /* getopt.h */  #endif                                                                                                  /* getopt.h */
174    
175  /**This must remain at the end of the file.**********  /**This must remain at the end of the file.**********
176   * vim600:set sw=2 ts=8:                            *   * vim600:set sw=2 ts=2:                            *
177   * vim600:set cindent cinoptions={1s,>2s,^-1s,n-1s: *   * vim600:set cindent cinoptions={1s,>2s,^-1s,n-1s: *
178   * vim600:set foldmethod=marker:                    *   * vim600:set foldmethod=marker:                    *
179   ****************************************************/   ****************************************************/

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26