1258945Sroberto#include <config.h>
2258945Sroberto
3258945Sroberto#if !HAVE_STRERROR
4258945Sroberto/*
5258945Sroberto * Copyright (c) 1988 Regents of the University of California.
6258945Sroberto * All rights reserved.
7258945Sroberto *
8258945Sroberto * Redistribution and use in source and binary forms are permitted
9258945Sroberto * provided that the above copyright notice and this paragraph are
10258945Sroberto * duplicated in all such forms and that any documentation,
11258945Sroberto * advertising materials, and other materials related to such
12258945Sroberto * distribution and use acknowledge that the software was developed
13258945Sroberto * by the University of California, Berkeley.  The name of the
14258945Sroberto * University may not be used to endorse or promote products derived
15258945Sroberto * from this software without specific prior written permission.
16258945Sroberto * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
17258945Sroberto * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
18258945Sroberto * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
19258945Sroberto */
20258945Sroberto
21258945Sroberto#if defined(LIBC_SCCS) && !defined(lint)
22258945Srobertostatic const char sccsid[] = "@(#)strerror.c	5.1 (Berkeley) 4/9/89";
23258945Sroberto#endif /* LIBC_SCCS and not lint */
24258945Sroberto
25258945Sroberto#include <sys/types.h>
26258945Sroberto
27258945Sroberto#include <stdio.h>
28258945Sroberto#include <string.h>
29258945Sroberto
30258945Sroberto#include "l_stdlib.h"
31258945Sroberto
32258945Srobertochar *
33258945Srobertostrerror(
34258945Sroberto	int errnum
35258945Sroberto	)
36258945Sroberto{
37258945Sroberto	extern int sys_nerr;
38258945Sroberto	extern char *sys_errlist[];
39258945Sroberto	static char ebuf[20];
40258945Sroberto
41258945Sroberto	if ((unsigned int)errnum < sys_nerr)
42280849Scy		return sys_errlist[errnum];
43280849Scy	snprintf(ebuf, sizeof(ebuf), "Unknown error: %d", errnum);
44280849Scy
45280849Scy	return ebuf;
46258945Sroberto}
47258945Sroberto#else
48258945Srobertoint strerror_bs;
49258945Sroberto#endif
50