summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Shaw <dshaw@jabberwocky.com>2002-10-04 00:10:49 +0200
committerDavid Shaw <dshaw@jabberwocky.com>2002-10-04 00:10:49 +0200
commitc5180316a218e244fbdc74ff50b2c3cf89bec56a (patch)
treeccf31162ffe432807da116f3f69c44d8e7650467
parent* gpg.sgml: Note that '#' means secret-key-unavailable, and that keyserver (diff)
downloadgnupg2-c5180316a218e244fbdc74ff50b2c3cf89bec56a.tar.xz
gnupg2-c5180316a218e244fbdc74ff50b2c3cf89bec56a.zip
* 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.
-rw-r--r--util/ChangeLog6
-rw-r--r--util/logger.c30
2 files changed, 36 insertions, 0 deletions
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 <dshaw@jabberwocky.com>
+
+ * 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 <dshaw@jabberwocky.com>
* 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)
@@ -165,6 +173,28 @@ g10_log_info_f( const char *fname, const char *fmt, ... )
}
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, ... )
{
va_list arg_ptr ;