diff options
author | sin <sin@2f30.org> | 2014-02-06 11:27:32 +0000 |
---|---|---|
committer | sin <sin@2f30.org> | 2014-02-06 11:31:34 +0000 |
commit | fd0f19b55727f4cc005bfa2c7959134e4a682617 (patch) | |
tree | 1612940a6e3a02d6c830f0ea58b83379d1ff5b6a /util/eprintf.c | |
parent | 51664faebcc10b53a1a78cff95f0efc04a2c7f8e (diff) |
Be less harsh and don't error out entirely
Diffstat (limited to 'util/eprintf.c')
-rw-r--r-- | util/eprintf.c | 18 |
1 files changed, 14 insertions, 4 deletions
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); + } +} |