From fe90e86dac8c9c91a35347ee5bb4513195263ee2 Mon Sep 17 00:00:00 2001 From: Sergey Poznyakoff Date: Sun, 11 Jun 2017 00:29:06 +0300 Subject: 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. --- mh/mh_getopt.h | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'mh/mh_getopt.h') diff --git a/mh/mh_getopt.h b/mh/mh_getopt.h index 2aa90b669..684ace678 100644 --- a/mh/mh_getopt.h +++ b/mh/mh_getopt.h @@ -20,9 +20,18 @@ #define MH_GETOPT_DEFAULT_FOLDER 0x1 +struct mh_optinit +{ + char const *opt; /* Option name */ + char const *var; /* mh_property name */ +}; + +void mh_getopt_ext (int *pargc, char ***pargv, struct mu_option *options, + int mhflags, struct mh_optinit *optinit, + char *argdoc, char *progdoc, char *extradoc); + void mh_getopt (int *pargc, char ***pargv, struct mu_option *options, - int flags, - char *argdoc, char *progdoc, char *extradoc); + int flags, char *argdoc, char *progdoc, char *extradoc); void mh_opt_notimpl (struct mu_parseopt *po, struct mu_option *opt, char const *arg); -- cgit v1.2.1