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 @@
const char *program_version = "ali (" PACKAGE_STRING ")";
static char doc[] = N_("GNU MH ali")"\v"
N_("Options marked with `*' are not yet implemented.\n"
"Use -help to obtain the list of traditional MH options.");
N_("Use -help to obtain the list of traditional MH options.");
static char args_doc[] = N_("aliases ...");
/* GNU options */
......
......@@ -69,10 +69,12 @@ opt_handler (int key, char *arg, struct argp_state *state)
break;
case ARG_INPLACE:
mh_opt_notimpl_warning ("-inplace");
inplace = is_true (arg);
break;
case ARG_NOINPLACE:
mh_opt_notimpl_warning ("-noinplace");
inplace = 0;
break;
......
......@@ -140,8 +140,8 @@ opt_handler (int key, char *arg, struct argp_state *state)
case ARG_WHATNOWPROC:
case ARG_NOWHATNOWPROC:
argp_error (state, _("option is not yet implemented"));
exit (1);
mh_opt_notimpl ("-[no]whatnowproc");
break;
case ARG_LICENSE:
mh_license (argp_program_version);
......
......@@ -204,10 +204,13 @@ opt_handler (int key, char *arg, struct argp_state *state)
break;
case ARG_INPLACE:
mh_opt_notimpl_warning ("-inplace");
break;
case ARG_WHATNOWPROC:
case ARG_NOWHATNOWPROC:
argp_error (state, _("option is not yet implemented"));
exit (1);
mh_opt_notimpl ("-[no]whatnowproc");
break;
case ARG_LICENSE:
mh_license (argp_program_version);
......
......@@ -150,3 +150,16 @@ mh_help (struct mh_option *mh_opt, const char *doc)
"Run %s --help for more info on these.\n"),
mu_program_name);
}
void
mh_opt_notimpl (const char *name)
{
mu_error (_("option is not yet implemented: %s"), name);
exit (1);
}
void
mh_opt_notimpl_warning (const char *name)
{
mu_error (_("ignoring not implemented option %s"), name);
}
......
......@@ -197,3 +197,6 @@ int mh_argp_parse (int *argc, char **argv[],
void mh_help (struct mh_option *mh_option, const char *doc);
void mh_license (const char *name);
void mh_opt_notimpl (const char *name);
void mh_opt_notimpl_warning (const char *name);
......
......@@ -334,6 +334,7 @@ opt_handler (int key, char *arg, struct argp_state *state)
/* Display options */
case ARG_SERIALONLY:
mh_opt_notimpl_warning ("-[no]serialonly");
if (is_true (arg))
{
mode_options |= OPT_SERIALONLY;
......
......@@ -29,8 +29,7 @@
const char *program_version = "pick (" PACKAGE_STRING ")";
static char doc[] = N_("GNU MH pick")"\v"
N_("Options marked with `*' are not yet implemented.\n\
Use -help to obtain the list of traditional MH options.");
N_("Use -help to obtain the list of traditional MH options.");
static char args_doc[] = N_("[messages]");
/* GNU options */
......
......@@ -168,6 +168,7 @@ opt_handler (int key, char *arg, struct argp_state *state)
break;
case ARG_PRESERVE:
mh_opt_notimpl_warning ("-preserve");
preserve_flag = is_true(arg);
break;
......
......@@ -256,10 +256,13 @@ opt_handler (int key, char *arg, struct argp_state *state)
break;
case ARG_INPLACE:
mh_opt_notimpl_warning ("-inplace");
break;
case ARG_WHATNOWPROC:
case ARG_NOWHATNOWPROC:
argp_error (state, _("Option is not yet implemented"));
exit (1);
mh_opt_notimpl ("-[no]whatnowproc");
break;
case ARG_LICENSE:
mh_license (argp_program_version);
......
......@@ -134,7 +134,7 @@ opt_handler (int key, char *arg, struct argp_state *state)
break;
case ARG_FILE:
argp_error (state, _("Option is not yet implemented"));
mh_opt_notimpl ("-file");
break;
case ARG_LICENSE:
......
......@@ -170,30 +170,40 @@ opt_handler (int key, char *arg, struct argp_state *state)
break;
case ARG_FILTER:
mh_opt_notimpl ("-filter");
break;
case ARG_NOFILTER:
return 1;
mh_opt_notimpl ("-nofilter");
break;
case ARG_FORMAT:
mh_opt_notimpl_warning ("-format");
reformat_recipients = is_true (arg);
break;
case ARG_NOFORMAT:
mh_opt_notimpl_warning ("-noformat");
reformat_recipients = 0;
break;
case ARG_FORWARD:
mh_opt_notimpl_warning ("-forward");
forward_notice = is_true (arg);
break;
case ARG_NOFORWARD:
mh_opt_notimpl_warning ("-noforward");
forward_notice = 0;
break;
case ARG_MIME:
mh_opt_notimpl_warning ("-mime");
mime_encaps = is_true (arg);
break;
case ARG_NOMIME:
mh_opt_notimpl_warning ("-nomime");
mime_encaps = 0;
break;
......@@ -244,6 +254,7 @@ opt_handler (int key, char *arg, struct argp_state *state)
break;
case ARG_WIDTH:
mh_opt_notimpl_warning ("-width");
width = strtoul (arg, &p, 10);
if (*p)
{
......