1290001Sglebius#include <config.h>
2290001Sglebius
3290001Sglebius#if !HAVE_STRERROR
4290001Sglebius/*
5290001Sglebius * Copyright (c) 1988 Regents of the University of California.
6290001Sglebius * All rights reserved.
7290001Sglebius *
8290001Sglebius * Redistribution and use in source and binary forms are permitted
9290001Sglebius * provided that the above copyright notice and this paragraph are
10290001Sglebius * duplicated in all such forms and that any documentation,
11290001Sglebius * advertising materials, and other materials related to such
12290001Sglebius * distribution and use acknowledge that the software was developed
13290001Sglebius * by the University of California, Berkeley.  The name of the
14290001Sglebius * University may not be used to endorse or promote products derived
15290001Sglebius * from this software without specific prior written permission.
16290001Sglebius * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
17290001Sglebius * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
18290001Sglebius * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
19290001Sglebius */
20290001Sglebius
21290001Sglebius#if defined(LIBC_SCCS) && !defined(lint)
22290001Sglebiusstatic const char sccsid[] = "@(#)strerror.c	5.1 (Berkeley) 4/9/89";
23290001Sglebius#endif /* LIBC_SCCS and not lint */
24290001Sglebius
25290001Sglebius#include <sys/types.h>
26290001Sglebius
27290001Sglebius#include <stdio.h>
28290001Sglebius#include <string.h>
29290001Sglebius
30290001Sglebius#include "l_stdlib.h"
31290001Sglebius
32290001Sglebiuschar *
33290001Sglebiusstrerror(
34290001Sglebius	int errnum
35290001Sglebius	)
36290001Sglebius{
37290001Sglebius	extern int sys_nerr;
38290001Sglebius	extern char *sys_errlist[];
39290001Sglebius	static char ebuf[20];
40290001Sglebius
41290001Sglebius	if ((unsigned int)errnum < sys_nerr)
42290001Sglebius		return sys_errlist[errnum];
43290001Sglebius	snprintf(ebuf, sizeof(ebuf), "Unknown error: %d", errnum);
44290001Sglebius
45290001Sglebius	return ebuf;
46290001Sglebius}
47290001Sglebius#else
48290001Sglebiusint strerror_bs;
49290001Sglebius#endif
50