mh: improve traditional option parser and help output.
* mh/mh_getopt.h (mh_option): Move match_len to the end of the structure. It should not be initialized. (mh_option_init): New prototype. * mh/mh_getopt.c (mh_option_init): New function. * mh/mh_argp.c (mh_argp_parse): Call mh_option_init. * mh/ali.c: Update mh_option declaration. * mh/anno.c: Likewise. * mh/burst.c: Likewise. * mh/comp.c: Likewise. * mh/fmtcheck.c: Likewise. * mh/folder.c: Likewise. * mh/forw.c: Likewise. * mh/inc.c: Likewise. * mh/install-mh.c: Likewise. * mh/mark.c: Likewise. * mh/mhl.c: Likewise. * mh/mhn.c: Likewise. * mh/mhparam.c: Likewise. * mh/mhpath.c: Likewise. * mh/pick.c: Likewise. * mh/refile.c: Likewise. * mh/repl.c: Likewise. * mh/rmf.c: Likewise. * mh/rmm.c: Likewise. * mh/scan.c: Likewise. * mh/send.c: Likewise. * mh/sortm.c: Likewise. * mh/whatnow.c: Likewise. * mh/whom.c: Likewise.
Showing
27 changed files
with
246 additions
and
197 deletions
... | @@ -45,12 +45,12 @@ static struct argp_option options[] = { | ... | @@ -45,12 +45,12 @@ static struct argp_option options[] = { |
45 | 45 | ||
46 | /* Traditional MH options */ | 46 | /* Traditional MH options */ |
47 | struct mh_option mh_option[] = { | 47 | struct mh_option mh_option[] = { |
48 | { "alias", 1, MH_OPT_ARG, "aliasfile" }, | 48 | { "alias", MH_OPT_ARG, "aliasfile" }, |
49 | { "noalias", 3, }, | 49 | { "noalias", }, |
50 | { "list", 1, MH_OPT_BOOL }, | 50 | { "list", MH_OPT_BOOL }, |
51 | { "normalize", 3, MH_OPT_BOOL }, | 51 | { "normalize", MH_OPT_BOOL }, |
52 | { "user", 1, MH_OPT_BOOL }, | 52 | { "user", MH_OPT_BOOL }, |
53 | { 0 } | 53 | { NULL } |
54 | }; | 54 | }; |
55 | 55 | ||
56 | static int list_mode; | 56 | static int list_mode; | ... | ... |
... | @@ -42,10 +42,10 @@ static struct argp_option options[] = { | ... | @@ -42,10 +42,10 @@ static struct argp_option options[] = { |
42 | }; | 42 | }; |
43 | 43 | ||
44 | struct mh_option mh_option[] = { | 44 | struct mh_option mh_option[] = { |
45 | {"inplace", 1, MH_OPT_BOOL }, | 45 | { "inplace", MH_OPT_BOOL }, |
46 | {"date", 1, MH_OPT_BOOL }, | 46 | { "date", MH_OPT_BOOL }, |
47 | {"component", 1, MH_OPT_ARG, "field"}, | 47 | { "component", MH_OPT_ARG, "field" }, |
48 | {"text", 1, MH_OPT_ARG, "body"}, | 48 | { "text", MH_OPT_ARG, "body" }, |
49 | { NULL } | 49 | { NULL } |
50 | }; | 50 | }; |
51 | 51 | ... | ... |
... | @@ -50,10 +50,10 @@ static struct argp_option options[] = { | ... | @@ -50,10 +50,10 @@ static struct argp_option options[] = { |
50 | 50 | ||
51 | /* Traditional MH options */ | 51 | /* Traditional MH options */ |
52 | struct mh_option mh_option[] = { | 52 | struct mh_option mh_option[] = { |
53 | {"inplace", 1, MH_OPT_BOOL }, | 53 | { "inplace", MH_OPT_BOOL }, |
54 | {"quiet", 1, MH_OPT_BOOL }, | 54 | { "quiet", MH_OPT_BOOL }, |
55 | {"verbose", 1, MH_OPT_BOOL }, | 55 | { "verbose", MH_OPT_BOOL }, |
56 | {NULL} | 56 | { NULL } |
57 | }; | 57 | }; |
58 | 58 | ||
59 | /* Command line switches */ | 59 | /* Command line switches */ | ... | ... |
... | @@ -58,17 +58,17 @@ static struct argp_option options[] = { | ... | @@ -58,17 +58,17 @@ static struct argp_option options[] = { |
58 | 58 | ||
59 | /* Traditional MH options */ | 59 | /* Traditional MH options */ |
60 | struct mh_option mh_option[] = { | 60 | struct mh_option mh_option[] = { |
61 | {"build", 1, }, | 61 | { "build" }, |
62 | {"file", 2, MH_OPT_ARG, "draftfile"}, | 62 | { "file", MH_OPT_ARG, "draftfile" }, |
63 | {"form", 2, MH_OPT_ARG, "formatfile"}, | 63 | { "form", MH_OPT_ARG, "formatfile" }, |
64 | {"draftfolder", 6, MH_OPT_ARG, "folder"}, | 64 | { "draftfolder", MH_OPT_ARG, "folder" }, |
65 | {"nodraftfolder", 3, }, | 65 | { "nodraftfolder" }, |
66 | {"draftmessage", 6, }, | 66 | { "draftmessage" }, |
67 | {"editor", 1, MH_OPT_ARG, "program"}, | 67 | { "editor", MH_OPT_ARG, "program" }, |
68 | {"noedit", 3, }, | 68 | { "noedit" }, |
69 | {"whatnowproc", 2, MH_OPT_ARG, "program"}, | 69 | { "whatnowproc", MH_OPT_ARG, "program" }, |
70 | {"nowhatnowproc", 3, }, | 70 | { "nowhatnowproc" }, |
71 | { 0 } | 71 | { NULL } |
72 | }; | 72 | }; |
73 | 73 | ||
74 | struct mh_whatnow_env wh_env = { 0 }; | 74 | struct mh_whatnow_env wh_env = { 0 }; | ... | ... |
... | @@ -39,9 +39,9 @@ static struct argp_option options[] = { | ... | @@ -39,9 +39,9 @@ static struct argp_option options[] = { |
39 | 39 | ||
40 | /* Traditional MH options */ | 40 | /* Traditional MH options */ |
41 | struct mh_option mh_option[] = { | 41 | struct mh_option mh_option[] = { |
42 | {"form", 4, MH_OPT_ARG, "formatfile"}, | 42 | { "form", MH_OPT_ARG, "formatfile" }, |
43 | {"format", 5, MH_OPT_ARG, "string"}, | 43 | { "format", MH_OPT_ARG, "string" }, |
44 | { 0 } | 44 | { NULL } |
45 | }; | 45 | }; |
46 | 46 | ||
47 | char *format_str; | 47 | char *format_str; | ... | ... |
... | @@ -83,18 +83,18 @@ static struct argp_option options[] = { | ... | @@ -83,18 +83,18 @@ static struct argp_option options[] = { |
83 | 83 | ||
84 | /* Traditional MH options */ | 84 | /* Traditional MH options */ |
85 | struct mh_option mh_option[] = { | 85 | struct mh_option mh_option[] = { |
86 | {"print", 2, 0, NULL }, | 86 | { "print" }, |
87 | {"list", 1, 0, NULL }, | 87 | { "list" }, |
88 | {"push", 2, 0, NULL }, | 88 | { "push" }, |
89 | {"pop", 2, 0, NULL }, | 89 | { "pop" }, |
90 | {"all", 1, 0, NULL }, | 90 | { "all" }, |
91 | {"pack", 2, 0, NULL }, | 91 | { "pack" }, |
92 | {"create", 1, MH_OPT_BOOL, NULL}, | 92 | { "create", MH_OPT_BOOL }, |
93 | {"fast", 1, MH_OPT_BOOL, NULL}, | 93 | { "fast", MH_OPT_BOOL }, |
94 | {"header", 1, MH_OPT_BOOL, NULL}, | 94 | { "header", MH_OPT_BOOL }, |
95 | {"recurse", 1, MH_OPT_BOOL, NULL}, | 95 | { "recurse", MH_OPT_BOOL }, |
96 | {"total", 1, MH_OPT_BOOL, NULL}, | 96 | { "total", MH_OPT_BOOL }, |
97 | {NULL}, | 97 | { NULL } |
98 | }; | 98 | }; |
99 | 99 | ||
100 | typedef int (*folder_action) (); | 100 | typedef int (*folder_action) (); | ... | ... |
... | @@ -72,21 +72,21 @@ static struct argp_option options[] = { | ... | @@ -72,21 +72,21 @@ static struct argp_option options[] = { |
72 | 72 | ||
73 | /* Traditional MH options */ | 73 | /* Traditional MH options */ |
74 | struct mh_option mh_option[] = { | 74 | struct mh_option mh_option[] = { |
75 | {"annotate", 1, MH_OPT_BOOL }, | 75 | { "annotate", MH_OPT_BOOL }, |
76 | {"build", 1, }, | 76 | { "build" }, |
77 | {"form", 4, MH_OPT_ARG, "formatfile"}, | 77 | { "form", MH_OPT_ARG, "formatfile"}, |
78 | {"format", 5, MH_OPT_ARG, "string"}, | 78 | { "format", MH_OPT_ARG, "string"}, |
79 | {"draftfolder", 6, MH_OPT_ARG, "folder"}, | 79 | { "draftfolder", MH_OPT_ARG, "folder"}, |
80 | {"nodraftfolder", 3 }, | 80 | { "nodraftfolder" }, |
81 | {"draftmessage", 6, }, | 81 | { "draftmessage" }, |
82 | {"editor", 1, MH_OPT_ARG, "program"}, | 82 | { "editor", MH_OPT_ARG, "program"}, |
83 | {"noedit", 3, }, | 83 | { "noedit" }, |
84 | {"filter", 2, MH_OPT_ARG, "program"}, | 84 | { "filter", MH_OPT_ARG, "program"}, |
85 | {"inplace", 1, MH_OPT_BOOL }, | 85 | { "inplace", MH_OPT_BOOL }, |
86 | {"whatnowproc", 2, MH_OPT_ARG, "program"}, | 86 | { "whatnowproc", MH_OPT_ARG, "program"}, |
87 | {"nowhatnowproc", 3 }, | 87 | { "nowhatnowproc" }, |
88 | {"mime", 2, MH_OPT_BOOL, NULL}, | 88 | { "mime", MH_OPT_BOOL }, |
89 | {NULL} | 89 | { NULL } |
90 | }; | 90 | }; |
91 | 91 | ||
92 | enum encap_type { | 92 | enum encap_type { | ... | ... |
... | @@ -52,16 +52,16 @@ static struct argp_option options[] = { | ... | @@ -52,16 +52,16 @@ static struct argp_option options[] = { |
52 | 52 | ||
53 | /* Traditional MH options */ | 53 | /* Traditional MH options */ |
54 | struct mh_option mh_option[] = { | 54 | struct mh_option mh_option[] = { |
55 | {"audit", 5, MH_OPT_ARG, "audit-file" }, | 55 | { "audit", MH_OPT_ARG, "audit-file" }, |
56 | {"noaudit", 3, 0, }, | 56 | { "noaudit" }, |
57 | {"changecur", 1, MH_OPT_BOOL}, | 57 | { "changecur", MH_OPT_BOOL }, |
58 | {"file", 2, MH_OPT_ARG, "input-file"}, | 58 | { "file", MH_OPT_ARG, "input-file" }, |
59 | {"form", 4, MH_OPT_ARG, "format-file"}, | 59 | { "form", MH_OPT_ARG, "format-file" }, |
60 | {"format", 5, MH_OPT_ARG, "string"}, | 60 | { "format", MH_OPT_ARG, "string" }, |
61 | {"truncate", 2, MH_OPT_BOOL, }, | 61 | { "truncate", MH_OPT_BOOL }, |
62 | {"width", 1, MH_OPT_ARG, "number"}, | 62 | { "width", MH_OPT_ARG, "number" }, |
63 | {"quiet", 1, 0, }, | 63 | { "quiet" }, |
64 | { 0 } | 64 | { NULL } |
65 | }; | 65 | }; |
66 | 66 | ||
67 | static char *format_str = mh_list_format; | 67 | static char *format_str = mh_list_format; | ... | ... |
... | @@ -29,8 +29,8 @@ static struct argp_option options[] = { | ... | @@ -29,8 +29,8 @@ static struct argp_option options[] = { |
29 | }; | 29 | }; |
30 | 30 | ||
31 | struct mh_option mh_option[] = { | 31 | struct mh_option mh_option[] = { |
32 | {"auto", 1, 0, }, | 32 | { "auto" }, |
33 | {"compat", 1, 0, }, | 33 | { "compat" }, |
34 | { NULL } | 34 | { NULL } |
35 | }; | 35 | }; |
36 | 36 | ... | ... |
... | @@ -43,12 +43,12 @@ static struct argp_option options[] = { | ... | @@ -43,12 +43,12 @@ static struct argp_option options[] = { |
43 | }; | 43 | }; |
44 | 44 | ||
45 | struct mh_option mh_option[] = { | 45 | struct mh_option mh_option[] = { |
46 | {"sequence", 1, }, | 46 | { "sequence" }, |
47 | {"add", 1, }, | 47 | { "add" }, |
48 | {"delete", 1, }, | 48 | { "delete" }, |
49 | {"list", 1, }, | 49 | { "list" }, |
50 | {"public", 1, MH_OPT_BOOL }, | 50 | { "public", MH_OPT_BOOL }, |
51 | {"zero", 1, MH_OPT_BOOL }, | 51 | { "zero", MH_OPT_BOOL }, |
52 | { NULL } | 52 | { NULL } |
53 | }; | 53 | }; |
54 | 54 | ... | ... |
... | @@ -201,7 +201,8 @@ mh_argp_parse (int *pargc, char **pargv[], | ... | @@ -201,7 +201,8 @@ mh_argp_parse (int *pargc, char **pargv[], |
201 | 201 | ||
202 | mu_set_program_name ((*pargv)[0]); | 202 | mu_set_program_name ((*pargv)[0]); |
203 | mh_init (); | 203 | mh_init (); |
204 | 204 | ||
205 | mh_option_init (mh_option); | ||
205 | memset (&argp, 0, sizeof (argp)); | 206 | memset (&argp, 0, sizeof (argp)); |
206 | argp.options = option; | 207 | argp.options = option; |
207 | argp.parser = parse_opt; | 208 | argp.parser = parse_opt; | ... | ... |
... | @@ -153,6 +153,52 @@ mh_help (struct mh_option *mh_opt, const char *doc) | ... | @@ -153,6 +153,52 @@ mh_help (struct mh_option *mh_opt, const char *doc) |
153 | mu_program_name); | 153 | mu_program_name); |
154 | } | 154 | } |
155 | 155 | ||
156 | |||
157 | static int | ||
158 | optcmp (const void *a, const void *b) | ||
159 | { | ||
160 | struct mh_option const *opta = a, *optb = b; | ||
161 | return strcmp (opta->opt, optb->opt); | ||
162 | } | ||
163 | |||
164 | void | ||
165 | mh_option_init (struct mh_option *opt) | ||
166 | { | ||
167 | size_t count, i; | ||
168 | |||
169 | /* Count number of elements and initialize minimum abbreviation | ||
170 | lengths to 1. */ | ||
171 | for (count = 0; opt[count].opt; count++) | ||
172 | opt[count].match_len = 1; | ||
173 | /* Sort them alphabetically */ | ||
174 | qsort (opt, count, sizeof (opt[0]), optcmp); | ||
175 | /* Determine minimum abbreviations */ | ||
176 | for (i = 0; i < count; i++) | ||
177 | { | ||
178 | const char *sample = opt[i].opt; | ||
179 | size_t sample_len = strlen (sample); | ||
180 | size_t minlen = opt[i].match_len; | ||
181 | size_t j; | ||
182 | |||
183 | for (j = i + 1; j < count; j++) | ||
184 | { | ||
185 | size_t len = strlen (opt[j].opt); | ||
186 | if (len >= minlen && memcmp (opt[j].opt, sample, minlen) == 0) | ||
187 | do | ||
188 | { | ||
189 | minlen++; | ||
190 | opt[j].match_len = minlen; | ||
191 | if (minlen == sample_len) | ||
192 | break; | ||
193 | } | ||
194 | while (len >= minlen && memcmp (opt[j].opt, sample, minlen) == 0); | ||
195 | else | ||
196 | break; | ||
197 | } | ||
198 | opt[i].match_len = minlen; | ||
199 | } | ||
200 | } | ||
201 | |||
156 | void | 202 | void |
157 | mh_opt_notimpl (const char *name) | 203 | mh_opt_notimpl (const char *name) |
158 | { | 204 | { | ... | ... |
... | @@ -25,9 +25,9 @@ | ... | @@ -25,9 +25,9 @@ |
25 | struct mh_option | 25 | struct mh_option |
26 | { | 26 | { |
27 | char *opt; | 27 | char *opt; |
28 | int match_len; | ||
29 | int flags; | 28 | int flags; |
30 | char *arg; | 29 | char *arg; |
30 | size_t match_len; | ||
31 | }; | 31 | }; |
32 | 32 | ||
33 | struct mh_argp_data | 33 | struct mh_argp_data |
... | @@ -183,6 +183,8 @@ enum mh_arg { | ... | @@ -183,6 +183,8 @@ enum mh_arg { |
183 | 183 | ||
184 | extern void (*mh_help_hook) (void); | 184 | extern void (*mh_help_hook) (void); |
185 | 185 | ||
186 | void mh_option_init (struct mh_option *opt); | ||
187 | |||
186 | void mh_argp_init (void); | 188 | void mh_argp_init (void); |
187 | void mh_argv_preproc (int argc, char **argv, struct mh_argp_data *data); | 189 | void mh_argv_preproc (int argc, char **argv, struct mh_argp_data *data); |
188 | int mh_getopt (int argc, char **argv, struct mh_option *mh_opt, const char *doc); | 190 | int mh_getopt (int argc, char **argv, struct mh_option *mh_opt, const char *doc); | ... | ... |
... | @@ -50,13 +50,13 @@ static struct argp_option options[] = { | ... | @@ -50,13 +50,13 @@ static struct argp_option options[] = { |
50 | 50 | ||
51 | /* Traditional MH options */ | 51 | /* Traditional MH options */ |
52 | struct mh_option mh_option[] = { | 52 | struct mh_option mh_option[] = { |
53 | { "bell", 1, MH_OPT_BOOL }, | 53 | { "bell", MH_OPT_BOOL }, |
54 | { "clear", 1, MH_OPT_BOOL }, | 54 | { "clear", MH_OPT_BOOL }, |
55 | { "form", 1, MH_OPT_ARG, "formatfile"}, | 55 | { "form", MH_OPT_ARG, "formatfile"}, |
56 | { "width", 1, MH_OPT_ARG, "number"}, | 56 | { "width", MH_OPT_ARG, "number"}, |
57 | { "length", 1, MH_OPT_ARG, "number"}, | 57 | { "length", MH_OPT_ARG, "number"}, |
58 | { "moreproc", 1, MH_OPT_ARG, "program"}, | 58 | { "moreproc", MH_OPT_ARG, "program"}, |
59 | { "nomoreproc", 3, }, | 59 | { "nomoreproc" }, |
60 | { NULL } | 60 | { NULL } |
61 | }; | 61 | }; |
62 | 62 | ... | ... |
... | @@ -89,20 +89,20 @@ static struct argp_option options[] = { | ... | @@ -89,20 +89,20 @@ static struct argp_option options[] = { |
89 | 89 | ||
90 | /* Traditional MH options */ | 90 | /* Traditional MH options */ |
91 | struct mh_option mh_option[] = { | 91 | struct mh_option mh_option[] = { |
92 | {"file", 2, 0, "filename"}, | 92 | { "file", MH_OPT_ARG, "filename" }, |
93 | {"list", 1, MH_OPT_BOOL, NULL}, | 93 | { "list", MH_OPT_BOOL }, |
94 | {"headers", 1, MH_OPT_BOOL, NULL}, | 94 | { "headers", MH_OPT_BOOL }, |
95 | {"realsize", 1, MH_OPT_BOOL, NULL}, | 95 | { "realsize", MH_OPT_BOOL }, |
96 | {"show", 2, MH_OPT_BOOL, NULL}, | 96 | { "show", MH_OPT_BOOL }, |
97 | {"serialonly", 2, MH_OPT_BOOL, NULL}, | 97 | { "serialonly", MH_OPT_BOOL }, |
98 | {"form", 2, 0, "formfile"}, | 98 | { "form", MH_OPT_ARG, "formfile" }, |
99 | {"pause", 3, MH_OPT_BOOL, NULL}, | 99 | { "pause", MH_OPT_BOOL }, |
100 | {"store", 1, MH_OPT_BOOL, NULL}, | 100 | { "store", MH_OPT_BOOL }, |
101 | {"auto", 1, MH_OPT_BOOL, NULL}, | 101 | { "auto", MH_OPT_BOOL }, |
102 | {"part", 3, 0, "part"}, | 102 | { "part", MH_OPT_ARG, "part" }, |
103 | {"type", 1, 0, "type"}, | 103 | { "type", MH_OPT_ARG, "type" }, |
104 | {"verbose", 1, MH_OPT_BOOL, NULL}, | 104 | { "verbose", MH_OPT_BOOL }, |
105 | {NULL} | 105 | { NULL } |
106 | }; | 106 | }; |
107 | 107 | ||
108 | typedef struct _msg_part *msg_part_t; | 108 | typedef struct _msg_part *msg_part_t; | ... | ... |
... | @@ -34,9 +34,9 @@ static struct argp_option options[] = { | ... | @@ -34,9 +34,9 @@ static struct argp_option options[] = { |
34 | 34 | ||
35 | /* Traditional MH options */ | 35 | /* Traditional MH options */ |
36 | struct mh_option mh_option[] = { | 36 | struct mh_option mh_option[] = { |
37 | { "all", 1, 0 }, | 37 | { "all" }, |
38 | { "component", 1, MH_OPT_BOOL}, | 38 | { "component", MH_OPT_BOOL }, |
39 | { 0 } | 39 | { NULL } |
40 | }; | 40 | }; |
41 | 41 | ||
42 | static int display_all; | 42 | static int display_all; | ... | ... |
... | @@ -32,7 +32,7 @@ static struct argp_option options[] = { | ... | @@ -32,7 +32,7 @@ static struct argp_option options[] = { |
32 | 32 | ||
33 | /* Traditional MH options */ | 33 | /* Traditional MH options */ |
34 | struct mh_option mh_option[] = { | 34 | struct mh_option mh_option[] = { |
35 | { 0 } | 35 | { NULL } |
36 | }; | 36 | }; |
37 | 37 | ||
38 | static error_t | 38 | static error_t | ... | ... |
... | @@ -102,28 +102,28 @@ static struct argp_option options[] = { | ... | @@ -102,28 +102,28 @@ static struct argp_option options[] = { |
102 | 102 | ||
103 | /* Traditional MH options */ | 103 | /* Traditional MH options */ |
104 | struct mh_option mh_option[] = { | 104 | struct mh_option mh_option[] = { |
105 | {"component", 1, 0, "field" }, | 105 | { "component", MH_OPT_ARG, "field" }, |
106 | {"pattern", 1, 0, "pattern" }, | 106 | { "pattern", MH_OPT_ARG, "pattern" }, |
107 | {"search", 1, 0, "pattern" }, | 107 | { "search", MH_OPT_ARG, "pattern" }, |
108 | {"cc", 1, 0, "pattern" }, | 108 | { "cc", MH_OPT_ARG, "pattern" }, |
109 | {"date", 1, 0, "pattern" }, | 109 | { "date", MH_OPT_ARG, "pattern" }, |
110 | {"from", 1, 0, "pattern" }, | 110 | { "from", MH_OPT_ARG, "pattern" }, |
111 | {"subject", 1, 0, "pattern" }, | 111 | { "subject", MH_OPT_ARG, "pattern" }, |
112 | {"to", 1, 0, "pattern" }, | 112 | { "to", MH_OPT_ARG, "pattern" }, |
113 | {"datefield", 1, 0, "field" }, | 113 | { "datefield", MH_OPT_ARG, "field" }, |
114 | {"after", 1, 0, "date" }, | 114 | { "after", MH_OPT_ARG, "date" }, |
115 | {"before", 1, 0, "date"}, | 115 | { "before", MH_OPT_ARG, "date" }, |
116 | {"and", 1, 0, NULL }, | 116 | { "and" }, |
117 | {"or", 1, 0, NULL }, | 117 | { "or" }, |
118 | {"not", 1, 0, NULL }, | 118 | { "not" }, |
119 | {"lbrace", 1, 0, NULL }, | 119 | { "lbrace" }, |
120 | {"rbrace", 1, 0, NULL }, | 120 | { "rbrace" }, |
121 | 121 | ||
122 | {"list", 1, MH_OPT_BOOL, }, | 122 | { "list", MH_OPT_BOOL }, |
123 | {"sequence", 1, 0, NULL }, | 123 | { "sequence", MH_OPT_ARG, "name" }, |
124 | {"public", 1, MH_OPT_BOOL }, | 124 | { "public", MH_OPT_BOOL }, |
125 | {"zero", 1, MH_OPT_BOOL }, | 125 | { "zero", MH_OPT_BOOL }, |
126 | {NULL} | 126 | { NULL } |
127 | }; | 127 | }; |
128 | 128 | ||
129 | static int list = 1; | 129 | static int list = 1; | ... | ... |
... | @@ -49,12 +49,12 @@ static struct argp_option options[] = { | ... | @@ -49,12 +49,12 @@ static struct argp_option options[] = { |
49 | 49 | ||
50 | /* Traditional MH options */ | 50 | /* Traditional MH options */ |
51 | struct mh_option mh_option[] = { | 51 | struct mh_option mh_option[] = { |
52 | {"file", 2, 0, "input-file"}, | 52 | { "file", MH_OPT_ARG, "input-file"}, |
53 | {"draft", 1, 0, NULL }, | 53 | { "draft" }, |
54 | {"link", 1, MH_OPT_BOOL, NULL }, | 54 | { "link", MH_OPT_BOOL }, |
55 | {"preserve", 1, MH_OPT_BOOL, NULL }, | 55 | { "preserve", MH_OPT_BOOL }, |
56 | {"src", 1, 0, "+folder" }, | 56 | { "src", MH_OPT_ARG, "folder" }, |
57 | { 0 } | 57 | { NULL } |
58 | }; | 58 | }; |
59 | 59 | ||
60 | int link_flag = 0; | 60 | int link_flag = 0; | ... | ... |
... | @@ -70,26 +70,26 @@ static struct argp_option options[] = { | ... | @@ -70,26 +70,26 @@ static struct argp_option options[] = { |
70 | 70 | ||
71 | /* Traditional MH options */ | 71 | /* Traditional MH options */ |
72 | struct mh_option mh_option[] = { | 72 | struct mh_option mh_option[] = { |
73 | {"annotate", 1, MH_OPT_BOOL }, | 73 | { "annotate", MH_OPT_BOOL }, |
74 | {"build", 1, }, | 74 | { "build" }, |
75 | {"cc", 1, MH_OPT_ARG, "all/to/cc/me"}, | 75 | { "cc", MH_OPT_ARG, "all/to/cc/me"}, |
76 | {"nocc", 3, MH_OPT_ARG, "all/to/cc/me"}, | 76 | { "nocc", MH_OPT_ARG, "all/to/cc/me"}, |
77 | {"form", 4, MH_OPT_ARG, "formatfile"}, | 77 | { "form", MH_OPT_ARG, "formatfile"}, |
78 | {"width", 1, MH_OPT_ARG, "number"}, | 78 | { "width", MH_OPT_ARG, "number"}, |
79 | {"draftfolder", 6, MH_OPT_ARG, "folder"}, | 79 | { "draftfolder", MH_OPT_ARG, "folder"}, |
80 | {"nodraftfolder", 3 }, | 80 | { "nodraftfolder" }, |
81 | {"draftmessage", 6, }, | 81 | { "draftmessage" }, |
82 | {"editor", 1, MH_OPT_ARG, "program"}, | 82 | { "editor", MH_OPT_ARG, "program"}, |
83 | {"noedit", 3, }, | 83 | { "noedit" }, |
84 | {"fcc", 1, MH_OPT_ARG, "folder"}, | 84 | { "fcc", MH_OPT_ARG, "folder"}, |
85 | {"filter", 2, MH_OPT_ARG, "program"}, | 85 | { "filter", MH_OPT_ARG, "program"}, |
86 | {"format", 2, MH_OPT_BOOL }, | 86 | { "format", MH_OPT_BOOL }, |
87 | {"group", 1, MH_OPT_BOOL }, | 87 | { "group", MH_OPT_BOOL }, |
88 | {"inplace", 1, MH_OPT_BOOL }, | 88 | { "inplace", MH_OPT_BOOL }, |
89 | {"query", 1, MH_OPT_BOOL }, | 89 | { "query", MH_OPT_BOOL }, |
90 | {"whatnowproc", 2, MH_OPT_ARG, "program"}, | 90 | { "whatnowproc", MH_OPT_ARG, "program"}, |
91 | {"nowhatnowproc", 3 }, | 91 | { "nowhatnowproc" }, |
92 | { 0 } | 92 | { NULL } |
93 | }; | 93 | }; |
94 | 94 | ||
95 | static char default_format_str[] = | 95 | static char default_format_str[] = | ... | ... |
... | @@ -47,7 +47,7 @@ static struct argp_option options[] = { | ... | @@ -47,7 +47,7 @@ static struct argp_option options[] = { |
47 | 47 | ||
48 | /* Traditional MH options */ | 48 | /* Traditional MH options */ |
49 | struct mh_option mh_option[] = { | 49 | struct mh_option mh_option[] = { |
50 | {"interactive", 1, MH_OPT_BOOL, NULL}, | 50 | { "interactive", MH_OPT_BOOL }, |
51 | { 0 } | 51 | { 0 } |
52 | }; | 52 | }; |
53 | 53 | ... | ... |
... | @@ -32,7 +32,7 @@ static struct argp_option options[] = { | ... | @@ -32,7 +32,7 @@ static struct argp_option options[] = { |
32 | 32 | ||
33 | /* Traditional MH options */ | 33 | /* Traditional MH options */ |
34 | struct mh_option mh_option[] = { | 34 | struct mh_option mh_option[] = { |
35 | { 0 } | 35 | { NULL } |
36 | }; | 36 | }; |
37 | 37 | ||
38 | static error_t | 38 | static error_t | ... | ... |
... | @@ -56,14 +56,14 @@ static struct argp_option options[] = { | ... | @@ -56,14 +56,14 @@ static struct argp_option options[] = { |
56 | 56 | ||
57 | /* Traditional MH options */ | 57 | /* Traditional MH options */ |
58 | struct mh_option mh_option[] = { | 58 | struct mh_option mh_option[] = { |
59 | {"clear", 1, MH_OPT_BOOL}, | 59 | { "clear", MH_OPT_BOOL }, |
60 | {"form", 4, MH_OPT_ARG, "formatfile"}, | 60 | { "form", MH_OPT_ARG, "formatfile" }, |
61 | {"format", 5, MH_OPT_ARG, "string"}, | 61 | { "format", MH_OPT_ARG, "string" }, |
62 | {"header", 3, MH_OPT_BOOL}, | 62 | { "header", MH_OPT_BOOL }, |
63 | {"width", 1, MH_OPT_ARG, "number"}, | 63 | { "width", MH_OPT_ARG, "number" }, |
64 | {"reverse", 1, MH_OPT_BOOL}, | 64 | { "reverse", MH_OPT_BOOL }, |
65 | {"file", 4, MH_OPT_ARG, "file"}, | 65 | { "file", MH_OPT_ARG, "file" }, |
66 | { 0 } | 66 | { NULL } |
67 | }; | 67 | }; |
68 | 68 | ||
69 | static int clear; | 69 | static int clear; | ... | ... |
... | @@ -79,25 +79,25 @@ static struct argp_option options[] = { | ... | @@ -79,25 +79,25 @@ static struct argp_option options[] = { |
79 | 79 | ||
80 | /* Traditional MH options */ | 80 | /* Traditional MH options */ |
81 | struct mh_option mh_option[] = { | 81 | struct mh_option mh_option[] = { |
82 | {"alias", 1, 0, "aliasfile" }, | 82 | { "alias", MH_OPT_ARG, "aliasfile" }, |
83 | {"draft", 5, 0, NULL }, | 83 | { "draft" }, |
84 | {"draftfolder", 6, 0, "folder" }, | 84 | { "draftfolder", MH_OPT_ARG, "folder" }, |
85 | {"draftmessage", 6, 0, "message"}, | 85 | { "draftmessage", MH_OPT_ARG, "message" }, |
86 | {"nodraftfolder", 3, 0, NULL }, | 86 | { "nodraftfolder" }, |
87 | {"filter", 2, 0, "filterfile"}, | 87 | { "filter", MH_OPT_ARG, "filterfile" }, |
88 | {"nofilter", 3, 0, NULL }, | 88 | { "nofilter" }, |
89 | {"format", 4, MH_OPT_BOOL, NULL}, | 89 | { "format", MH_OPT_BOOL }, |
90 | {"forward", 4, MH_OPT_BOOL, NULL}, | 90 | { "forward", MH_OPT_BOOL }, |
91 | {"mime", 2, MH_OPT_BOOL, NULL}, | 91 | { "mime", MH_OPT_BOOL }, |
92 | {"msgid", 2, MH_OPT_BOOL, NULL}, | 92 | { "msgid", MH_OPT_BOOL }, |
93 | {"push", 2, MH_OPT_BOOL, NULL}, | 93 | { "push", MH_OPT_BOOL }, |
94 | {"preserve", 2, MH_OPT_BOOL, NULL}, | 94 | { "preserve", MH_OPT_BOOL }, |
95 | {"keep", 1, MH_OPT_BOOL, NULL}, | 95 | { "keep", MH_OPT_BOOL }, |
96 | {"split", 1, 0, "seconds"}, | 96 | { "split", MH_OPT_ARG, "seconds" }, |
97 | {"verbose", 1, MH_OPT_BOOL, NULL}, | 97 | { "verbose", MH_OPT_BOOL }, |
98 | {"watch", 2, MH_OPT_BOOL, NULL}, | 98 | { "watch", MH_OPT_BOOL }, |
99 | {"width", 2, 0, NULL }, | 99 | { "width" }, |
100 | { 0 } | 100 | { NULL } |
101 | }; | 101 | }; |
102 | 102 | ||
103 | static int use_draft; /* Use the prepared draft */ | 103 | static int use_draft; /* Use the prepared draft */ | ... | ... |
... | @@ -78,13 +78,13 @@ static struct argp_option options[] = { | ... | @@ -78,13 +78,13 @@ static struct argp_option options[] = { |
78 | 78 | ||
79 | /* Traditional MH options */ | 79 | /* Traditional MH options */ |
80 | struct mh_option mh_option[] = { | 80 | struct mh_option mh_option[] = { |
81 | {"datefield", 1, 0, "field" }, | 81 | { "datefield", MH_OPT_ARG, "field" }, |
82 | {"nodatefield", 3, 0, 0 }, | 82 | { "nodatefield" }, |
83 | {"textfield", 1, 0, "field" }, | 83 | { "textfield", MH_OPT_ARG, "field" }, |
84 | {"notextfield", 3, 0, 0 }, | 84 | { "notextfield" }, |
85 | {"limit", 1, 0, "days" }, | 85 | { "limit", MH_OPT_ARG, "days" }, |
86 | {"nolimit", 3, 0, 0 }, | 86 | { "nolimit" }, |
87 | {"verbose", 1, MH_OPT_BOOL, NULL}, | 87 | { "verbose", MH_OPT_BOOL }, |
88 | { NULL }, | 88 | { NULL }, |
89 | }; | 89 | }; |
90 | 90 | ... | ... |
... | @@ -38,13 +38,13 @@ static struct argp_option options[] = { | ... | @@ -38,13 +38,13 @@ static struct argp_option options[] = { |
38 | 38 | ||
39 | /* Traditional MH options */ | 39 | /* Traditional MH options */ |
40 | struct mh_option mh_option[] = { | 40 | struct mh_option mh_option[] = { |
41 | {"draftfolder", 6, MH_OPT_ARG, "folder"}, | 41 | { "draftfolder", MH_OPT_ARG, "folder" }, |
42 | {"nodraftfolder", 3, }, | 42 | { "nodraftfolder" }, |
43 | {"draftmessage", 6, }, | 43 | { "draftmessage" }, |
44 | {"editor", 1, MH_OPT_ARG, "program"}, | 44 | { "editor", MH_OPT_ARG, "program" }, |
45 | {"noedit", 3, }, | 45 | { "noedit" }, |
46 | {"prompt", 1 }, | 46 | { "prompt" }, |
47 | { 0 } | 47 | { NULL } |
48 | }; | 48 | }; |
49 | 49 | ||
50 | struct mh_whatnow_env wh_env = { 0 }; | 50 | struct mh_whatnow_env wh_env = { 0 }; | ... | ... |
... | @@ -42,12 +42,12 @@ static struct argp_option options[] = { | ... | @@ -42,12 +42,12 @@ static struct argp_option options[] = { |
42 | 42 | ||
43 | /* Traditional MH options */ | 43 | /* Traditional MH options */ |
44 | struct mh_option mh_option[] = { | 44 | struct mh_option mh_option[] = { |
45 | {"alias", 1, 0, "aliasfile" }, | 45 | { "alias", MH_OPT_ARG, "aliasfile" }, |
46 | {"draft", 5, 0, NULL }, | 46 | { "draft" }, |
47 | {"draftfolder", 6, 0, "folder" }, | 47 | { "draftfolder", MH_OPT_ARG, "folder" }, |
48 | {"draftmessage", 6, 0, "message"}, | 48 | { "draftmessage", MH_OPT_ARG, "message" }, |
49 | {"nodraftfolder", 3, 0, NULL }, | 49 | { "nodraftfolder" }, |
50 | {"check", 1, MH_OPT_BOOL, NULL}, | 50 | { "check", MH_OPT_BOOL }, |
51 | {NULL} | 51 | {NULL} |
52 | }; | 52 | }; |
53 | 53 | ... | ... |
-
Please register or sign in to post a comment