File: strerror.c

package info (click to toggle)
diablo 1.13-1
  • links: PTS
  • area: non-free
  • in suites: hamm
  • size: 804 kB
  • ctags: 875
  • sloc: ansic: 8,308; perl: 1,908; sh: 186; csh: 81; makefile: 67
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