Use new struct mh_option
Showing
8 changed files
with
66 additions
and
63 deletions
... | @@ -35,8 +35,8 @@ static struct argp_option options[] = { | ... | @@ -35,8 +35,8 @@ static struct argp_option options[] = { |
35 | 35 | ||
36 | /* Traditional MH options */ | 36 | /* Traditional MH options */ |
37 | struct mh_option mh_option[] = { | 37 | struct mh_option mh_option[] = { |
38 | {"form", 4, 'F', MH_OPT_ARG, "formatfile"}, | 38 | {"form", 4, NULL, MH_OPT_ARG, "formatfile"}, |
39 | {"format", 5, 't', MH_OPT_ARG, "string"}, | 39 | {"format", 5, NULL, MH_OPT_ARG, "string"}, |
40 | { 0 } | 40 | { 0 } |
41 | }; | 41 | }; |
42 | 42 | ... | ... |
... | @@ -71,16 +71,16 @@ static struct argp_option options[] = { | ... | @@ -71,16 +71,16 @@ static struct argp_option options[] = { |
71 | 71 | ||
72 | /* Traditional MH options */ | 72 | /* Traditional MH options */ |
73 | struct mh_option mh_option[] = { | 73 | struct mh_option mh_option[] = { |
74 | {"print", 2, 'p', 0, NULL }, | 74 | {"print", 2, NULL, 0, NULL }, |
75 | {"list", 1, 'l', 0, NULL }, | 75 | {"list", 1, NULL, 0, NULL }, |
76 | {"push", 2, ARG_PUSH, 0, NULL }, | 76 | {"push", 2, NULL, 0, NULL }, |
77 | {"pop", 2, ARG_POP, 0, NULL }, | 77 | {"pop", 2, NULL, 0, NULL }, |
78 | {"all", 1, 'a', 0, NULL }, | 78 | {"all", 1, NULL, 0, NULL }, |
79 | {"create", 1, 'c', MH_OPT_BOOL, NULL}, | 79 | {"create", 1, NULL, MH_OPT_BOOL, NULL}, |
80 | {"fast", 1, 'F', MH_OPT_BOOL, NULL}, | 80 | {"fast", 1, NULL, MH_OPT_BOOL, NULL}, |
81 | {"header", 1, 'h', MH_OPT_BOOL, NULL}, | 81 | {"header", 1, NULL, MH_OPT_BOOL, NULL}, |
82 | {"recurse", 1, 'r', MH_OPT_BOOL, NULL}, | 82 | {"recurse", 1, NULL, MH_OPT_BOOL, NULL}, |
83 | {"total", 1, 't', MH_OPT_BOOL, NULL}, | 83 | {"total", 1, NULL, MH_OPT_BOOL, NULL}, |
84 | {NULL}, | 84 | {NULL}, |
85 | }; | 85 | }; |
86 | 86 | ... | ... |
... | @@ -46,15 +46,15 @@ static struct argp_option options[] = { | ... | @@ -46,15 +46,15 @@ static struct argp_option options[] = { |
46 | 46 | ||
47 | /* Traditional MH options */ | 47 | /* Traditional MH options */ |
48 | struct mh_option mh_option[] = { | 48 | struct mh_option mh_option[] = { |
49 | {"audit", 5, 'a', MH_OPT_ARG, "audit-file" }, | 49 | {"audit", 5, NULL, MH_OPT_ARG, "audit-file" }, |
50 | {"noaudit", 3, 'n', 0, }, | 50 | {"noaudit", 3, NULL, 0, }, |
51 | {"changecur", 1, 'c',MH_OPT_BOOL}, | 51 | {"changecur", 1, NULL, MH_OPT_BOOL}, |
52 | {"file", 2, 'i', MH_OPT_ARG, "input-file"}, | 52 | {"file", 2, NULL, MH_OPT_ARG, "input-file"}, |
53 | {"form", 4, 'F', MH_OPT_ARG, "format-file"}, | 53 | {"form", 4, NULL, MH_OPT_ARG, "format-file"}, |
54 | {"format", 5, 't', MH_OPT_ARG, "string"}, | 54 | {"format", 5, NULL, MH_OPT_ARG, "string"}, |
55 | {"truncate", 2, 'T', MH_OPT_BOOL, }, | 55 | {"truncate", 2, NULL, MH_OPT_BOOL, }, |
56 | {"width", 1, 'w', MH_OPT_ARG, "number"}, | 56 | {"width", 1, NULL, MH_OPT_ARG, "number"}, |
57 | {"quiet", 1, 'q', 0, }, | 57 | {"quiet", 1, NULL, 0, }, |
58 | { 0 } | 58 | { 0 } |
59 | }; | 59 | }; |
60 | 60 | ... | ... |
... | @@ -46,11 +46,11 @@ static struct argp_option options[] = { | ... | @@ -46,11 +46,11 @@ static struct argp_option options[] = { |
46 | 46 | ||
47 | /* Traditional MH options */ | 47 | /* Traditional MH options */ |
48 | struct mh_option mh_option[] = { | 48 | struct mh_option mh_option[] = { |
49 | {"file", 2, 'F', 0, "input-file"}, | 49 | {"file", 2, NULL, 0, "input-file"}, |
50 | {"draft", 1, 'd', 0, NULL }, | 50 | {"draft", 1, NULL, 0, NULL }, |
51 | {"link", 1, 'l', MH_OPT_BOOL, NULL }, | 51 | {"link", 1, NULL, MH_OPT_BOOL, NULL }, |
52 | {"preserve", 1, 'p', MH_OPT_BOOL, NULL }, | 52 | {"preserve", 1, NULL, MH_OPT_BOOL, NULL }, |
53 | {"src", 1, 's', 0, "+folder" }, | 53 | {"src", 1, NULL, 0, "+folder" }, |
54 | { 0 } | 54 | { 0 } |
55 | }; | 55 | }; |
56 | 56 | ... | ... |
... | @@ -68,23 +68,23 @@ static struct argp_option options[] = { | ... | @@ -68,23 +68,23 @@ static struct argp_option options[] = { |
68 | 68 | ||
69 | /* Traditional MH options */ | 69 | /* Traditional MH options */ |
70 | struct mh_option mh_option[] = { | 70 | struct mh_option mh_option[] = { |
71 | {"annotate", 1, 'a', MH_OPT_BOOL }, | 71 | {"annotate", 1, NULL, MH_OPT_BOOL }, |
72 | {"build", 1, 'b', }, | 72 | {"build", 1, NULL, }, |
73 | {"cc", 1, 'c', MH_OPT_ARG, "all/to/cc/me"}, | 73 | {"cc", 1, NULL, MH_OPT_ARG, "all/to/cc/me"}, |
74 | {"nocc", 3, 'n', MH_OPT_ARG, "all/to/cc/me"}, | 74 | {"nocc", 3, NULL, MH_OPT_ARG, "all/to/cc/me"}, |
75 | {"form", 4, 'F', MH_OPT_ARG, "formatfile"}, | 75 | {"form", 4, NULL, MH_OPT_ARG, "formatfile"}, |
76 | {"width", 1, 'w', MH_OPT_ARG, "number"}, | 76 | {"width", 1, NULL, MH_OPT_ARG, "number"}, |
77 | {"draftfolder", 6, 'd', MH_OPT_ARG, "folder"}, | 77 | {"draftfolder", 6, NULL, MH_OPT_ARG, "folder"}, |
78 | {"nodraftfolder", 3, ARG_NODRAFTFOLDER, }, | 78 | {"nodraftfolder", 3, NULL }, |
79 | {"draftmessage", 6, 'm' }, | 79 | {"draftmessage", 6, NULL }, |
80 | {"editor", 1, 'e', MH_OPT_ARG, "program"}, | 80 | {"editor", 1, NULL, MH_OPT_ARG, "program"}, |
81 | {"noedit", 3, ARG_NOEDIT, }, | 81 | {"noedit", 3, NULL, }, |
82 | {"fcc", 1, ARG_FCC, MH_OPT_ARG, "folder"}, | 82 | {"fcc", 1, NULL, MH_OPT_ARG, "folder"}, |
83 | {"filter", 2, ARG_FILTER, MH_OPT_ARG, "program"}, | 83 | {"filter", 2, NULL, MH_OPT_ARG, "program"}, |
84 | {"inplace", 1, ARG_INPLACE, MH_OPT_BOOL }, | 84 | {"inplace", 1, NULL, MH_OPT_BOOL }, |
85 | {"query", 1, ARG_QUERY, MH_OPT_BOOL }, | 85 | {"query", 1, NULL, MH_OPT_BOOL }, |
86 | {"whatnowproc", 2, ARG_WHATNOWPROC, MH_OPT_ARG, "program"}, | 86 | {"whatnowproc", 2, NULL, MH_OPT_ARG, "program"}, |
87 | {"nowhatnowproc", 3, ARG_NOWHATNOWPROC }, | 87 | {"nowhatnowproc", 3, NULL }, |
88 | { 0 } | 88 | { 0 } |
89 | }; | 89 | }; |
90 | 90 | ||
... | @@ -95,9 +95,8 @@ static char *format_str = | ... | @@ -95,9 +95,8 @@ static char *format_str = |
95 | "%<(nonnull)%(void(width))%(putaddr cc: )\\n%>" | 95 | "%<(nonnull)%(void(width))%(putaddr cc: )\\n%>" |
96 | "%<{fcc}Fcc: %{fcc}\\n%>" | 96 | "%<{fcc}Fcc: %{fcc}\\n%>" |
97 | "%<{subject}Subject: Re: %(unre{subject})\\n%>" | 97 | "%<{subject}Subject: Re: %(unre{subject})\\n%>" |
98 | "%<{date}In-reply-to: Your message of \"" | 98 | "%(lit)%(concat(in_reply_to))%<(nonnull)%(void(width))%(printstr In-reply-to: )\\n%>" |
99 | "%<(nodate{date})%{date}%|%(pretty{date})%>.\"%<{message-id}\n" | 99 | "%(lit)%(concat(references))%<(nonnull)%(void(width))%(printstr References: )\\n%>" |
100 | " %{message-id}%>\\n%>" | ||
101 | "--------\n"; | 100 | "--------\n"; |
102 | 101 | ||
103 | static mh_format_t format; | 102 | static mh_format_t format; |
... | @@ -119,12 +118,14 @@ decode_cc_flag (const char *opt, const char *arg) | ... | @@ -119,12 +118,14 @@ decode_cc_flag (const char *opt, const char *arg) |
119 | mh_error (_("%s %s is unknown"), opt, arg); | 118 | mh_error (_("%s %s is unknown"), opt, arg); |
120 | exit (1); | 119 | exit (1); |
121 | } | 120 | } |
122 | return 0; /* never reached */ | 121 | return rc; |
123 | } | 122 | } |
124 | 123 | ||
125 | static int | 124 | static int |
126 | opt_handler (int key, char *arg, void *unused) | 125 | opt_handler (int key, char *arg, void *unused) |
127 | { | 126 | { |
127 | char *s; | ||
128 | |||
128 | switch (key) | 129 | switch (key) |
129 | { | 130 | { |
130 | case 'b': | 131 | case 'b': |
... | @@ -137,7 +138,7 @@ opt_handler (int key, char *arg, void *unused) | ... | @@ -137,7 +138,7 @@ opt_handler (int key, char *arg, void *unused) |
137 | break; | 138 | break; |
138 | 139 | ||
139 | case 'n': | 140 | case 'n': |
140 | rcpt_mask ^= decode_cc_flag ("-nocc", arg); | 141 | rcpt_mask &= ~decode_cc_flag ("-nocc", arg); |
141 | break; | 142 | break; |
142 | 143 | ||
143 | case 'd': | 144 | case 'd': |
... | @@ -154,7 +155,9 @@ opt_handler (int key, char *arg, void *unused) | ... | @@ -154,7 +155,9 @@ opt_handler (int key, char *arg, void *unused) |
154 | break; | 155 | break; |
155 | 156 | ||
156 | case 'F': | 157 | case 'F': |
157 | mh_read_formfile (arg, &format_str); | 158 | s = mh_expand_name (MHLIBDIR, arg, 0); |
159 | mh_read_formfile (s, &format_str); | ||
160 | free (s); | ||
158 | break; | 161 | break; |
159 | 162 | ||
160 | case 'm': | 163 | case 'm': | ... | ... |
... | @@ -44,7 +44,7 @@ static struct argp_option options[] = { | ... | @@ -44,7 +44,7 @@ static struct argp_option options[] = { |
44 | 44 | ||
45 | /* Traditional MH options */ | 45 | /* Traditional MH options */ |
46 | struct mh_option mh_option[] = { | 46 | struct mh_option mh_option[] = { |
47 | {"interactive", 1, 'i', MH_OPT_BOOL, NULL}, | 47 | {"interactive", 1, NULL, MH_OPT_BOOL, NULL}, |
48 | { 0 } | 48 | { 0 } |
49 | }; | 49 | }; |
50 | 50 | ... | ... |
... | @@ -52,13 +52,13 @@ static struct argp_option options[] = { | ... | @@ -52,13 +52,13 @@ 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 | {"clear", 1, 'c', MH_OPT_BOOL}, | 55 | {"clear", 1, NULL, MH_OPT_BOOL}, |
56 | {"form", 4, 'F', MH_OPT_ARG, "formatfile"}, | 56 | {"form", 4, NULL, MH_OPT_ARG, "formatfile"}, |
57 | {"format", 5, 't', MH_OPT_ARG, "string"}, | 57 | {"format", 5, NULL, MH_OPT_ARG, "string"}, |
58 | {"header", 3, 'H', MH_OPT_BOOL}, | 58 | {"header", 3, NULL, MH_OPT_BOOL}, |
59 | {"width", 1, 'w', MH_OPT_ARG, "number"}, | 59 | {"width", 1, NULL, MH_OPT_ARG, "number"}, |
60 | {"reverse", 1, 'r', MH_OPT_BOOL}, | 60 | {"reverse", 1, NULL, MH_OPT_BOOL}, |
61 | {"file", 4, 'i', MH_OPT_ARG, "file"}, | 61 | {"file", 4, NULL, MH_OPT_ARG, "file"}, |
62 | { 0 } | 62 | { 0 } |
63 | }; | 63 | }; |
64 | 64 | ... | ... |
... | @@ -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 | {"draftfolder", 6, 'd', MH_OPT_ARG, "folder"}, | 45 | {"draftfolder", 6, NULL, MH_OPT_ARG, "folder"}, |
46 | {"nodraftfolder", 3, ARG_NODRAFTFOLDER, }, | 46 | {"nodraftfolder", 3, NULL, }, |
47 | {"draftmessage", 6, 'm' }, | 47 | {"draftmessage", 6, NULL }, |
48 | {"editor", 1, 'e', MH_OPT_ARG, "program"}, | 48 | {"editor", 1, NULL, MH_OPT_ARG, "program"}, |
49 | {"noedit", 3, ARG_NOEDIT, }, | 49 | {"noedit", 3, NULL, }, |
50 | {"prompt", 1, 'p' }, | 50 | {"prompt", 1, NULL }, |
51 | { 0 } | 51 | { 0 } |
52 | }; | 52 | }; |
53 | 53 | ... | ... |
-
Please register or sign in to post a comment