summaryrefslogtreecommitdiff
path: root/libc/misc
diff options
context:
space:
mode:
Diffstat (limited to 'libc/misc')
-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);