5 extern int opterr
; /* if error message should be printed */
6 extern int optind
; /* index into parent argv vector */
7 extern char *optarg
; /* argument associated with option */
9 struct option
/* specification for a long form option... */
11 const char *name
; /* option name, without leading hyphens */
12 int has_arg
; /* does it take an argument? */
13 int *flag
; /* where to save its status, or NULL */
14 int val
; /* its associated status value */
17 enum /* permitted values for its `has_arg' field... */
19 no_argument
= 0, /* option never takes an argument */
20 required_argument
, /* option always requires an argument */
21 optional_argument
/* option may take an argument */
24 int getopt(int nargc
, char * const *nargv
, const char *options
);
25 int getopt_long(int nargc
, char * const *nargv
, const char *options
,
26 const struct option
*long_options
, int *idx
);
27 int getopt_long_only(int nargc
, char * const *nargv
, const char *options
,
28 const struct option
*long_options
, int *idx
);