diff options
author | Richard Kenner <kenner@gcc.gnu.org> | 1995-03-27 07:15:55 -0500 |
---|---|---|
committer | Richard Kenner <kenner@gcc.gnu.org> | 1995-03-27 07:15:55 -0500 |
commit | b6da85666d4180adde474902aa289b512ccc8c2e (patch) | |
tree | 7640943335a154835dc0824122ea7a27871ec853 | |
parent | 08fb8ad0d5dc96ee07b4a1a8187dae5fc4b0304d (diff) | |
download | gcc-b6da85666d4180adde474902aa289b512ccc8c2e.zip gcc-b6da85666d4180adde474902aa289b512ccc8c2e.tar.gz gcc-b6da85666d4180adde474902aa289b512ccc8c2e.tar.bz2 |
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
-rw-r--r-- | gcc/gcc.c | 34 |
1 files changed, 30 insertions, 4 deletions
@@ -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); |