diff options
-rw-r--r-- | NEWS | 9 | ||||
-rw-r--r-- | mh/comp.c | 13 | ||||
-rw-r--r-- | mh/forw.c | 14 | ||||
-rw-r--r-- | mh/mh.h | 6 | ||||
-rw-r--r-- | mh/mh_alias_gram.y | 3 | ||||
-rw-r--r-- | mh/mh_getopt.c | 44 | ||||
-rw-r--r-- | mh/mh_getopt.h | 13 | ||||
-rw-r--r-- | mh/mh_whatnow.c | 7 | ||||
-rw-r--r-- | mh/mh_whom.c | 86 | ||||
-rw-r--r-- | mh/repl.c | 16 | ||||
-rw-r--r-- | mh/tests/comp.at | 43 | ||||
-rw-r--r-- | mh/tests/forw.at | 123 | ||||
-rw-r--r-- | mh/tests/repl.at | 64 | ||||
-rw-r--r-- | mh/whom.c | 63 |
14 files changed, 431 insertions, 73 deletions
@@ -1,4 +1,4 @@ | |||
1 | GNU mailutils NEWS -- history of user-visible changes. 2017-06-01 | 1 | GNU mailutils NEWS -- history of user-visible changes. 2017-06-16 |
2 | Copyright (C) 2002-2017 Free Software Foundation, Inc. | 2 | Copyright (C) 2002-2017 Free Software Foundation, Inc. |
3 | See the end of file for copying conditions. | 3 | See the end of file for copying conditions. |
4 | 4 | ||
@@ -75,6 +75,13 @@ value is anything but "no", the settings from the global "tls" section | |||
75 | will be used. In this case, it is an error if the global "tls" | 75 | will be used. In this case, it is an error if the global "tls" |
76 | section is not defined. | 76 | section is not defined. |
77 | 77 | ||
78 | * Source location API | ||
79 | |||
80 | Libmailutils provides functions for keeping track of locations in | ||
81 | source files for diagnostic purposes. | ||
82 | |||
83 | * Improve error reporting | ||
84 | |||
78 | * AM_GNU_MAILUTILS autoconf macro | 85 | * AM_GNU_MAILUTILS autoconf macro |
79 | 86 | ||
80 | Required version must be literal string. | 87 | Required version must be literal string. |
@@ -127,15 +127,16 @@ copy_message (mu_mailbox_t mbox, size_t n, const char *file) | |||
127 | return rc; | 127 | return rc; |
128 | } | 128 | } |
129 | 129 | ||
130 | static struct mh_optinit optinit[] = { | ||
131 | { "draftfolder", "Draft-Folder" }, | ||
132 | { "whatnowproc", "whatnowproc" }, | ||
133 | { NULL } | ||
134 | }; | ||
135 | |||
130 | int | 136 | int |
131 | main (int argc, char **argv) | 137 | main (int argc, char **argv) |
132 | { | 138 | { |
133 | mh_getopt (&argc, &argv, options, 0, args_doc, prog_doc, NULL); | 139 | mh_getopt_ext (&argc, &argv, options, 0, optinit, args_doc, prog_doc, NULL); |
134 | |||
135 | if (!draftfolder) | ||
136 | draftfolder = mh_global_profile_get ("Draft-Folder", NULL); | ||
137 | if (!whatnowproc) | ||
138 | whatnowproc = mh_global_profile_get ("whatnowproc", NULL); | ||
139 | 140 | ||
140 | if (use_draft) | 141 | if (use_draft) |
141 | draftmessage = "cur"; | 142 | draftmessage = "cur"; |
@@ -377,17 +377,19 @@ finish_draft () | |||
377 | mu_stream_destroy (&stream); | 377 | mu_stream_destroy (&stream); |
378 | } | 378 | } |
379 | 379 | ||
380 | static struct mh_optinit optinit[] = { | ||
381 | { "draftfolder", "Draft-Folder" }, | ||
382 | { "whatnowproc", "whatnowproc" }, | ||
383 | { NULL } | ||
384 | }; | ||
385 | |||
380 | int | 386 | int |
381 | main (int argc, char **argv) | 387 | main (int argc, char **argv) |
382 | { | 388 | { |
383 | int rc; | 389 | int rc; |
384 | 390 | ||
385 | mh_getopt (&argc, &argv, options, MH_GETOPT_DEFAULT_FOLDER, | 391 | mh_getopt_ext (&argc, &argv, options, MH_GETOPT_DEFAULT_FOLDER, optinit, |
386 | args_doc, prog_doc, NULL); | 392 | args_doc, prog_doc, NULL); |
387 | if (!draftfolder) | ||
388 | draftfolder = mh_global_profile_get ("Draft-Folder", NULL); | ||
389 | if (!whatnowproc) | ||
390 | whatnowproc = mh_global_profile_get ("whatnowproc", NULL); | ||
391 | if (!formfile) | 393 | if (!formfile) |
392 | mh_find_file ("forwcomps", &formfile); | 394 | mh_find_file ("forwcomps", &formfile); |
393 | 395 | ||
@@ -342,7 +342,11 @@ int mh_usedraft (const char *filename); | |||
342 | int mh_file_copy (const char *from, const char *to); | 342 | int mh_file_copy (const char *from, const char *to); |
343 | char *mh_draft_name (void); | 343 | char *mh_draft_name (void); |
344 | char *mh_create_message_id (int); | 344 | char *mh_create_message_id (int); |
345 | int mh_whom (const char *filename, int check); | 345 | |
346 | int mh_whom_header (mu_header_t hdr); | ||
347 | int mh_whom_file (const char *filename, int check); | ||
348 | int mh_whom_message (mu_message_t msg, int check); | ||
349 | |||
346 | void mh_set_reply_regex (const char *str); | 350 | void mh_set_reply_regex (const char *str); |
347 | int mh_decode_2047 (char *text, char **decoded_text); | 351 | int mh_decode_2047 (char *text, char **decoded_text); |
348 | const char *mh_charset (const char *); | 352 | const char *mh_charset (const char *); |
diff --git a/mh/mh_alias_gram.y b/mh/mh_alias_gram.y index d7229983a..26b13ec83 100644 --- a/mh/mh_alias_gram.y +++ b/mh/mh_alias_gram.y | |||
@@ -502,6 +502,9 @@ int | |||
502 | mh_read_aliases (void) | 502 | mh_read_aliases (void) |
503 | { | 503 | { |
504 | const char *p; | 504 | const char *p; |
505 | |||
506 | if (alias_list) | ||
507 | return 0; | ||
505 | 508 | ||
506 | p = mh_global_profile_get ("Aliasfile", NULL); | 509 | p = mh_global_profile_get ("Aliasfile", NULL); |
507 | if (p) | 510 | if (p) |
diff --git a/mh/mh_getopt.c b/mh/mh_getopt.c index 65fe3e8c7..16a6e5c55 100644 --- a/mh/mh_getopt.c +++ b/mh/mh_getopt.c | |||
@@ -179,10 +179,39 @@ has_folder_option (struct mu_option *opt) | |||
179 | return 0; | 179 | return 0; |
180 | } | 180 | } |
181 | 181 | ||
182 | static void | ||
183 | opt_init (struct mu_parseopt *po, | ||
184 | struct mu_option **optv, struct mh_optinit *optinit) | ||
185 | { | ||
186 | if (!optinit) | ||
187 | return; | ||
188 | for (; optinit->opt; optinit++) | ||
189 | { | ||
190 | size_t i; | ||
191 | for (i = 0; optv[i]; i++) | ||
192 | { | ||
193 | struct mu_option *opt; | ||
194 | for (opt = optv[i]; !MU_OPTION_IS_END (opt); opt++) | ||
195 | { | ||
196 | if (strcmp (opt->opt_long, optinit->opt) == 0) | ||
197 | { | ||
198 | char const *val = mh_global_profile_get (optinit->var, NULL); | ||
199 | if (val) | ||
200 | { | ||
201 | (opt->opt_set ? | ||
202 | opt->opt_set : mu_option_set_value) (po, opt, val); | ||
203 | } | ||
204 | break; | ||
205 | } | ||
206 | } | ||
207 | } | ||
208 | } | ||
209 | } | ||
210 | |||
182 | void | 211 | void |
183 | mh_getopt (int *pargc, char ***pargv, struct mu_option *options, | 212 | mh_getopt_ext (int *pargc, char ***pargv, struct mu_option *options, |
184 | int mhflags, | 213 | int mhflags, struct mh_optinit *optinit, |
185 | char *argdoc, char *progdoc, char *extradoc) | 214 | char *argdoc, char *progdoc, char *extradoc) |
186 | { | 215 | { |
187 | int argc = *pargc; | 216 | int argc = *pargc; |
188 | char **argv = *pargv; | 217 | char **argv = *pargv; |
@@ -256,6 +285,7 @@ mh_getopt (int *pargc, char ***pargv, struct mu_option *options, | |||
256 | if (options) | 285 | if (options) |
257 | optv[i++] = options; | 286 | optv[i++] = options; |
258 | optv[i] = NULL; | 287 | optv[i] = NULL; |
288 | opt_init (&po, optv, optinit); | ||
259 | 289 | ||
260 | if (mu_parseopt (&po, argc, argv, optv, flags)) | 290 | if (mu_parseopt (&po, argc, argv, optv, flags)) |
261 | exit (po.po_exit_error); | 291 | exit (po.po_exit_error); |
@@ -285,6 +315,14 @@ mh_getopt (int *pargc, char ***pargv, struct mu_option *options, | |||
285 | } | 315 | } |
286 | 316 | ||
287 | void | 317 | void |
318 | mh_getopt (int *pargc, char ***pargv, struct mu_option *options, | ||
319 | int mhflags, char *argdoc, char *progdoc, char *extradoc) | ||
320 | { | ||
321 | mh_getopt_ext (pargc, pargv, options, mhflags, NULL, argdoc, progdoc, | ||
322 | extradoc); | ||
323 | } | ||
324 | |||
325 | void | ||
288 | mh_opt_notimpl (struct mu_parseopt *po, struct mu_option *opt, char const *arg) | 326 | mh_opt_notimpl (struct mu_parseopt *po, struct mu_option *opt, char const *arg) |
289 | { | 327 | { |
290 | mu_error (_("option is not yet implemented: %s"), opt->opt_long); | 328 | mu_error (_("option is not yet implemented: %s"), opt->opt_long); |
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 @@ | |||
20 | 20 | ||
21 | #define MH_GETOPT_DEFAULT_FOLDER 0x1 | 21 | #define MH_GETOPT_DEFAULT_FOLDER 0x1 |
22 | 22 | ||
23 | struct mh_optinit | ||
24 | { | ||
25 | char const *opt; /* Option name */ | ||
26 | char const *var; /* mh_property name */ | ||
27 | }; | ||
28 | |||
29 | void mh_getopt_ext (int *pargc, char ***pargv, struct mu_option *options, | ||
30 | int mhflags, struct mh_optinit *optinit, | ||
31 | char *argdoc, char *progdoc, char *extradoc); | ||
32 | |||
23 | void mh_getopt (int *pargc, char ***pargv, struct mu_option *options, | 33 | void mh_getopt (int *pargc, char ***pargv, struct mu_option *options, |
24 | int flags, | 34 | int flags, char *argdoc, char *progdoc, char *extradoc); |
25 | char *argdoc, char *progdoc, char *extradoc); | ||
26 | 35 | ||
27 | void mh_opt_notimpl (struct mu_parseopt *po, struct mu_option *opt, | 36 | void mh_opt_notimpl (struct mu_parseopt *po, struct mu_option *opt, |
28 | char const *arg); | 37 | char const *arg); |
diff --git a/mh/mh_whatnow.c b/mh/mh_whatnow.c index 5dc15b553..0bd2acabe 100644 --- a/mh/mh_whatnow.c +++ b/mh/mh_whatnow.c | |||
@@ -544,9 +544,10 @@ whom (struct mh_whatnow_env *wh, int argc, char **argv, int *status) | |||
544 | if (!wh->file) | 544 | if (!wh->file) |
545 | mu_error (_("no draft file to display")); | 545 | mu_error (_("no draft file to display")); |
546 | else | 546 | else |
547 | mh_whom (wh->file, (argc == 2 | 547 | mh_whom_file (wh->file, |