svn commit: trunk/uClibc/libc/misc/error
carmelo at uclibc.org
carmelo at uclibc.org
Tue Apr 22 15:13:58 UTC 2008
Author: carmelo
Date: 2008-04-22 08:13:57 -0700 (Tue, 22 Apr 2008)
New Revision: 21797
Log:
Added support for error_print_progname as proposed
by Will Newton <will.newton at gmail.com>
Modified:
trunk/uClibc/libc/misc/error/error.c
Changeset:
Modified: trunk/uClibc/libc/misc/error/error.c
===================================================================
--- trunk/uClibc/libc/misc/error/error.c 2008-04-22 14:10:55 UTC (rev 21796)
+++ trunk/uClibc/libc/misc/error/error.c 2008-04-22 15:13:57 UTC (rev 21797)
@@ -44,7 +44,7 @@
/* If NULL, error will flush stdout, then print on stderr the program
name, a colon and a space. Otherwise, error will call this
function without parameters instead. */
-/* void (*error_print_progname) (void) = NULL; */
+void (*error_print_progname) (void) = NULL;
extern __typeof(error) __error attribute_hidden;
void __error (int status, int errnum, const char *message, ...)
@@ -53,7 +53,10 @@
fflush (stdout);
- fprintf (stderr, "%s: ", __uclibc_progname);
+ if (error_print_progname)
+ (*error_print_progname) ();
+ else
+ fprintf (stderr, "%s: ", __uclibc_progname);
va_start (args, message);
vfprintf (stderr, message, args);
@@ -89,7 +92,10 @@
fflush (stdout);
- fprintf (stderr, "%s:", __uclibc_progname);
+ if (error_print_progname)
+ (*error_print_progname) ();
+ else
+ fprintf (stderr, "%s:", __uclibc_progname);
if (file_name != NULL)
fprintf (stderr, "%s:%d: ", file_name, line_number);
More information about the uClibc-cvs
mailing list