summaryrefslogtreecommitdiff
path: root/misc/err.c
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>1995-12-19 10:00:22 +0000
committerRoland McGrath <roland@gnu.org>1995-12-19 10:00:22 +0000
commit755f55b0dbb0ffadc0acf020123c727dcf558354 (patch)
tree4c827acefeb58a0b9b3c3def6390a364a951a9bf /misc/err.c
parent8882961f3882ae110b9a1d5b78497c9a8f56ed0d (diff)
downloadglibc-755f55b0dbb0ffadc0acf020123c727dcf558354.tar.gz
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.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/misc/err.c b/misc/err.c
index 82719a8756..3ad7bf360f 100644
--- a/misc/err.c
+++ b/misc/err.c
@@ -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));
}