From fd0f19b55727f4cc005bfa2c7959134e4a682617 Mon Sep 17 00:00:00 2001 From: sin Date: Thu, 6 Feb 2014 11:27:32 +0000 Subject: Be less harsh and don't error out entirely --- util/eprintf.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'util') diff --git a/util/eprintf.c b/util/eprintf.c index 6d6fa65..af05686 100644 --- a/util/eprintf.c +++ b/util/eprintf.c @@ -6,8 +6,6 @@ #include "../util.h" -char *argv0; - static void venprintf(int, const char *, va_list); void @@ -33,8 +31,6 @@ enprintf(int status, const char *fmt, ...) void venprintf(int status, const char *fmt, va_list ap) { - fprintf(stderr, "%s: ", argv0); - vfprintf(stderr, fmt, ap); if(fmt[0] && fmt[strlen(fmt)-1] == ':') { @@ -44,3 +40,17 @@ venprintf(int status, const char *fmt, va_list ap) exit(status); } + +void +weprintf(const char *fmt, ...) +{ + va_list ap; + + va_start(ap, fmt); + vfprintf(stderr, fmt, ap); + va_end(ap); + if (fmt[0] && fmt[strlen(fmt)-1] == ':') { + fputc(' ', stderr); + perror(NULL); + } +} -- cgit v1.2.3-70-g09d2