| 1 | /* strerror -- return a string corresponding to an error number.
|
|---|
| 2 | This is a quickie version only intended as compatability glue
|
|---|
| 3 | for systems which predate the ANSI C definition of the function;
|
|---|
| 4 | the glibc version is recommended for more general use.
|
|---|
| 5 |
|
|---|
| 6 | Copyright (C) 1998 Free Software Foundation, Inc.
|
|---|
| 7 |
|
|---|
| 8 | This program is free software; you can redistribute it and/or modify it
|
|---|
| 9 | under the terms of the GNU General Public License as published by the
|
|---|
| 10 | Free Software Foundation; either version 2, or (at your option) any
|
|---|
| 11 | later version.
|
|---|
| 12 |
|
|---|
| 13 | This program is distributed in the hope that it will be useful,
|
|---|
| 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|---|
| 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|---|
| 16 | GNU General Public License for more details.
|
|---|
| 17 |
|
|---|
| 18 | You should have received a copy of the GNU General Public License
|
|---|
| 19 | along with this program; if not, write to the Free Software
|
|---|
| 20 | Foundation, 51 Franklin Street, Fifth Floor,
|
|---|
| 21 | Boston, MA 02110-1301, USA. */
|
|---|
| 22 |
|
|---|
| 23 | #include "config.h"
|
|---|
| 24 |
|
|---|
| 25 | #ifndef HAVE_STRERROR
|
|---|
| 26 |
|
|---|
| 27 | # ifndef BOOTSTRAP
|
|---|
| 28 | # include <stdio.h>
|
|---|
| 29 | # endif
|
|---|
| 30 | # ifdef HAVE_STRING_H
|
|---|
| 31 | # include <string.h>
|
|---|
| 32 | # endif
|
|---|
| 33 | # include <errno.h>
|
|---|
| 34 | # undef strerror
|
|---|
| 35 |
|
|---|
| 36 | extern int sys_nerr;
|
|---|
| 37 | extern char *sys_errlist[];
|
|---|
| 38 |
|
|---|
| 39 | char *
|
|---|
| 40 | strerror(e)
|
|---|
| 41 | int e;
|
|---|
| 42 | {
|
|---|
| 43 | static char unknown_string[] =
|
|---|
| 44 | "Unknown error code #xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
|
|---|
| 45 |
|
|---|
| 46 | if (0<=e && e<sys_nerr)
|
|---|
| 47 | return sys_errlist[e];
|
|---|
| 48 | sprintf(unknown_string+20, "%d", e);
|
|---|
| 49 | return unknown_string;
|
|---|
| 50 | }
|
|---|
| 51 |
|
|---|
| 52 | #endif /* !HAVE_STRERROR */
|
|---|