diff options
author | Rob Landley <rob@landley.net> | 2008-01-27 15:26:08 -0600 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2008-01-27 15:26:08 -0600 |
commit | 12138e498721892320e703702dcd3a4b191fb7fc (patch) | |
tree | 4f31f3eb8f841bd9876d7a4358e92ac7861c2744 /lib | |
parent | 5c4a217cfbcb795a5ebc345a9efe9a1990801d1b (diff) | |
download | toybox-12138e498721892320e703702dcd3a4b191fb7fc.tar.gz |
Teach perror_exit() to take a NULL argument when we just want "command: error".
Diffstat (limited to 'lib')
-rw-r--r-- | lib/lib.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -20,9 +20,12 @@ void xstrcpy(char *dest, char *src, size_t size) void verror_msg(char *msg, int err, va_list va) { + char *s = ": %s"; + fprintf(stderr, "%s: ", toys.which->name); - vfprintf(stderr, msg, va); - if (err) fprintf(stderr, ": %s", strerror(err)); + if (msg) vfprintf(stderr, msg, va); + else s+=2; + if (err) fprintf(stderr, s, strerror(err)); putc('\n', stderr); } |