File: strerror.c

package info (click to toggle)
xwrits 2.21-6
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k, lenny
  • size: 576 kB
  • ctags: 651
  • sloc: ansic: 5,393; sh: 330; makefile: 98
file content (25 lines) | stat: -rw-r--r-- 462 bytes parent folder | download | duplicates (29)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
/* Some operating systems don't have strerror.
   This file provides a definition which David Mazieres <dm@lcs.mit.edu>
   assures me works. */

#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif

char *
strerror(int errno)
{
  extern int sys_nerr;
  extern char *sys_errlist[];
  if (errno < 0 || errno >= sys_nerr)
    return (char *)"bad error number";
  else
    return sys_errlist[errno];
}

#ifdef __cplusplus
}
#endif