diff options
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 28 |
1 files changed, 24 insertions, 4 deletions
@@ -550,6 +550,7 @@ parse_opt(int key, char *arg, struct argp_state *state) | |||
550 | case 'v': | 550 | case 'v': |
551 | { | 551 | { |
552 | char *p; | 552 | char *p; |
553 | struct locus locus = { "<command line>", 1, 0 }; | ||
553 | 554 | ||
554 | p = strchr(arg, '='); | 555 | p = strchr(arg, '='); |
555 | if (!p) | 556 | if (!p) |
@@ -557,7 +558,7 @@ parse_opt(int key, char *arg, struct argp_state *state) | |||
557 | _("expected assignment, but found `%s'"), | 558 | _("expected assignment, but found `%s'"), |
558 | arg); | 559 | arg); |
559 | *p++ = 0; | 560 | *p++ = 0; |
560 | defer_initialize_variable(arg, p); | 561 | defer_initialize_variable(arg, p, &locus); |
561 | break; | 562 | break; |
562 | } | 563 | } |
563 | 564 | ||
@@ -716,7 +717,9 @@ cb_set_variable(void *data, mu_config_value_t *arg) | |||
716 | { | 717 | { |
717 | const char *value; | 718 | const char *value; |
718 | char *alloc_str = NULL; | 719 | char *alloc_str = NULL; |
719 | 720 | struct mu_locus mloc; | |
721 | struct locus locus; | ||
722 | |||
720 | if (mu_cfg_assert_value_type(arg, MU_CFG_ARRAY)) | 723 | if (mu_cfg_assert_value_type(arg, MU_CFG_ARRAY)) |
721 | return 1; | 724 | return 1; |
722 | if (arg->v.arg.c < 2) { | 725 | if (arg->v.arg.c < 2) { |
@@ -749,8 +752,25 @@ cb_set_variable(void *data, mu_config_value_t *arg) | |||
749 | __FILE__, __LINE__); | 752 | __FILE__, __LINE__); |
750 | abort(); | 753 | abort(); |
751 | } | 754 | } |
752 | 755 | ||
753 | defer_initialize_variable(arg->v.arg.v[0].v.string, value); | 756 | locus.leng = 0; |
757 | if (mu_stream_ioctl (mu_strerr, MU_IOCTL_LOGSTREAM, | ||
758 | MU_IOCTL_LOGSTREAM_GET_LOCUS, &mloc)) { | ||
759 | locus.file = "<unknown>"; | ||
760 | locus.line = 0; | ||
761 | locus.point = 0; | ||
762 | } else { | ||
763 | if (mloc.mu_file) { | ||
764 | struct literal *lit = string_alloc(mloc.mu_file, | ||
765 | strlen(mloc.mu_file)); | ||
766 | free(mloc.mu_file); | ||
767 | locus.file = lit->text; | ||
768 | } else | ||
769 | locus.file = "<unknown>"; | ||
770 | locus.line = mloc.mu_line; | ||
771 | locus.point = mloc.mu_col; | ||
772 | } | ||
773 | defer_initialize_variable(arg->v.arg.v[0].v.string, value, &locus); | ||
754 | free(alloc_str); | 774 | free(alloc_str); |
755 | return 0; | 775 | return 0; |
756 | } | 776 | } |