xref: /csrg-svn/lib/libc/string/strerror.c (revision 42181)
137340Sbostic /*
237340Sbostic  * Copyright (c) 1988 Regents of the University of California.
337340Sbostic  * All rights reserved.
437340Sbostic  *
537340Sbostic  * Redistribution and use in source and binary forms are permitted
637340Sbostic  * provided that the above copyright notice and this paragraph are
737340Sbostic  * duplicated in all such forms and that any documentation,
837340Sbostic  * advertising materials, and other materials related to such
937340Sbostic  * distribution and use acknowledge that the software was developed
1037340Sbostic  * by the University of California, Berkeley.  The name of the
1137340Sbostic  * University may not be used to endorse or promote products derived
1237340Sbostic  * from this software without specific prior written permission.
1337340Sbostic  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
1437340Sbostic  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
1537340Sbostic  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
1637340Sbostic  */
1737340Sbostic 
1837340Sbostic #if defined(LIBC_SCCS) && !defined(lint)
19*42181Sbostic static char sccsid[] = "@(#)strerror.c	5.2 (Berkeley) 05/17/90";
2037340Sbostic #endif /* LIBC_SCCS and not lint */
2137340Sbostic 
22*42181Sbostic #include <string.h>
23*42181Sbostic 
2437340Sbostic char *
2537340Sbostic strerror(errnum)
2637340Sbostic 	int errnum;
2737340Sbostic {
2837340Sbostic 	extern int sys_nerr;
2937340Sbostic 	extern char *sys_errlist[];
3037340Sbostic 	static char ebuf[20];
3137340Sbostic 
3237340Sbostic 	if ((unsigned int)errnum < sys_nerr)
3337340Sbostic 		return(sys_errlist[errnum]);
3437340Sbostic 	(void)sprintf(ebuf, "Unknown error: %d", errnum);
3537340Sbostic 	return(ebuf);
3637340Sbostic }
37