summaryrefslogtreecommitdiffabout
authorSergey Poznyakoff <gray@gnu.org>2019-10-16 16:52:23 (GMT)
committer Sergey Poznyakoff <gray@gnu.org>2019-10-16 16:52:23 (GMT)
commit6e35ba4275cd113dbbb8242e672bafb9dea02091 (patch) (side-by-side diff)
tree8a4719b4878199838c1da63b58b9fc31041faa7f
parentdcf58c57acf3f817d9a0d17fae5052f39390fb90 (diff)
downloadmailutils-6e35ba4275cd113dbbb8242e672bafb9dea02091.tar.gz
mailutils-6e35ba4275cd113dbbb8242e672bafb9dea02091.tar.bz2
Restore MDA debug flags.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--mda/lib/script.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/mda/lib/script.c b/mda/lib/script.c
index ec36cba..ef1d992 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,
exit (po->po_exit_error);
}
+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[] = {
MU_OPTION_GROUP (N_("Scripting options")),
{ "language", 'l', N_("STRING"), MU_OPTION_DEFAULT,
@@ -103,6 +113,13 @@ struct mu_option mda_script_options[] = {
{ "message-id-header", 0, N_("STRING"), MU_OPTION_DEFAULT,
N_("use this header to identify messages when logging Sieve actions"),
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
};
@@ -141,6 +158,21 @@ cb_script_pattern (void *data, mu_config_value_t *val)
return 0;
}
+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[] = {
{ "language", mu_cfg_callback, NULL, 0, cb_script_language,
N_("Set script language."),
@@ -149,6 +181,14 @@ struct mu_cfg_param mda_script_cfg[] = {
{ "pattern", mu_cfg_callback, NULL, 0, cb_script_pattern,
N_("Set script pattern."),
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 }
};

Return to:

Send suggestions and report system problems to the System administrator.