unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
blob 04b04b939cbacdc86622b36c9a51297af06951a7 2067 bytes (raw)
name: command-line-arguments.h 	 # note: path name is non-authoritative(*)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
 
#ifndef NOTMUCH_OPTS_H
#define NOTMUCH_OPTS_H

#include "notmuch.h"

/*
 * Describe one of the possibilities for a keyword option
 * 'value' will be copied to the output variable
 */

typedef struct notmuch_keyword {
    const char *name;
    int value;
} notmuch_keyword_t;

/* Describe one option. */
typedef struct notmuch_opt_desc {
    /* One and only one of opt_* must be set. */
    const struct notmuch_opt_desc *opt_inherit;
    notmuch_bool_t *opt_bool;
    int *opt_int;
    int *opt_keyword;
    int *opt_flags;
    const char **opt_string;
    const char **opt_position;

    /* Must be set except for opt_inherit and opt_position. */
    const char *name;

    /* Optional, if non-NULL, set to TRUE if the option is present. */
    notmuch_bool_t *present;

    /* Optional, allow empty strings for opt_string. */
    notmuch_bool_t allow_empty;

    /* Must be set for opt_keyword and opt_flags. */
    const struct notmuch_keyword *keywords;
} notmuch_opt_desc_t;


/*
  This is the main entry point for command line argument parsing.

  Parse command line arguments according to structure options,
  starting at position opt_index.

  All output of parsed values is via pointers in options.

  Parsing stops at -- (consumed) or at the (k+1)st argument
  not starting with -- (a "positional argument") if options contains
  k positional argument descriptors.

  Returns the index of first non-parsed argument, or -1 in case of error.

*/
int
parse_arguments (int argc, char **argv, const notmuch_opt_desc_t *options, int opt_index);

/*
 * If the argument parsing loop provided by parse_arguments is not
 * flexible enough, then the user might be interested in the following
 * routines, but note that the API to parse_option might have to
 * change. See command-line-arguments.c for descriptions of these
 * functions.
 */

int
parse_option (int argc, char **argv, const notmuch_opt_desc_t* options, int opt_index);

notmuch_bool_t
parse_position_arg (const char *arg,
		    int position_arg_index,
		    const notmuch_opt_desc_t* options);


#endif

debug log:

solving 04b04b939cba ...
found 04b04b939cba in https://yhetil.org/notmuch/20171002162552.4827-1-jani@nikula.org/
found dfc808bdab78 in https://yhetil.org/notmuch.git/
preparing index
index prepared:
100644 dfc808bdab7838c81746f7671ba2fa8b3b904ce9	command-line-arguments.h

applying [1/1] https://yhetil.org/notmuch/20171002162552.4827-1-jani@nikula.org/
diff --git a/command-line-arguments.h b/command-line-arguments.h
index dfc808bdab78..04b04b939cba 100644

Checking patch command-line-arguments.h...
Applied patch command-line-arguments.h cleanly.

index at:
100644 04b04b939cbacdc86622b36c9a51297af06951a7	command-line-arguments.h

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).