diff options
author | Sergey Poznyakoff <gray@gnu.org> | 2017-06-11 00:29:06 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org> | 2017-06-11 00:29:06 +0300 |
commit | fe90e86dac8c9c91a35347ee5bb4513195263ee2 (patch) | |
tree | 2fdb185baa9e0807641147881adf302e5aa39ea6 /mh/comp.c | |
parent | 263e2e9f9fcf721c11a61a16dca4cb38d6385fe9 (diff) | |
download | mailutils-fe90e86dac8c9c91a35347ee5bb4513195263ee2.tar.gz mailutils-fe90e86dac8c9c91a35347ee5bb4513195263ee2.tar.bz2 |
Fix the -nodraftfolder and -nowhatnowproc options.
The commit 744c4a9c didn't take into account the -nodraftfolder
and -nowhatnowproc options, which can be used to cancel the
effect of the corresponding facilities. This commit fixes it.
* mh/mh_getopt.c (mh_getopt_ext): New function.
* mh/mh_getopt.h (mh_getopt_ext): New prototype.
(mh_optinit): New struct.
* mh/tests/comp.at: Test the use of Draft-Folder
* mh/tests/forw.at: Likewise.
* mh/tests/repl.at: Likewise.
* mh/comp.c (main): use mh_getopt_ext to properly process draftfolder
and whatnowproc.
* mh/forw.c: Likewise.
* mh/repl.c: Likewise.
* mh/mh.h (mh_whom): Remove.
(mh_whom_header, mh_whom_file, mh_whom_message): New protos.
* mh/mh_alias.y (mh_read_aliases): Don't read aliases twice.
* mh/mh_whatnow.c (whom): Use mh_whom_file.
* mh/mh_whom.c (mh_whom): Rewrite and rename to mh_whom_file.
(mh_whom_header, mh_whom_message): New functions.
* mh/whom.c: Use mh_getopt_ext. Interpret command line
arguments, depending on whether the draftfile facility is in use.
Diffstat (limited to 'mh/comp.c')
-rw-r--r-- | mh/comp.c | 13 |
1 files changed, 7 insertions, 6 deletions
@@ -127,15 +127,16 @@ copy_message (mu_mailbox_t mbox, size_t n, const char *file) return rc; } +static struct mh_optinit optinit[] = { + { "draftfolder", "Draft-Folder" }, + { "whatnowproc", "whatnowproc" }, + { NULL } +}; + int main (int argc, char **argv) { - mh_getopt (&argc, &argv, options, 0, args_doc, prog_doc, NULL); - - if (!draftfolder) - draftfolder = mh_global_profile_get ("Draft-Folder", NULL); - if (!whatnowproc) - whatnowproc = mh_global_profile_get ("whatnowproc", NULL); + mh_getopt_ext (&argc, &argv, options, 0, optinit, args_doc, prog_doc, NULL); if (use_draft) draftmessage = "cur"; |