Commit fd11c913 fd11c9136b9d862fa788ecb747cf5d1e9413a869 by Sergey Poznyakoff

Bugfixes in MH

* mh/mh_getopt.c (mh_opt_notimpl_warning): For boolean options,
don't emit warning if the value would be set to false.
* mh/anno.c: Fix the type of boolean unimplemented options.
* mh/refile.c: Likewise.
* mh/repl.c: Likewise.
* mh/send.c: Likewise.
1 parent 2ffea3b6
......@@ -30,7 +30,7 @@ static char *anno_text; /* header field value */
static struct mu_option options[] = {
{ "inplace", 0, NULL, MU_OPTION_HIDDEN,
N_("annotate the message in place"),
mu_c_string, NULL, mh_opt_notimpl_warning },
mu_c_bool, NULL, mh_opt_notimpl_warning },
{ "date", 0, NULL, MU_OPTION_DEFAULT,
N_("add FIELD: date header"),
mu_c_bool, &anno_date },
......
......@@ -293,6 +293,12 @@ void
mh_opt_notimpl_warning (struct mu_parseopt *po, struct mu_option *opt,
char const *arg)
{
if (opt->opt_type == mu_c_bool)
{
int val;
if (mu_str_to_c (arg, opt->opt_type, &val, NULL) == 0 && !val)
return;
}
mu_error (_("ignoring not implemented option %s"), opt->opt_long);
}
......
......@@ -63,7 +63,7 @@ static struct mu_option options[] = {
{ "link", 0, NULL, MU_OPTION_ALIAS },
{ "preserve", 0, NULL, MU_OPTION_HIDDEN,
N_("try to preserve message sequence numbers"),
mu_c_string, NULL, mh_opt_notimpl_warning },
mu_c_bool, NULL, mh_opt_notimpl_warning },
{ "source", 0, N_("FOLDER"), MU_OPTION_DEFAULT,
N_("specify source folder; it will become the current folder after the program exits"),
mu_c_string, NULL, mh_opt_set_folder },
......
......@@ -129,7 +129,7 @@ static struct mu_option options[] = {
mu_c_string, NULL, clr_cc },
{ "group", 0, NULL, MU_OPTION_DEFAULT,
N_("construct a group or followup reply"),
mu_c_string, NULL, set_group },
mu_c_bool, NULL, set_group },
{ "editor", 0, N_("PROG"), MU_OPTION_DEFAULT,
N_("set the editor program to use"),
mu_c_string, &wh_env.editor },
......@@ -153,10 +153,10 @@ static struct mu_option options[] = {
mu_c_string, &mhl_filter, mh_opt_clear_string },
{ "inplace", 0, NULL, MU_OPTION_HIDDEN,
N_("annotate the message in place"),
mu_c_string, NULL, mh_opt_notimpl_warning },
mu_c_bool, NULL, mh_opt_notimpl_warning },
{ "query", 0, NULL, MU_OPTION_HIDDEN,
N_("query for addresses to place in To: and Cc: lists"),
mu_c_string, NULL, mh_opt_notimpl_warning },
mu_c_bool, NULL, mh_opt_notimpl_warning },
{ "width", 0, N_("NUMBER"), MU_OPTION_DEFAULT,
N_("set output width"),
mu_c_int, &width },
......
......@@ -118,14 +118,14 @@ static struct mu_option options[] = {
mu_c_string, NULL, mh_opt_notimpl },
{ "nofilter", 0, NULL, MU_OPTION_HIDDEN,
N_("undo the effect of the last --filter option"),
mu_c_string, NULL, mh_opt_notimpl },
mu_c_int, NULL, mh_opt_notimpl },
{ "format", 0, NULL, MU_OPTION_HIDDEN,
N_("reformat To: and Cc: addresses"),
mu_c_string, NULL, mh_opt_notimpl_warning },
mu_c_bool, NULL, mh_opt_notimpl_warning },
{ "noformat", 0, NULL, MU_OPTION_HIDDEN },
{ "forward", 0, NULL, MU_OPTION_HIDDEN,
N_("in case of failure forward the draft along with the failure notice to the sender"),
mu_c_string, NULL, mh_opt_notimpl_warning },
mu_c_bool, NULL, mh_opt_notimpl_warning },
{ "noforward", 0, NULL, MU_OPTION_HIDDEN, "" },
{ "mime", 0, NULL, MU_OPTION_HIDDEN,
N_("use MIME encapsulation"),
......@@ -154,7 +154,7 @@ static struct mu_option options[] = {
mu_c_bool, &watch },
{ "width", 0, N_("NUMBER"), MU_OPTION_HIDDEN,
N_("make header fields no longer than NUMBER columns"),
mu_c_string, NULL, mh_opt_notimpl_warning },
mu_c_uint, NULL, mh_opt_notimpl_warning },
MU_OPTION_END
};
......