Commit d6d78fad d6d78fad1073dc4b1da28696a5aec01b6460ad29 by Sergey Poznyakoff

MH: Improve handling of not implemented options.

* mh/mh_getopt.c (mh_opt_notimpl, mh_opt_notimpl_warning): New
functions.
* mh/mh_getopt.h (mh_opt_notimpl, mh_opt_notimpl_warning): New
protos.
* mh/ali.c (doc): Remove 'not implemented' stanza.
* mh/pick.c: Likewise.
* mh/anno.c: Use mh_opt_notimpl and mh_opt_notimpl_warning
for not implemented options.
* mh/comp.c: Likewise.
* mh/forw.c: Likewise.
* mh/mhn.c: Likewise.
* mh/refile.c: Likewise.
* mh/repl.c: Likewise.
* mh/scan.c: Likewise.
* mh/send.c: Likewise.
1 parent ae130d52
...@@ -28,8 +28,7 @@ ...@@ -28,8 +28,7 @@
28 28
29 const char *program_version = "ali (" PACKAGE_STRING ")"; 29 const char *program_version = "ali (" PACKAGE_STRING ")";
30 static char doc[] = N_("GNU MH ali")"\v" 30 static char doc[] = N_("GNU MH ali")"\v"
31 N_("Options marked with `*' are not yet implemented.\n" 31 N_("Use -help to obtain the list of traditional MH options.");
32 "Use -help to obtain the list of traditional MH options.");
33 static char args_doc[] = N_("aliases ..."); 32 static char args_doc[] = N_("aliases ...");
34 33
35 /* GNU options */ 34 /* GNU options */
......
...@@ -69,10 +69,12 @@ opt_handler (int key, char *arg, struct argp_state *state) ...@@ -69,10 +69,12 @@ opt_handler (int key, char *arg, struct argp_state *state)
69 break; 69 break;
70 70
71 case ARG_INPLACE: 71 case ARG_INPLACE:
72 mh_opt_notimpl_warning ("-inplace");
72 inplace = is_true (arg); 73 inplace = is_true (arg);
73 break; 74 break;
74 75
75 case ARG_NOINPLACE: 76 case ARG_NOINPLACE:
77 mh_opt_notimpl_warning ("-noinplace");
76 inplace = 0; 78 inplace = 0;
77 break; 79 break;
78 80
......
...@@ -140,9 +140,9 @@ opt_handler (int key, char *arg, struct argp_state *state) ...@@ -140,9 +140,9 @@ opt_handler (int key, char *arg, struct argp_state *state)
140 140
141 case ARG_WHATNOWPROC: 141 case ARG_WHATNOWPROC:
142 case ARG_NOWHATNOWPROC: 142 case ARG_NOWHATNOWPROC:
143 argp_error (state, _("option is not yet implemented")); 143 mh_opt_notimpl ("-[no]whatnowproc");
144 exit (1); 144 break;
145 145
146 case ARG_LICENSE: 146 case ARG_LICENSE:
147 mh_license (argp_program_version); 147 mh_license (argp_program_version);
148 break; 148 break;
......
...@@ -204,11 +204,14 @@ opt_handler (int key, char *arg, struct argp_state *state) ...@@ -204,11 +204,14 @@ opt_handler (int key, char *arg, struct argp_state *state)
204 break; 204 break;
205 205
206 case ARG_INPLACE: 206 case ARG_INPLACE:
207 mh_opt_notimpl_warning ("-inplace");
208 break;
209
207 case ARG_WHATNOWPROC: 210 case ARG_WHATNOWPROC:
208 case ARG_NOWHATNOWPROC: 211 case ARG_NOWHATNOWPROC:
209 argp_error (state, _("option is not yet implemented")); 212 mh_opt_notimpl ("-[no]whatnowproc");
210 exit (1); 213 break;
211 214
212 case ARG_LICENSE: 215 case ARG_LICENSE:
213 mh_license (argp_program_version); 216 mh_license (argp_program_version);
214 break; 217 break;
......
...@@ -150,3 +150,16 @@ mh_help (struct mh_option *mh_opt, const char *doc) ...@@ -150,3 +150,16 @@ mh_help (struct mh_option *mh_opt, const char *doc)
150 "Run %s --help for more info on these.\n"), 150 "Run %s --help for more info on these.\n"),
151 mu_program_name); 151 mu_program_name);
152 } 152 }
153
154 void
155 mh_opt_notimpl (const char *name)
156 {
157 mu_error (_("option is not yet implemented: %s"), name);
158 exit (1);
159 }
160
161 void
162 mh_opt_notimpl_warning (const char *name)
163 {
164 mu_error (_("ignoring not implemented option %s"), name);
165 }
......
...@@ -197,3 +197,6 @@ int mh_argp_parse (int *argc, char **argv[], ...@@ -197,3 +197,6 @@ int mh_argp_parse (int *argc, char **argv[],
197 197
198 void mh_help (struct mh_option *mh_option, const char *doc); 198 void mh_help (struct mh_option *mh_option, const char *doc);
199 void mh_license (const char *name); 199 void mh_license (const char *name);
200
201 void mh_opt_notimpl (const char *name);
202 void mh_opt_notimpl_warning (const char *name);
......
...@@ -334,6 +334,7 @@ opt_handler (int key, char *arg, struct argp_state *state) ...@@ -334,6 +334,7 @@ opt_handler (int key, char *arg, struct argp_state *state)
334 /* Display options */ 334 /* Display options */
335 335
336 case ARG_SERIALONLY: 336 case ARG_SERIALONLY:
337 mh_opt_notimpl_warning ("-[no]serialonly");
337 if (is_true (arg)) 338 if (is_true (arg))
338 { 339 {
339 mode_options |= OPT_SERIALONLY; 340 mode_options |= OPT_SERIALONLY;
......
...@@ -29,8 +29,7 @@ ...@@ -29,8 +29,7 @@
29 29
30 const char *program_version = "pick (" PACKAGE_STRING ")"; 30 const char *program_version = "pick (" PACKAGE_STRING ")";
31 static char doc[] = N_("GNU MH pick")"\v" 31 static char doc[] = N_("GNU MH pick")"\v"
32 N_("Options marked with `*' are not yet implemented.\n\ 32 N_("Use -help to obtain the list of traditional MH options.");
33 Use -help to obtain the list of traditional MH options.");
34 static char args_doc[] = N_("[messages]"); 33 static char args_doc[] = N_("[messages]");
35 34
36 /* GNU options */ 35 /* GNU options */
......
...@@ -168,6 +168,7 @@ opt_handler (int key, char *arg, struct argp_state *state) ...@@ -168,6 +168,7 @@ opt_handler (int key, char *arg, struct argp_state *state)
168 break; 168 break;
169 169
170 case ARG_PRESERVE: 170 case ARG_PRESERVE:
171 mh_opt_notimpl_warning ("-preserve");
171 preserve_flag = is_true(arg); 172 preserve_flag = is_true(arg);
172 break; 173 break;
173 174
......
...@@ -256,11 +256,14 @@ opt_handler (int key, char *arg, struct argp_state *state) ...@@ -256,11 +256,14 @@ opt_handler (int key, char *arg, struct argp_state *state)
256 break; 256 break;
257 257
258 case ARG_INPLACE: 258 case ARG_INPLACE:
259 mh_opt_notimpl_warning ("-inplace");
260 break;
261
259 case ARG_WHATNOWPROC: 262 case ARG_WHATNOWPROC:
260 case ARG_NOWHATNOWPROC: 263 case ARG_NOWHATNOWPROC:
261 argp_error (state, _("Option is not yet implemented")); 264 mh_opt_notimpl ("-[no]whatnowproc");
262 exit (1); 265 break;
263 266
264 case ARG_LICENSE: 267 case ARG_LICENSE:
265 mh_license (argp_program_version); 268 mh_license (argp_program_version);
266 break; 269 break;
......
...@@ -134,7 +134,7 @@ opt_handler (int key, char *arg, struct argp_state *state) ...@@ -134,7 +134,7 @@ opt_handler (int key, char *arg, struct argp_state *state)
134 break; 134 break;
135 135
136 case ARG_FILE: 136 case ARG_FILE:
137 argp_error (state, _("Option is not yet implemented")); 137 mh_opt_notimpl ("-file");
138 break; 138 break;
139 139
140 case ARG_LICENSE: 140 case ARG_LICENSE:
......
...@@ -170,30 +170,40 @@ opt_handler (int key, char *arg, struct argp_state *state) ...@@ -170,30 +170,40 @@ opt_handler (int key, char *arg, struct argp_state *state)
170 break; 170 break;
171 171
172 case ARG_FILTER: 172 case ARG_FILTER:
173 mh_opt_notimpl ("-filter");
174 break;
175
173 case ARG_NOFILTER: 176 case ARG_NOFILTER:
174 return 1; 177 mh_opt_notimpl ("-nofilter");
175 178 break;
179
176 case ARG_FORMAT: 180 case ARG_FORMAT:
181 mh_opt_notimpl_warning ("-format");
177 reformat_recipients = is_true (arg); 182 reformat_recipients = is_true (arg);
178 break; 183 break;
179 184
180 case ARG_NOFORMAT: 185 case ARG_NOFORMAT:
186 mh_opt_notimpl_warning ("-noformat");
181 reformat_recipients = 0; 187 reformat_recipients = 0;
182 break; 188 break;
183 189
184 case ARG_FORWARD: 190 case ARG_FORWARD:
191 mh_opt_notimpl_warning ("-forward");
185 forward_notice = is_true (arg); 192 forward_notice = is_true (arg);
186 break; 193 break;
187 194
188 case ARG_NOFORWARD: 195 case ARG_NOFORWARD:
196 mh_opt_notimpl_warning ("-noforward");
189 forward_notice = 0; 197 forward_notice = 0;
190 break; 198 break;
191 199
192 case ARG_MIME: 200 case ARG_MIME:
201 mh_opt_notimpl_warning ("-mime");
193 mime_encaps = is_true (arg); 202 mime_encaps = is_true (arg);
194 break; 203 break;
195 204
196 case ARG_NOMIME: 205 case ARG_NOMIME:
206 mh_opt_notimpl_warning ("-nomime");
197 mime_encaps = 0; 207 mime_encaps = 0;
198 break; 208 break;
199 209
...@@ -244,6 +254,7 @@ opt_handler (int key, char *arg, struct argp_state *state) ...@@ -244,6 +254,7 @@ opt_handler (int key, char *arg, struct argp_state *state)
244 break; 254 break;
245 255
246 case ARG_WIDTH: 256 case ARG_WIDTH:
257 mh_opt_notimpl_warning ("-width");
247 width = strtoul (arg, &p, 10); 258 width = strtoul (arg, &p, 10);
248 if (*p) 259 if (*p)
249 { 260 {
......