diff options
author | Sergey Poznyakoff <gray@gnu.org> | 2017-06-18 14:00:02 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org> | 2017-06-18 14:17:41 +0300 |
commit | ffb02f79f0381f296e73add258f87ecb2456fba3 (patch) | |
tree | 5d074c615fb42e58ae03145c4ad4a35da63dd9db /src/main.c | |
parent | 565ff017ae9e52bbe41ccfb90668a642a2704afe (diff) | |
download | mailfromd-ffb02f79f0381f296e73add258f87ecb2456fba3.tar.gz mailfromd-ffb02f79f0381f296e73add258f87ecb2456fba3.tar.bz2 |
Switch to detailed source locations from Mailutils 3.2.92
* configure.ac: Version 8.1.92
* NEWS: Update.
* src/builtin/debug.bi (debug): Use mu_locus_range
* src/builtin/from.bi: Likewise.
* src/builtin/header.bi: Likewise.
* src/builtin/progress.bi: Likewise.
* src/builtin/qrnt.bi: Likewise.
* src/builtin/rcpt.bi: Likewise.
* src/exclist.c: Likewise.
* src/builtin/sieve.bi: Use mu_locus_range
(sieve): Accept new optional argument "col".
* src/drivers.c: Use mu_locus_range
(MARK_LOCUS): Rewrite as inline function.
* src/gram.y: Use mu_locus_range and location macros from mailutils/yyloc.h
Improve error diagnostics
(parse_program): Prepare mu_strerr for locus-aware diagnostics.
* src/lex.l: Use mu_linetrack_t to track locations.
* src/mailfromd.h: Use mu_locus_range
* src/main.c: Likewise.
* src/pp.c: Likewise.
* src/prog.c: Likewise.
* src/prog.h: Likewise.
* src/symbols.c: Likewise.
* tests/ashadow.at: Expect detailed error locations.
* tests/bctx00.at: Likewise.
* tests/fctx00.at: Likewise.
* tests/invcidr.at: Likewise.
* tests/invcidr2.at: Likewise.
* tests/module04.at: Likewise.
* tests/module06.at: Likewise.
* tests/poll04.at: Likewise.
* tests/setvar.at: Likewise.
* tests/shadow.at: Likewise.
* tests/static02.at: Likewise.
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 28 |
1 files changed, 5 insertions, 23 deletions
@@ -372,13 +372,13 @@ opt_optimize(struct mu_parseopt *po, struct mu_option *op, | |||
372 | 372 | ||
373 | static void | 373 | static void |
374 | opt_variable(struct mu_parseopt *po, struct mu_option *op, | 374 | opt_variable(struct mu_parseopt *po, struct mu_option *op, |
375 | char const *arg) | 375 | char const *arg) |
376 | { | 376 | { |
377 | char *p; | 377 | char *p; |
378 | struct locus locus = { "<command line>", 1, 0 }; | 378 | struct mu_locus_range locus = {{ "<command line>", 1, 0 }}; |
379 | 379 | ||
380 | p = strchr(arg, '='); | 380 | p = strchr(arg, '='); |
381 | if (!p) { | 381 | if (!p) { |
382 | mu_parseopt_error(po, | 382 | mu_parseopt_error(po, |
383 | _("expected assignment, but found `%s'"), | 383 | _("expected assignment, but found `%s'"), |
384 | arg); | 384 | arg); |
@@ -418,13 +418,12 @@ opt_undefine(struct mu_parseopt *po, struct mu_option *op, char const *arg) | |||
418 | } | 418 | } |
419 | 419 | ||
420 | static void | 420 | static void |
421 | opt_set_milter_timeout(struct mu_parseopt *po, struct mu_option *op, | 421 | opt_set_milter_timeout(struct mu_parseopt *po, struct mu_option *op, |
422 | char const *arg) | 422 | char const *arg) |
423 | { | 423 | { |
424 | int rc; | ||
425 | time_t v; | 424 | time_t v; |
426 | 425 | ||
427 | if (mu_str_to_c(arg, mu_c_time, &v, NULL)) { | 426 | if (mu_str_to_c(arg, mu_c_time, &v, NULL)) { |
428 | mu_parseopt_error(po, _("%s: not a valid interval"), arg); | 427 | mu_parseopt_error(po, _("%s: not a valid interval"), arg); |
429 | exit(po->po_exit_error); | 428 | exit(po->po_exit_error); |
430 | } | 429 | } |
@@ -673,14 +672,13 @@ cb_milter_timeout(void *data, mu_config_value_t *arg) | |||
673 | 672 | ||
674 | static int | 673 | static int |
675 | cb_set_variable(void *data, mu_config_value_t *arg) | 674 | cb_set_variable(void *data, mu_config_value_t *arg) |
676 | { | 675 | { |
677 | const char *value; | 676 | const char *value; |
678 | char *alloc_str = NULL; | 677 | char *alloc_str = NULL; |
679 | struct mu_locus mloc; | 678 | struct mu_locus_range locus = MU_LOCUS_RANGE_INITIALIZER; |
680 | struct locus locus; | ||
681 | 679 | ||
682 | if (mu_cfg_assert_value_type(arg, MU_CFG_ARRAY)) | 680 | if (mu_cfg_assert_value_type(arg, MU_CFG_ARRAY)) |
683 | return 1; | 681 | return 1; |
684 | if (arg->v.arg.c < 2) { | 682 | if (arg->v.arg.c < 2) { |
685 | mu_error(_("not enough arguments")); | 683 | mu_error(_("not enough arguments")); |
686 | return 1; | 684 | return 1; |
@@ -709,30 +707,16 @@ cb_set_variable(void *data, mu_config_value_t *arg) | |||
709 | default: | 707 | default: |
710 | mu_error (_("INTERNAL ERROR at %s:%d: please report"), | 708 | mu_error (_("INTERNAL ERROR at %s:%d: please report"), |
711 | __FILE__, __LINE__); | 709 | __FILE__, __LINE__); |
712 | abort(); | 710 | abort(); |
713 | } | 711 | } |
714 | 712 | ||
715 | locus.leng = 0; | 713 | mu_stream_ioctl (mu_strerr, MU_IOCTL_LOGSTREAM, |
716 | if (mu_stream_ioctl (mu_strerr, MU_IOCTL_LOGSTREAM, | 714 | MU_IOCTL_LOGSTREAM_GET_LOCUS_RANGE, &locus); |
717 | MU_IOCTL_LOGSTREAM_GET_LOCUS, &mloc)) { | ||
718 | locus.file = "<unknown>"; | ||
719 | locus.line = 0; | ||
720 | locus.point = 0; | ||
721 | } else { | ||
722 | if (mloc.mu_file) { | ||
723 | struct literal *lit = string_alloc(mloc.mu_file, | ||
724 | strlen(mloc.mu_file)); | ||
725 | free(mloc.mu_file); | ||
726 | locus.file = lit->text; | ||
727 | } else | ||
728 | locus.file = "<unknown>"; | ||
729 | locus.line = mloc.mu_line; | ||
730 | locus.point = mloc.mu_col; | ||
731 | } | ||
732 | defer_initialize_variable(arg->v.arg.v[0].v.string, value, &locus); | 715 | defer_initialize_variable(arg->v.arg.v[0].v.string, value, &locus); |
716 | mu_locus_range_deinit(&locus); | ||
733 | free(alloc_str); | 717 | free(alloc_str); |
734 | return 0; | 718 | return 0; |
735 | } | 719 | } |
736 | 720 | ||
737 | static int | 721 | static int |
738 | cb_include_path(void *data, mu_config_value_t *val) | 722 | cb_include_path(void *data, mu_config_value_t *val) |
@@ -1116,13 +1100,12 @@ mailfromd_show_defaults(void) | |||
1116 | } | 1100 | } |
1117 | 1101 | ||
1118 | static int | 1102 | static int |
1119 | args_in_order(int argc, char **argv) | 1103 | args_in_order(int argc, char **argv) |
1120 | { | 1104 | { |
1121 | int i; | 1105 | int i; |
1122 | int flag = 0; | ||
1123 | for (i = 0; i < argc; i++) { | 1106 | for (i = 0; i < argc; i++) { |
1124 | size_t len = strcspn(argv[i], "="); | 1107 | size_t len = strcspn(argv[i], "="); |
1125 | if (len > 3 | 1108 | if (len > 3 |
1126 | && (memcmp(argv[i], "--ru", 4) == 0 | 1109 | && (memcmp(argv[i], "--ru", 4) == 0 |
1127 | || memcmp(argv[i], "--run", 5) == 0)) { | 1110 | || memcmp(argv[i], "--run", 5) == 0)) { |
1128 | return MF_GETOPT_IN_ORDER; | 1111 | return MF_GETOPT_IN_ORDER; |
@@ -1241,13 +1224,12 @@ struct mu_cli_setup cli = { | |||
1241 | .prog_args = args_doc | 1224 | .prog_args = args_doc |
1242 | }; | 1225 | }; |
1243 | 1226 | ||
1244 | int | 1227 | int |
1245 | main(int argc, char **argv) | 1228 | main(int argc, char **argv) |
1246 | { | 1229 | { |
1247 | int rc; | ||
1248 | prog_counter_t entry_point; | 1230 | prog_counter_t entry_point; |
1249 | int stderr_is_closed = stderr_closed_p(); | 1231 | int stderr_is_closed = stderr_closed_p(); |
1250 | 1232 | ||
1251 | mf_init_nls(); | 1233 | mf_init_nls(); |
1252 | mf_proctitle_init(argc, argv, environ); | 1234 | mf_proctitle_init(argc, argv, environ); |
1253 | mu_alloc_die_hook = mailfromd_alloc_die; | 1235 | mu_alloc_die_hook = mailfromd_alloc_die; |