9 * Describe one of the possibilities for a keyword option
10 * 'value' will be copied to the output variable
13 typedef struct notmuch_keyword {
18 /* Describe one option. */
19 typedef struct notmuch_opt_desc {
20 /* One and only one of opt_* must be set. */
21 const struct notmuch_opt_desc *opt_inherit;
26 const char **opt_string;
27 const char **opt_position;
29 /* Must be set except for opt_inherit and opt_position. */
32 /* Optional, if non-NULL, set to true if the option is present. */
35 /* Optional, allow empty strings for opt_string. */
38 /* Must be set for opt_keyword and opt_flags. */
39 const struct notmuch_keyword *keywords;
44 This is the main entry point for command line argument parsing.
46 Parse command line arguments according to structure options,
47 starting at position opt_index.
49 All output of parsed values is via pointers in options.
51 Parsing stops at -- (consumed) or at the (k+1)st argument
52 not starting with -- (a "positional argument") if options contains
53 k positional argument descriptors.
55 Returns the index of first non-parsed argument, or -1 in case of error.
59 parse_arguments (int argc, char **argv, const notmuch_opt_desc_t *options, int opt_index);
62 * If the argument parsing loop provided by parse_arguments is not
63 * flexible enough, then the user might be interested in the following
64 * routines, but note that the API to parse_option might have to
65 * change. See command-line-arguments.c for descriptions of these
70 parse_option (int argc, char **argv, const notmuch_opt_desc_t* options, int opt_index);
73 parse_position_arg (const char *arg,
74 int position_arg_index,
75 const notmuch_opt_desc_t* options);