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, static void opt_variable(struct mu_parseopt *po, struct mu_option *op, char const *arg) { char *p; - struct locus locus = { "<command line>", 1, 0 }; + struct mu_locus_range locus = {{ "<command line>", 1, 0 }}; p = strchr(arg, '='); if (!p) { mu_parseopt_error(po, _("expected assignment, but found `%s'"), arg); @@ -418,13 +418,12 @@ opt_undefine(struct mu_parseopt *po, struct mu_option *op, char const *arg) } static void opt_set_milter_timeout(struct mu_parseopt *po, struct mu_option *op, char const *arg) { - int rc; time_t v; if (mu_str_to_c(arg, mu_c_time, &v, NULL)) { mu_parseopt_error(po, _("%s: not a valid interval"), arg); exit(po->po_exit_error); } @@ -673,14 +672,13 @@ cb_milter_timeout(void *data, mu_config_value_t *arg) static int cb_set_variable(void *data, mu_config_value_t *arg) { const char *value; char *alloc_str = NULL; - struct mu_locus mloc; - struct locus locus; + struct mu_locus_range locus = MU_LOCUS_RANGE_INITIALIZER; if (mu_cfg_assert_value_type(arg, MU_CFG_ARRAY)) return 1; if (arg->v.arg.c < 2) { mu_error(_("not enough arguments")); return 1; @@ -709,30 +707,16 @@ cb_set_variable(void *data, mu_config_value_t *arg) default: mu_error (_("INTERNAL ERROR at %s:%d: please report"), __FILE__, __LINE__); abort(); } - locus.leng = 0; - if (mu_stream_ioctl (mu_strerr, MU_IOCTL_LOGSTREAM, - MU_IOCTL_LOGSTREAM_GET_LOCUS, &mloc)) { - locus.file = "<unknown>"; - locus.line = 0; - locus.point = 0; - } else { - if (mloc.mu_file) { - struct literal *lit = string_alloc(mloc.mu_file, - strlen(mloc.mu_file)); - free(mloc.mu_file); - locus.file = lit->text; - } else - locus.file = "<unknown>"; - locus.line = mloc.mu_line; - locus.point = mloc.mu_col; - } + mu_stream_ioctl (mu_strerr, MU_IOCTL_LOGSTREAM, + MU_IOCTL_LOGSTREAM_GET_LOCUS_RANGE, &locus); defer_initialize_variable(arg->v.arg.v[0].v.string, value, &locus); + mu_locus_range_deinit(&locus); free(alloc_str); return 0; } static int cb_include_path(void *data, mu_config_value_t *val) @@ -1116,13 +1100,12 @@ mailfromd_show_defaults(void) } static int args_in_order(int argc, char **argv) { int i; - int flag = 0; for (i = 0; i < argc; i++) { size_t len = strcspn(argv[i], "="); if (len > 3 && (memcmp(argv[i], "--ru", 4) == 0 || memcmp(argv[i], "--run", 5) == 0)) { return MF_GETOPT_IN_ORDER; @@ -1241,13 +1224,12 @@ struct mu_cli_setup cli = { .prog_args = args_doc }; int main(int argc, char **argv) { - int rc; prog_counter_t entry_point; int stderr_is_closed = stderr_closed_p(); mf_init_nls(); mf_proctitle_init(argc, argv, environ); mu_alloc_die_hook = mailfromd_alloc_die; |