diff options
author | Sergey Poznyakoff <gray@gnu.org> | 2019-10-16 19:52:23 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org> | 2019-10-16 19:52:23 +0300 |
commit | 6e35ba4275cd113dbbb8242e672bafb9dea02091 (patch) | |
tree | 8a4719b4878199838c1da63b58b9fc31041faa7f | |
parent | dcf58c57acf3f817d9a0d17fae5052f39390fb90 (diff) | |
download | mailutils-6e35ba4275cd113dbbb8242e672bafb9dea02091.tar.gz mailutils-6e35ba4275cd113dbbb8242e672bafb9dea02091.tar.bz2 |
Restore MDA debug flags.
-rw-r--r-- | mda/lib/script.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/mda/lib/script.c b/mda/lib/script.c index ec36cba9b..ef1d992b6 100644 --- a/mda/lib/script.c +++ b/mda/lib/script.c | |||
@@ -92,6 +92,16 @@ set_script_pattern (struct mu_parseopt *po, struct mu_option *opt, | |||
92 | exit (po->po_exit_error); | 92 | exit (po->po_exit_error); |
93 | } | 93 | } |
94 | 94 | ||
95 | static void | ||
96 | set_debug (struct mu_parseopt *po, struct mu_option *opt, char const *arg) | ||
97 | { | ||
98 | if (mu_script_debug_flags (arg, (char**)&arg)) | ||
99 | { | ||
100 | mu_parseopt_error (po, _("%c is not a valid debug flag"), *arg); | ||
101 | exit (po->po_exit_error); | ||
102 | } | ||
103 | } | ||
104 | |||
95 | struct mu_option mda_script_options[] = { | 105 | struct mu_option mda_script_options[] = { |
96 | MU_OPTION_GROUP (N_("Scripting options")), | 106 | MU_OPTION_GROUP (N_("Scripting options")), |
97 | { "language", 'l', N_("STRING"), MU_OPTION_DEFAULT, | 107 | { "language", 'l', N_("STRING"), MU_OPTION_DEFAULT, |
@@ -103,6 +113,13 @@ struct mu_option mda_script_options[] = { | |||
103 | { "message-id-header", 0, N_("STRING"), MU_OPTION_DEFAULT, | 113 | { "message-id-header", 0, N_("STRING"), MU_OPTION_DEFAULT, |
104 | N_("use this header to identify messages when logging Sieve actions"), | 114 | N_("use this header to identify messages when logging Sieve actions"), |
105 | mu_c_string, &message_id_header }, | 115 | mu_c_string, &message_id_header }, |
116 | { "script-debug", 'x', N_("FLAGS"), MU_OPTION_DEFAULT, | ||
117 | N_("enable script debugging; FLAGS are:\n\ | ||
118 | g - guile stack traces\n\ | ||
119 | t - sieve trace (MU_SIEVE_DEBUG_TRACE)\n\ | ||
120 | i - sieve instructions trace (MU_SIEVE_DEBUG_INSTR)\n\ | ||
121 | l - sieve action logs"), | ||
122 | mu_c_string, NULL, set_debug }, | ||
106 | MU_OPTION_END | 123 | MU_OPTION_END |
107 | }; | 124 | }; |
108 | 125 | ||
@@ -141,6 +158,21 @@ cb_script_pattern (void *data, mu_config_value_t *val) | |||
141 | return 0; | 158 | return 0; |
142 | } | 159 | } |
143 | 160 | ||
161 | static int | ||
162 | cb_debug (void *data, mu_config_value_t *val) | ||
163 | { | ||
164 | char *p; | ||
165 | |||
166 | if (mu_cfg_assert_value_type (val, MU_CFG_STRING)) | ||
167 | return 1; | ||
168 | if (mu_script_debug_flags (val->v.string, &p)) | ||
169 | { | ||
170 | mu_error (_("%c is not a valid debug flag"), *p); | ||
171 | return 1; | ||
172 | } | ||
173 | return 0; | ||
174 | } | ||
175 | |||
144 | struct mu_cfg_param mda_script_cfg[] = { | 176 | struct mu_cfg_param mda_script_cfg[] = { |
145 | { "language", mu_cfg_callback, NULL, 0, cb_script_language, | 177 | { "language", mu_cfg_callback, NULL, 0, cb_script_language, |
146 | N_("Set script language."), | 178 | N_("Set script language."), |
@@ -149,6 +181,14 @@ struct mu_cfg_param mda_script_cfg[] = { | |||
149 | { "pattern", mu_cfg_callback, NULL, 0, cb_script_pattern, | 181 | { "pattern", mu_cfg_callback, NULL, 0, cb_script_pattern, |
150 | N_("Set script pattern."), | 182 | N_("Set script pattern."), |
151 | N_("arg: glob") }, | 183 | N_("arg: glob") }, |
184 | { "debug", mu_cfg_callback, NULL, 0, cb_debug, | ||
185 | N_("Set scripting debug level. Argument is one or more " | ||
186 | "of the following letters:\n" | ||
187 | " g - guile stack traces\n" | ||
188 | " t - sieve trace (MU_SIEVE_DEBUG_TRACE)\n" | ||
189 | " i - sieve instructions trace (MU_SIEVE_DEBUG_INSTR)\n" | ||
190 | " l - sieve action logs\n"), | ||
191 | N_("arg: string") }, | ||
152 | { NULL } | 192 | { NULL } |
153 | }; | 193 | }; |
154 | 194 | ||