Commit b6da8566 by Richard Kenner

Removed __NetBSD__ from conditional.

Declare strerror if HAVE_STRERROR is defined; otherwise declare sys_errlist
and sys_nerr.
(my_strerror): New function.

From-SVN: r9233
parent 08fb8ad0
......@@ -171,11 +171,15 @@ extern int errno;
#endif
extern int sys_nerr;
#if defined(bsd4_4) || defined(__NetBSD__)
#ifndef HAVE_STRERROR
#if defined(bsd4_4)
extern const char *const sys_errlist[];
#else
extern char *sys_errlist[];
#endif
#else
extern char *strerror();
#endif
extern int execv (), execvp ();
......@@ -1102,6 +1106,28 @@ translate_options (argcp, argvp)
*argcp = newindex;
}
char *
my_strerror(e)
int e;
{
#ifdef HAVE_STRERROR
return strerror(e);
#else
static char buffer[30];
if (!e)
return "";
if (e > 0 && e < sys_nerr)
return sys_errlist[e];
sprintf (buffer, "Unknown error %d", e);
return buffer;
#endif
}
/* Read compilation specs from a file named FILENAME,
replacing the default ones.
......@@ -4800,7 +4826,7 @@ pfatal_with_name (name)
char *s;
if (errno < sys_nerr)
s = concat ("%s: ", sys_errlist[errno]);
s = concat ("%s: ", my_strerror( errno ));
else
s = "cannot open %s";
fatal (s, name);
......@@ -4813,7 +4839,7 @@ perror_with_name (name)
char *s;
if (errno < sys_nerr)
s = concat ("%s: ", sys_errlist[errno]);
s = concat ("%s: ", my_strerror( errno ));
else
s = "cannot open %s";
error (s, name);
......@@ -4826,7 +4852,7 @@ perror_exec (name)
char *s;
if (errno < sys_nerr)
s = concat ("installation problem, cannot exec %s: ", sys_errlist[errno]);
s = concat ("installation problem, cannot exec %s: ", my_strerror( errno ));
else
s = "installation problem, cannot exec %s";
error (s, name);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment