From d6d78fad1073dc4b1da28696a5aec01b6460ad29 Mon Sep 17 00:00:00 2001 From: Sergey Poznyakoff Date: Thu, 13 May 2010 16:54:03 +0300 Subject: 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. --- mh/ali.c | 3 +-- mh/anno.c | 2 ++ mh/comp.c | 6 +++--- mh/forw.c | 9 ++++++--- mh/mh_getopt.c | 13 +++++++++++++ mh/mh_getopt.h | 3 +++ mh/mhn.c | 1 + mh/pick.c | 3 +-- mh/refile.c | 1 + mh/repl.c | 9 ++++++--- mh/scan.c | 2 +- mh/send.c | 15 +++++++++++++-- 12 files changed, 51 insertions(+), 16 deletions(-) diff --git a/mh/ali.c b/mh/ali.c index 851ee1aa9..088bd35ae 100644 --- a/mh/ali.c +++ b/mh/ali.c @@ -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 */ diff --git a/mh/anno.c b/mh/anno.c index 83119c3ee..8b3319aef 100644 --- a/mh/anno.c +++ b/mh/anno.c @@ -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; diff --git a/mh/comp.c b/mh/comp.c index fc13db596..bcc00675b 100644 --- a/mh/comp.c +++ b/mh/comp.c @@ -140,9 +140,9 @@ 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); break; diff --git a/mh/forw.c b/mh/forw.c index 196c79417..9597cfb86 100644 --- a/mh/forw.c +++ b/mh/forw.c @@ -204,11 +204,14 @@ 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); break; diff --git a/mh/mh_getopt.c b/mh/mh_getopt.c index dbd385a53..2a6c9490f 100644 --- a/mh/mh_getopt.c +++ b/mh/mh_getopt.c @@ -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); +} diff --git a/mh/mh_getopt.h b/mh/mh_getopt.h index bd26f832a..b930cf348 100644 --- a/mh/mh_getopt.h +++ b/mh/mh_getopt.h @@ -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); diff --git a/mh/mhn.c b/mh/mhn.c index b54d109ce..b764e970b 100644 --- a/mh/mhn.c +++ b/mh/mhn.c @@ -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; diff --git a/mh/pick.c b/mh/pick.c index e88aec018..ecf3f8ab2 100644 --- a/mh/pick.c +++ b/mh/pick.c @@ -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 */ diff --git a/mh/refile.c b/mh/refile.c index 9cade4c02..5bf2faad0 100644 --- a/mh/refile.c +++ b/mh/refile.c @@ -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; diff --git a/mh/repl.c b/mh/repl.c index af6b22d37..73fba50f1 100644 --- a/mh/repl.c +++ b/mh/repl.c @@ -256,11 +256,14 @@ 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); break; diff --git a/mh/scan.c b/mh/scan.c index cdffca051..36081a881 100644 --- a/mh/scan.c +++ b/mh/scan.c @@ -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: diff --git a/mh/send.c b/mh/send.c index 8118d7f2a..3f92c9da5 100644 --- a/mh/send.c +++ b/mh/send.c @@ -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) { -- cgit v1.2.1