File: strerror.c

package info (click to toggle)
diablo 1.16.test2-1
  • links: PTS
  • area: non-free
  • in suites: slink
  • size: 1,504 kB
  • ctags: 1,603
  • sloc: ansic: 17,654; perl: 2,054; sh: 260; csh: 118; makefile: 73
file content (28 lines) | stat: -rw-r--r-- 456 bytes parent folder | download | duplicates (2)
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
26
27
28
/*  $Revision: 1.1 $
**
**  Only <errno.h> is needed; the others are just to get the right sprintf()
**  declaration, sigh.
*/

#include "defs.h"

#if USE_STRERROR

/*
**  Return a string representation of errno.
*/
char *
strerror(int e)
{
    extern int	sys_nerr;
    extern char	*sys_errlist[];
    static char	buff[30];

    if (e >= 0 && e < sys_nerr)
	return sys_errlist[e];
    (void)sprintf(buff, "Error code %d\n", e);
    return buff;
}

#endif