diff options
author | K. Richard Pixley <rich@cygnus> | 1992-02-17 15:54:49 +0000 |
---|---|---|
committer | K. Richard Pixley <rich@cygnus> | 1992-02-17 15:54:49 +0000 |
commit | 542e1629fdd4df8920511c4eb2df15bb83feb13b (patch) | |
tree | f1b70b61ce3707e08b2f43081adfd3b4850654f3 /gas/strerror.c | |
parent | af2136245013fad2f72249258452d5f7154d5719 (diff) | |
download | gdb-542e1629fdd4df8920511c4eb2df15bb83feb13b.zip gdb-542e1629fdd4df8920511c4eb2df15bb83feb13b.tar.gz gdb-542e1629fdd4df8920511c4eb2df15bb83feb13b.tar.bz2 |
fighting bitrot in a major way
Diffstat (limited to 'gas/strerror.c')
-rw-r--r-- | gas/strerror.c | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/gas/strerror.c b/gas/strerror.c new file mode 100644 index 0000000..dbc403b --- /dev/null +++ b/gas/strerror.c @@ -0,0 +1,61 @@ +/* Version of strerror() for systems that need it. + Copyright (C) 1991, 1992 Free Software Foundation, Inc. + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ + + +/* + +NAME + + strerror -- map an error number to an error message string + +SYNOPSIS + + #include <string.h> + + char *strerror (int errnum) + +DESCRIPTION + + Returns a pointer to a string containing an error message, the + contents of which are implementation defined. The implementation + shall behave as if no library function calls strerror. The string + pointed to shall not be modified by the caller and is only guaranteed + to be valid until a subsequent call to strerror. + +BUGS + + Requires that the system have sys_errlist and sys_nerr. + +*/ + +#ifndef HAVE_STRERROR + +extern int sys_nerr; +extern char *sys_errlist[]; + +char * +strerror (code) + int code; +{ + return (((code < 0) || (code >= sys_nerr)) + ? "(unknown error)" + : sys_errlist [code]); +} + +#endif /* HAVE_STRERROR */ + + /* end of strerror.c */ |