From c5180316a218e244fbdc74ff50b2c3cf89bec56a Mon Sep 17 00:00:00 2001 From: David Shaw Date: Thu, 3 Oct 2002 22:10:49 +0000 Subject: [PATCH] * logger.c (g10_log_warning, log_set_strict): Add new log_warning logger command which can be switched between log_info and log_error via log_set_strict. --- util/ChangeLog | 6 ++++++ util/logger.c | 30 ++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/util/ChangeLog b/util/ChangeLog index be623cf7e..142a3895b 100644 --- a/util/ChangeLog +++ b/util/ChangeLog @@ -1,3 +1,9 @@ +2002-10-03 David Shaw + + * logger.c (g10_log_warning, log_set_strict): Add new log_warning + logger command which can be switched between log_info and + log_error via log_set_strict. + 2002-09-24 David Shaw * http.c (connect_server): Try all A records for names with diff --git a/util/logger.c b/util/logger.c index a51455798..6990473b2 100644 --- a/util/logger.c +++ b/util/logger.c @@ -31,6 +31,7 @@ static char pidstring[15]; static char *pgm_name; static int errorcount; +static int strict; static FILE *logfp; /**************** @@ -107,6 +108,13 @@ log_inc_errorcount() errorcount++; } +int +log_set_strict(int val) +{ + int old=strict; + strict=val; + return old; +} void g10_log_print_prefix(const char *text) @@ -164,6 +172,28 @@ g10_log_info_f( const char *fname, const char *fmt, ... ) #endif /* __riscos__ */ } +void +g10_log_warning( const char *fmt, ... ) +{ + va_list arg_ptr ; + + if(strict) + { + errorcount++; + g10_log_print_prefix(_("ERROR: ")); + } + else + g10_log_print_prefix(_("WARNING: ")); + + va_start( arg_ptr, fmt ) ; + vfprintf(logfp,fmt,arg_ptr) ; + va_end(arg_ptr); +#ifdef __riscos__ + fflush( logfp ); +#endif /* __riscos__ */ +} + + void g10_log_error( const char *fmt, ... ) {