mh: fix the -nowhatnowproc option
The -nowhatnowproc option inhibits the invocation of whatnow, and consequently, prevents the editing of the draft from occurring.
Showing
4 changed files
with
10 additions
and
7 deletions
... | @@ -75,6 +75,7 @@ struct mh_option mh_option[] = { | ... | @@ -75,6 +75,7 @@ struct mh_option mh_option[] = { |
75 | struct mh_whatnow_env wh_env = { 0 }; | 75 | struct mh_whatnow_env wh_env = { 0 }; |
76 | static int initial_edit = 1; | 76 | static int initial_edit = 1; |
77 | static const char *whatnowproc; | 77 | static const char *whatnowproc; |
78 | static int nowhatnowproc; | ||
78 | char *formfile; | 79 | char *formfile; |
79 | static int build_only = 0; /* --build flag */ | 80 | static int build_only = 0; /* --build flag */ |
80 | static int use_draft = 0; /* --use flag */ | 81 | static int use_draft = 0; /* --use flag */ |
... | @@ -143,7 +144,7 @@ opt_handler (int key, char *arg, struct argp_state *state) | ... | @@ -143,7 +144,7 @@ opt_handler (int key, char *arg, struct argp_state *state) |
143 | break; | 144 | break; |
144 | 145 | ||
145 | case ARG_NOWHATNOWPROC: | 146 | case ARG_NOWHATNOWPROC: |
146 | whatnowproc = NULL; | 147 | nowhatnowproc = 1; |
147 | break; | 148 | break; |
148 | 149 | ||
149 | case ARGP_KEY_FINI: | 150 | case ARGP_KEY_FINI: |
... | @@ -304,7 +305,7 @@ main (int argc, char **argv) | ... | @@ -304,7 +305,7 @@ main (int argc, char **argv) |
304 | } | 305 | } |
305 | 306 | ||
306 | /* Exit immediately if --build is given */ | 307 | /* Exit immediately if --build is given */ |
307 | if (build_only) | 308 | if (build_only || nowhatnowproc) |
308 | return 0; | 309 | return 0; |
309 | 310 | ||
310 | return mh_whatnowproc (&wh_env, initial_edit, whatnowproc); | 311 | return mh_whatnowproc (&wh_env, initial_edit, whatnowproc); | ... | ... |
... | @@ -107,6 +107,7 @@ static const char *whatnowproc; | ... | @@ -107,6 +107,7 @@ static const char *whatnowproc; |
107 | static char *mhl_filter_file = NULL; /* --filter flag */ | 107 | static char *mhl_filter_file = NULL; /* --filter flag */ |
108 | 108 | ||
109 | static int build_only = 0; /* --build flag */ | 109 | static int build_only = 0; /* --build flag */ |
110 | static int nowhatnowproc = 0; /* --nowhatnowproc */ | ||
110 | static int annotate = 0; /* --annotate flag */ | 111 | static int annotate = 0; /* --annotate flag */ |
111 | static enum encap_type encap = encap_clear; /* controlled by --format, --form | 112 | static enum encap_type encap = encap_clear; /* controlled by --format, --form |
112 | and --mime flags */ | 113 | and --mime flags */ |
... | @@ -222,7 +223,7 @@ opt_handler (int key, char *arg, struct argp_state *state) | ... | @@ -222,7 +223,7 @@ opt_handler (int key, char *arg, struct argp_state *state) |
222 | break; | 223 | break; |
223 | 224 | ||
224 | case ARG_NOWHATNOWPROC: | 225 | case ARG_NOWHATNOWPROC: |
225 | whatnowproc = NULL; | 226 | nowhatnowproc = 1; |
226 | break; | 227 | break; |
227 | 228 | ||
228 | case ARGP_KEY_FINI: | 229 | case ARGP_KEY_FINI: |
... | @@ -530,7 +531,7 @@ main (int argc, char **argv) | ... | @@ -530,7 +531,7 @@ main (int argc, char **argv) |
530 | } | 531 | } |
531 | 532 | ||
532 | /* Exit immediately if --build is given */ | 533 | /* Exit immediately if --build is given */ |
533 | if (build_only) | 534 | if (build_only || nowhatnowproc) |
534 | { | 535 | { |
535 | if (strcmp (wh_env.file, wh_env.draftfile)) | 536 | if (strcmp (wh_env.file, wh_env.draftfile)) |
536 | rename (wh_env.file, wh_env.draftfile); | 537 | rename (wh_env.file, wh_env.draftfile); | ... | ... |
... | @@ -226,7 +226,7 @@ mh_global_save_state () | ... | @@ -226,7 +226,7 @@ mh_global_save_state () |
226 | rc = mu_property_save (mu_mh_context); | 226 | rc = mu_property_save (mu_mh_context); |
227 | if (rc) | 227 | if (rc) |
228 | { | 228 | { |
229 | mu_diag_funcall (MU_DIAG_ERROR, "mu_profile_save", "context", rc); | 229 | mu_diag_funcall (MU_DIAG_ERROR, "mu_property_save", "context", rc); |
230 | exit (1); | 230 | exit (1); |
231 | } | 231 | } |
232 | } | 232 | } | ... | ... |
... | @@ -115,6 +115,7 @@ static const char *whatnowproc; | ... | @@ -115,6 +115,7 @@ static const char *whatnowproc; |
115 | static mu_msgset_t msgset; | 115 | static mu_msgset_t msgset; |
116 | static mu_mailbox_t mbox; | 116 | static mu_mailbox_t mbox; |
117 | static int build_only = 0; /* --build flag */ | 117 | static int build_only = 0; /* --build flag */ |
118 | static int nowhatnowproc = 0; /* --nowhatnowproc */ | ||
118 | static int query_mode = 0; /* --query flag */ | 119 | static int query_mode = 0; /* --query flag */ |
119 | static int use_draft = 0; /* --use flag */ | 120 | static int use_draft = 0; /* --use flag */ |
120 | static char *mhl_filter = NULL; /* --filter flag */ | 121 | static char *mhl_filter = NULL; /* --filter flag */ |
... | @@ -261,7 +262,7 @@ opt_handler (int key, char *arg, struct argp_state *state) | ... | @@ -261,7 +262,7 @@ opt_handler (int key, char *arg, struct argp_state *state) |
261 | break; | 262 | break; |
262 | 263 | ||
263 | case ARG_NOWHATNOWPROC: | 264 | case ARG_NOWHATNOWPROC: |
264 | whatnowproc = NULL; | 265 | nowhatnowproc = 1; |
265 | break; | 266 | break; |
266 | 267 | ||
267 | case ARGP_KEY_FINI: | 268 | case ARGP_KEY_FINI: |
... | @@ -432,7 +433,7 @@ main (int argc, char **argv) | ... | @@ -432,7 +433,7 @@ main (int argc, char **argv) |
432 | make_draft (mbox, DISP_REPLACE, &wh_env); | 433 | make_draft (mbox, DISP_REPLACE, &wh_env); |
433 | 434 | ||
434 | /* Exit immediately if --build is given */ | 435 | /* Exit immediately if --build is given */ |
435 | if (build_only) | 436 | if (build_only || nowhatnowproc) |
436 | return 0; | 437 | return 0; |
437 | 438 | ||
438 | rc = mh_whatnowproc (&wh_env, initial_edit, whatnowproc); | 439 | rc = mh_whatnowproc (&wh_env, initial_edit, whatnowproc); | ... | ... |
-
Please register or sign in to post a comment