1 #ifndef PARSE_OPTIONS_H
2 #define PARSE_OPTIONS_H
12 enum parse_opt_flags
{
13 PARSE_OPT_KEEP_DASHDASH
= 1,
17 enum parse_opt_type type
;
19 const char *long_name
;
25 #define OPT_END() { OPTION_END }
26 #define OPT_GROUP(h) { OPTION_GROUP, 0, NULL, NULL, NULL, (h) }
27 #define OPT_BOOLEAN(s, l, v, h) { OPTION_BOOLEAN, (s), (l), (v), NULL, (h) }
28 #define OPT_INTEGER(s, l, v, h) { OPTION_INTEGER, (s), (l), (v), NULL, (h) }
29 #define OPT_STRING(s, l, v, a, h) { OPTION_STRING, (s), (l), (v), (a), (h) }
31 /* parse_options() will filter out the processed options and leave the
32 * non-option argments in argv[].
33 * Returns the number of arguments left in argv[].
35 extern int parse_options(int argc
, const char **argv
,
36 const struct option
*options
,
37 const char * const usagestr
[], int flags
);
39 extern NORETURN
void usage_with_options(const char * const *usagestr
,
40 const struct option
*options
);