xref: /csrg-svn/lib/libc/string/strerror.c (revision 37340)
1*37340Sbostic /*
2*37340Sbostic  * Copyright (c) 1988 Regents of the University of California.
3*37340Sbostic  * All rights reserved.
4*37340Sbostic  *
5*37340Sbostic  * Redistribution and use in source and binary forms are permitted
6*37340Sbostic  * provided that the above copyright notice and this paragraph are
7*37340Sbostic  * duplicated in all such forms and that any documentation,
8*37340Sbostic  * advertising materials, and other materials related to such
9*37340Sbostic  * distribution and use acknowledge that the software was developed
10*37340Sbostic  * by the University of California, Berkeley.  The name of the
11*37340Sbostic  * University may not be used to endorse or promote products derived
12*37340Sbostic  * from this software without specific prior written permission.
13*37340Sbostic  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
14*37340Sbostic  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
15*37340Sbostic  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
16*37340Sbostic  */
17*37340Sbostic 
18*37340Sbostic #if defined(LIBC_SCCS) && !defined(lint)
19*37340Sbostic static char sccsid[] = "@(#)strerror.c	5.1 (Berkeley) 04/09/89";
20*37340Sbostic #endif /* LIBC_SCCS and not lint */
21*37340Sbostic 
22*37340Sbostic char *
23*37340Sbostic strerror(errnum)
24*37340Sbostic 	int errnum;
25*37340Sbostic {
26*37340Sbostic 	extern int sys_nerr;
27*37340Sbostic 	extern char *sys_errlist[];
28*37340Sbostic 	static char ebuf[20];
29*37340Sbostic 
30*37340Sbostic 	if ((unsigned int)errnum < sys_nerr)
31*37340Sbostic 		return(sys_errlist[errnum]);
32*37340Sbostic 	(void)sprintf(ebuf, "Unknown error: %d", errnum);
33*37340Sbostic 	return(ebuf);
34*37340Sbostic }
35