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 */ ...@@ -30,7 +30,7 @@ static char *anno_text; /* header field value */
30 static struct mu_option options[] = { 30 static struct mu_option options[] = {
31 { "inplace", 0, NULL, MU_OPTION_HIDDEN, 31 { "inplace", 0, NULL, MU_OPTION_HIDDEN,
32 N_("annotate the message in place"), 32 N_("annotate the message in place"),
33 mu_c_string, NULL, mh_opt_notimpl_warning }, 33 mu_c_bool, NULL, mh_opt_notimpl_warning },
34 { "date", 0, NULL, MU_OPTION_DEFAULT, 34 { "date", 0, NULL, MU_OPTION_DEFAULT,
35 N_("add FIELD: date header"), 35 N_("add FIELD: date header"),
36 mu_c_bool, &anno_date }, 36 mu_c_bool, &anno_date },
......
...@@ -293,6 +293,12 @@ void ...@@ -293,6 +293,12 @@ void
293 mh_opt_notimpl_warning (struct mu_parseopt *po, struct mu_option *opt, 293 mh_opt_notimpl_warning (struct mu_parseopt *po, struct mu_option *opt,
294 char const *arg) 294 char const *arg)
295 { 295 {
296 if (opt->opt_type == mu_c_bool)
297 {
298 int val;
299 if (mu_str_to_c (arg, opt->opt_type, &val, NULL) == 0 && !val)
300 return;
301 }
296 mu_error (_("ignoring not implemented option %s"), opt->opt_long); 302 mu_error (_("ignoring not implemented option %s"), opt->opt_long);
297 } 303 }
298 304
......
...@@ -63,7 +63,7 @@ static struct mu_option options[] = { ...@@ -63,7 +63,7 @@ static struct mu_option options[] = {
63 { "link", 0, NULL, MU_OPTION_ALIAS }, 63 { "link", 0, NULL, MU_OPTION_ALIAS },
64 { "preserve", 0, NULL, MU_OPTION_HIDDEN, 64 { "preserve", 0, NULL, MU_OPTION_HIDDEN,
65 N_("try to preserve message sequence numbers"), 65 N_("try to preserve message sequence numbers"),
66 mu_c_string, NULL, mh_opt_notimpl_warning }, 66 mu_c_bool, NULL, mh_opt_notimpl_warning },
67 { "source", 0, N_("FOLDER"), MU_OPTION_DEFAULT, 67 { "source", 0, N_("FOLDER"), MU_OPTION_DEFAULT,
68 N_("specify source folder; it will become the current folder after the program exits"), 68 N_("specify source folder; it will become the current folder after the program exits"),
69 mu_c_string, NULL, mh_opt_set_folder }, 69 mu_c_string, NULL, mh_opt_set_folder },
......
...@@ -129,7 +129,7 @@ static struct mu_option options[] = { ...@@ -129,7 +129,7 @@ static struct mu_option options[] = {
129 mu_c_string, NULL, clr_cc }, 129 mu_c_string, NULL, clr_cc },
130 { "group", 0, NULL, MU_OPTION_DEFAULT, 130 { "group", 0, NULL, MU_OPTION_DEFAULT,
131 N_("construct a group or followup reply"), 131 N_("construct a group or followup reply"),
132 mu_c_string, NULL, set_group }, 132 mu_c_bool, NULL, set_group },
133 { "editor", 0, N_("PROG"), MU_OPTION_DEFAULT, 133 { "editor", 0, N_("PROG"), MU_OPTION_DEFAULT,
134 N_("set the editor program to use"), 134 N_("set the editor program to use"),
135 mu_c_string, &wh_env.editor }, 135 mu_c_string, &wh_env.editor },
...@@ -153,10 +153,10 @@ static struct mu_option options[] = { ...@@ -153,10 +153,10 @@ static struct mu_option options[] = {
153 mu_c_string, &mhl_filter, mh_opt_clear_string }, 153 mu_c_string, &mhl_filter, mh_opt_clear_string },
154 { "inplace", 0, NULL, MU_OPTION_HIDDEN, 154 { "inplace", 0, NULL, MU_OPTION_HIDDEN,
155 N_("annotate the message in place"), 155 N_("annotate the message in place"),
156 mu_c_string, NULL, mh_opt_notimpl_warning }, 156 mu_c_bool, NULL, mh_opt_notimpl_warning },
157 { "query", 0, NULL, MU_OPTION_HIDDEN, 157 { "query", 0, NULL, MU_OPTION_HIDDEN,
158 N_("query for addresses to place in To: and Cc: lists"), 158 N_("query for addresses to place in To: and Cc: lists"),
159 mu_c_string, NULL, mh_opt_notimpl_warning }, 159 mu_c_bool, NULL, mh_opt_notimpl_warning },
160 { "width", 0, N_("NUMBER"), MU_OPTION_DEFAULT, 160 { "width", 0, N_("NUMBER"), MU_OPTION_DEFAULT,
161 N_("set output width"), 161 N_("set output width"),
162 mu_c_int, &width }, 162 mu_c_int, &width },
......
...@@ -118,14 +118,14 @@ static struct mu_option options[] = { ...@@ -118,14 +118,14 @@ static struct mu_option options[] = {
118 mu_c_string, NULL, mh_opt_notimpl }, 118 mu_c_string, NULL, mh_opt_notimpl },
119 { "nofilter", 0, NULL, MU_OPTION_HIDDEN, 119 { "nofilter", 0, NULL, MU_OPTION_HIDDEN,
120 N_("undo the effect of the last --filter option"), 120 N_("undo the effect of the last --filter option"),
121 mu_c_string, NULL, mh_opt_notimpl }, 121 mu_c_int, NULL, mh_opt_notimpl },
122 { "format", 0, NULL, MU_OPTION_HIDDEN, 122 { "format", 0, NULL, MU_OPTION_HIDDEN,
123 N_("reformat To: and Cc: addresses"), 123 N_("reformat To: and Cc: addresses"),
124 mu_c_string, NULL, mh_opt_notimpl_warning }, 124 mu_c_bool, NULL, mh_opt_notimpl_warning },
125 { "noformat", 0, NULL, MU_OPTION_HIDDEN }, 125 { "noformat", 0, NULL, MU_OPTION_HIDDEN },
126 { "forward", 0, NULL, MU_OPTION_HIDDEN, 126 { "forward", 0, NULL, MU_OPTION_HIDDEN,
127 N_("in case of failure forward the draft along with the failure notice to the sender"), 127 N_("in case of failure forward the draft along with the failure notice to the sender"),
128 mu_c_string, NULL, mh_opt_notimpl_warning }, 128 mu_c_bool, NULL, mh_opt_notimpl_warning },
129 { "noforward", 0, NULL, MU_OPTION_HIDDEN, "" }, 129 { "noforward", 0, NULL, MU_OPTION_HIDDEN, "" },
130 { "mime", 0, NULL, MU_OPTION_HIDDEN, 130 { "mime", 0, NULL, MU_OPTION_HIDDEN,
131 N_("use MIME encapsulation"), 131 N_("use MIME encapsulation"),
...@@ -154,7 +154,7 @@ static struct mu_option options[] = { ...@@ -154,7 +154,7 @@ static struct mu_option options[] = {
154 mu_c_bool, &watch }, 154 mu_c_bool, &watch },
155 { "width", 0, N_("NUMBER"), MU_OPTION_HIDDEN, 155 { "width", 0, N_("NUMBER"), MU_OPTION_HIDDEN,
156 N_("make header fields no longer than NUMBER columns"), 156 N_("make header fields no longer than NUMBER columns"),
157 mu_c_string, NULL, mh_opt_notimpl_warning }, 157 mu_c_uint, NULL, mh_opt_notimpl_warning },
158 158
159 MU_OPTION_END 159 MU_OPTION_END
160 }; 160 };
......