7 * Describe one of the possibilities for a keyword option
8 * 'value' will be copied to the output variable
11 typedef struct notmuch_keyword {
16 /* Describe one option. */
17 typedef struct notmuch_opt_desc {
18 /* One and only one of opt_* must be set. */
19 const struct notmuch_opt_desc *opt_inherit;
20 notmuch_bool_t *opt_bool;
24 const char **opt_string;
25 const char **opt_position;
27 /* Must be set except for opt_inherit and opt_position. */
30 /* Optional, if non-NULL, set to TRUE if the option is present. */
31 notmuch_bool_t *present;
33 /* Must be set for opt_keyword and opt_flags. */
34 const struct notmuch_keyword *keywords;
39 This is the main entry point for command line argument parsing.
41 Parse command line arguments according to structure options,
42 starting at position opt_index.
44 All output of parsed values is via pointers in options.
46 Parsing stops at -- (consumed) or at the (k+1)st argument
47 not starting with -- (a "positional argument") if options contains
48 k positional argument descriptors.
50 Returns the index of first non-parsed argument, or -1 in case of error.
54 parse_arguments (int argc, char **argv, const notmuch_opt_desc_t *options, int opt_index);
57 * If the argument parsing loop provided by parse_arguments is not
58 * flexible enough, then the user might be interested in the following
59 * routines, but note that the API to parse_option might have to
60 * change. See command-line-arguments.c for descriptions of these
65 parse_option (int argc, char **argv, const notmuch_opt_desc_t* options, int opt_index);
68 parse_position_arg (const char *arg,
69 int position_arg_index,
70 const notmuch_opt_desc_t* options);