47
47
Otherwise, `optind' communicates from one call to the next
48
48
how much of ARGV has been scanned so far. */
52
52
/* Callers store zero here to inhibit the error message `getopt' prints
53
53
for unrecognized options. */
57
57
/* Set to an option character which was unrecognized. */
61
61
/* Describe the long-named options requested by the application.
62
62
The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector
79
79
one). For long options that have a zero `flag' field, `getopt'
80
80
returns the contents of the `val' field. */
84
84
#if defined (__STDC__) && __STDC__
89
/* has_arg can't be an enum because some compilers complain about
90
type mismatches in all the code that assumes it is an int. */
89
/* has_arg can't be an enum because some compilers complain about
90
type mismatches in all the code that assumes it is an int. */
96
96
/* Names for the values of the `has_arg' field of `struct option'. */
99
#define required_argument 1
100
#define optional_argument 2
99
#define required_argument 1
100
#define optional_argument 2
102
102
#if defined (__STDC__) && __STDC__
103
103
#ifdef __GNU_LIBRARY__
104
104
/* Many other libraries have conflicting prototypes for getopt, with
105
105
differences in the consts, in stdlib.h. To avoid compilation
106
106
errors, only prototype getopt for the GNU C library. */
107
extern int getopt(int argc, char *const *argv, const char *shortopts);
108
#else /* not __GNU_LIBRARY__ */
110
#endif /* __GNU_LIBRARY__ */
111
extern int getopt_long(int argc, char *const *argv, const char *shortopts,
112
const struct option *longopts, int *longind);
113
extern int getopt_long_only(int argc, char *const *argv,
114
const char *shortopts,
115
const struct option *longopts, int *longind);
107
extern int getopt(int argc, char *const *argv, const char *shortopts);
108
#else /* not __GNU_LIBRARY__ */
110
#endif /* __GNU_LIBRARY__ */
111
extern int getopt_long(int argc, char *const *argv, const char *shortopts,
112
const struct option *longopts, int *longind);
113
extern int getopt_long_only(int argc, char *const *argv,
114
const char *shortopts,
115
const struct option *longopts, int *longind);
117
117
/* Internal only. Users should not call this directly. */
118
extern int _getopt_internal(int argc, char *const *argv,
119
const char *shortopts,
120
const struct option *longopts, int *longind,
122
#else /* not __STDC__ */
124
extern int getopt_long();
125
extern int getopt_long_only();
127
extern int _getopt_internal();
128
#endif /* __STDC__ */
118
extern int _getopt_internal(int argc, char *const *argv,
119
const char *shortopts,
120
const struct option *longopts, int *longind,
122
#else /* not __STDC__ */
124
extern int getopt_long();
125
extern int getopt_long_only();
127
extern int _getopt_internal();
128
#endif /* __STDC__ */
134
#endif /* _GETOPT_H */
134
#endif /* _GETOPT_H */