summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarmelo Amoroso <carmelo.amoroso@st.com>2008-04-22 15:13:57 +0000
committerCarmelo Amoroso <carmelo.amoroso@st.com>2008-04-22 15:13:57 +0000
commit98f4a6dc8c4bc9b75a9396ac0f2a7de409bbd1e2 (patch)
tree01521767c1ba9f3f0e98943e6cb84ed1dd15c289
parente049d0f8968a3c449b44f107fd77adb8bcc2772d (diff)
Added support for error_print_progname as proposed
by Will Newton <will.newton@gmail.com>
-rw-r--r--libc/misc/error/error.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/libc/misc/error/error.c b/libc/misc/error/error.c
index 02b4e8e69..5f0d512e9 100644
--- a/libc/misc/error/error.c
+++ b/libc/misc/error/error.c
@@ -44,7 +44,7 @@ int error_one_per_line;
/* 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 @@ void __error (int status, int errnum, const char *message, ...)
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 @@ void __error_at_line (int status, int errnum, const char *file_name,
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);