summaryrefslogtreecommitdiff
path: root/misc.c
diff options
context:
space:
mode:
authorRoland McGrath <roland@redhat.com>1993-12-02 20:37:46 +0000
committerRoland McGrath <roland@redhat.com>1993-12-02 20:37:46 +0000
commit12113c5925e6c6cd57372fd2a0237475dfa14d4e (patch)
treec291d074b684a2f21a3d12e14e2affb0c1a327d9 /misc.c
parent63160928cdf75058bd1e6d8e1aaded6960d26fbd (diff)
downloadgunmake-12113c5925e6c6cd57372fd2a0237475dfa14d4e.tar.gz
Formerly misc.c.~28~
Diffstat (limited to 'misc.c')
-rw-r--r--misc.c33
1 files changed, 19 insertions, 14 deletions
diff --git a/misc.c b/misc.c
index d841bb2..885d075 100644
--- a/misc.c
+++ b/misc.c
@@ -267,19 +267,30 @@ makefile_fatal (file, lineno, s1, s2, s3, s4, s5, s6)
die (1);
}
+#ifndef HAVE_STRERROR
+char *
+strerror (errnum)
+ int errnum;
+{
+ extern int errno, sys_nerr;
+ extern char *sys_errlist[];
+ static char buf[] = "Unknown error 12345678901234567890";
+
+ if (errno < sys_nerr)
+ return sys_errlist[errnum];
+
+ sprintf ("Unknown error %d", buf, errnum);
+ return buf;
+}
+#endif
+
/* Print an error message from errno. */
void
perror_with_name (str, name)
char *str, *name;
{
- extern int errno, sys_nerr;
- extern char *sys_errlist[];
-
- if (errno < sys_nerr)
- error ("%s%s: %s", str, name, sys_errlist[errno]);
- else
- error ("%s%s: Unknown error %d", str, name, errno);
+ error ("%s%s: %s", str, name, strerror (errno));
}
/* Print an error message from errno and exit. */
@@ -288,13 +299,7 @@ void
pfatal_with_name (name)
char *name;
{
- extern int errno, sys_nerr;
- extern char *sys_errlist[];
-
- if (errno < sys_nerr)
- fatal ("%s: %s", name, sys_errlist[errno]);
- else
- fatal ("%s: Unknown error %d", name, errno);
+ fatal ("%s: %s", name, strerror (errno));
/* NOTREACHED */
}