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 @@ -94,2 +94,12 @@ set_script_pattern (struct mu_parseopt *po, struct mu_option *opt, +static void +set_debug (struct mu_parseopt *po, struct mu_option *opt, char const *arg) +{ + if (mu_script_debug_flags (arg, (char**)&arg)) + { + mu_parseopt_error (po, _("%c is not a valid debug flag"), *arg); + exit (po->po_exit_error); + } +} + struct mu_option mda_script_options[] = { @@ -105,2 +115,9 @@ struct mu_option mda_script_options[] = { mu_c_string, &message_id_header }, + { "script-debug", 'x', N_("FLAGS"), MU_OPTION_DEFAULT, + N_("enable script debugging; FLAGS are:\n\ +g - guile stack traces\n\ +t - sieve trace (MU_SIEVE_DEBUG_TRACE)\n\ +i - sieve instructions trace (MU_SIEVE_DEBUG_INSTR)\n\ +l - sieve action logs"), + mu_c_string, NULL, set_debug }, MU_OPTION_END @@ -143,2 +160,17 @@ cb_script_pattern (void *data, mu_config_value_t *val) +static int +cb_debug (void *data, mu_config_value_t *val) +{ + char *p; + + if (mu_cfg_assert_value_type (val, MU_CFG_STRING)) + return 1; + if (mu_script_debug_flags (val->v.string, &p)) + { + mu_error (_("%c is not a valid debug flag"), *p); + return 1; + } + return 0; +} + struct mu_cfg_param mda_script_cfg[] = { @@ -151,2 +183,10 @@ struct mu_cfg_param mda_script_cfg[] = { N_("arg: glob") }, + { "debug", mu_cfg_callback, NULL, 0, cb_debug, + N_("Set scripting debug level. Argument is one or more " + "of the following letters:\n" + " g - guile stack traces\n" + " t - sieve trace (MU_SIEVE_DEBUG_TRACE)\n" + " i - sieve instructions trace (MU_SIEVE_DEBUG_INSTR)\n" + " l - sieve action logs\n"), + N_("arg: string") }, { NULL } |