diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2010-12-08 20:36:48 +0200 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2010-12-08 20:36:48 +0200 |
commit | 55086f9411acfcf185f8f535b301b52600c48c68 (patch) | |
tree | 228f5d277db25bfb466876faa8ad25cbd358a082 /comsat/action.c | |
parent | e20d435c8e310046c15acbdf47fa458fe7ead1ae (diff) | |
download | mailutils-55086f9411acfcf185f8f535b301b52600c48c68.tar.gz mailutils-55086f9411acfcf185f8f535b301b52600c48c68.tar.bz2 |
comsat: provide a fine-grained control over where biffrc errors are output
* comsat/comsat.c (biffrc_errors): New variable.
(comsat_cfg_param): New statements: biffrc-errors-to-tty and
biffrc-errors-to-err
(main): In test mode, set biffrc_errors to BIFFRC_ERRORS_TO_ERR.
* comsat/comsat.h (BIFFRC_ERRORS_TO_TTY)
(BIFFRC_ERRORS_TO_ERR): New flags.
(biffrc_errors): New variable.
* comsat/action.c (report_error): Consult biffrc_errors.
Diffstat (limited to 'comsat/action.c')
-rw-r--r-- | comsat/action.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/comsat/action.c b/comsat/action.c index 2d9aa3979..59f3c6fcf 100644 --- a/comsat/action.c +++ b/comsat/action.c @@ -314,15 +314,19 @@ struct biffrc_environ static void report_error (struct biffrc_environ *env, const char *fmt, ...) { - va_list ap; - va_start (ap, fmt); - mu_vasnprintf (&env->errbuf, &env->errsize, fmt, ap); - mu_stream_printf (env->logstr, "%s\n", env->errbuf); - mu_diag_output (MU_DIAG_ERROR, "%s", env->errbuf); - va_end (ap); + if (biffrc_errors) + { + va_list ap; + va_start (ap, fmt); + mu_vasnprintf (&env->errbuf, &env->errsize, fmt, ap); + if (biffrc_errors & BIFFRC_ERRORS_TO_TTY) + mu_stream_printf (env->logstr, "%s\n", env->errbuf); + if (biffrc_errors & BIFFRC_ERRORS_TO_ERR) + mu_diag_output (MU_DIAG_ERROR, "%s", env->errbuf); + va_end (ap); + } } - - + static void action_beep (struct biffrc_environ *env, size_t argc, char **argv) { |