diff options
author | Roland McGrath <roland@gnu.org> | 1995-12-19 10:00:22 +0000 |
---|---|---|
committer | Roland McGrath <roland@gnu.org> | 1995-12-19 10:00:22 +0000 |
commit | 755f55b0dbb0ffadc0acf020123c727dcf558354 (patch) | |
tree | 4c827acefeb58a0b9b3c3def6390a364a951a9bf /misc/err.c | |
parent | 8882961f3882ae110b9a1d5b78497c9a8f56ed0d (diff) | |
download | glibc-755f55b0dbb0ffadc0acf020123c727dcf558354.zip glibc-755f55b0dbb0ffadc0acf020123c727dcf558354.tar.gz glibc-755f55b0dbb0ffadc0acf020123c727dcf558354.tar.bz2 |
Mon Dec 18 13:40:37 1995 Roland McGrath <roland@churchy.gnu.ai.mit.edu>cvs/libc-951219
* stdio/fread.c: Don't increment __offset when it's -1.
* elf/rtld.c (dl_main): Prepend tab to "statically linked". Exit
0 in that case.
* misc/err.c (vwarnx, vwarn): Fix major brainos.
* sysdeps/mach/hurd/dl-sysdep.c (mmap): Fix setting of
inheritance.
Diffstat (limited to 'misc/err.c')
-rw-r--r-- | misc/err.c | 22 |
1 files changed, 17 insertions, 5 deletions
@@ -20,6 +20,8 @@ Cambridge, MA 02139, USA. */ #include <stdarg.h> #include <err.h> #include <stdlib.h> +#include <errno.h> +#include <string.h> #include <stdio.h> extern char *__progname; @@ -33,18 +35,28 @@ extern char *__progname; } void -vwarn (const char *format, __gnuc_va_list ap) +vwarnx (const char *format, __gnuc_va_list ap) { - fprintf (stderr, format, ap); + if (__progname) + fprintf (stderr, "%s: ", __progname); + if (format) + vfprintf (stderr, format, ap); + putc ('\n', stderr); } void -vwarnx (const char *format, __gnuc_va_list ap) +vwarn (const char *format, __gnuc_va_list ap) { + int error = errno; + if (__progname) fprintf (stderr, "%s: ", __progname); - fprintf (stderr, format, ap); - putc ('\n', stderr); + if (format) + { + vfprintf (stderr, format, ap); + fputs (": ", stderr); + } + fprintf (stderr, "%s\n", strerror (error)); } |