VirtualBox

source: kBuild/vendor/sed/current/lib/strerror.c

Last change on this file was 599, checked in by bird, 18 years ago

GNU sed 4.1.5.

File size: 1.5 KB
Line 
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
36extern int sys_nerr;
37extern char *sys_errlist[];
38
39char *
40strerror(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 */
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette