aboutsummaryrefslogtreecommitdiffstats
path: root/jnlib/logging.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2003-06-18 19:56:13 +0000
committerWerner Koch <[email protected]>2003-06-18 19:56:13 +0000
commitc0c2c58054923d506f61ce9a71d509b48a381211 (patch)
treea8f82bffb44eb68eb726ff6db41fa715bcd29193 /jnlib/logging.c
parentA small step for GnuPG but a huge leap for error codes. (diff)
downloadgnupg-c0c2c58054923d506f61ce9a71d509b48a381211.tar.gz
gnupg-c0c2c58054923d506f61ce9a71d509b48a381211.zip
Finished the bulk of changes for gnupg 1.9. This included switching
to libgcrypt functions, using shared error codes from libgpg-error, replacing the old functions we used to have in ../util by those in ../jnlib and ../common, renaming the malloc functions and a couple of types. Note, that not all changes are listed below becuause they are too similar and done at far too many places. As of today the code builds using the current libgcrypt from CVS but it is very unlikely that it actually works.
Diffstat (limited to '')
-rw-r--r--jnlib/logging.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/jnlib/logging.c b/jnlib/logging.c
index 647e757c6..913d01b6f 100644
--- a/jnlib/logging.c
+++ b/jnlib/logging.c
@@ -1,5 +1,5 @@
/* logging.c - useful logging functions
- * Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+ * Copyright (C) 1998, 1999, 2000, 2001, 2003 Free Software Foundation, Inc.
*
* This file is part of GnuPG.
*
@@ -79,6 +79,12 @@ log_get_errorcount (int clear)
}
void
+log_inc_errorcount (void)
+{
+ errorcount++;
+}
+
+void
log_set_file( const char *name )
{
FILE *fp = (name && strcmp(name,"-"))? fopen(name, "a") : stderr;
@@ -194,7 +200,12 @@ do_logv( int level, const char *fmt, va_list arg_ptr )
fprintf (logstream, "[%u]", (unsigned int)getpid ());
if (!with_time)
putc (':', logstream);
- putc (' ', logstream);
+ /* A leading backspace suppresses the extra space so that we can
+ correclty output, programname, filename and linenumber. */
+ if (fmt && *fmt == '\b')
+ fmt++;
+ else
+ putc (' ', logstream);
}
switch (level)
@@ -272,7 +283,7 @@ log_fatal( const char *fmt, ... )
va_start( arg_ptr, fmt ) ;
do_logv( JNLIB_LOG_FATAL, fmt, arg_ptr );
va_end(arg_ptr);
- abort(); /* never called, bugs it makes the compiler happy */
+ abort(); /* never called, but it makes the compiler happy */
}
void