xref: /csrg-svn/lib/libc/string/strerror.c (revision 43625)
1 /*
2  * Copyright (c) 1988 Regents of the University of California.
3  * All rights reserved.
4  *
5  * %sccs.include.redist.c%
6  */
7 
8 #if defined(LIBC_SCCS) && !defined(lint)
9 static char sccsid[] = "@(#)strerror.c	5.4 (Berkeley) 06/24/90";
10 #endif /* LIBC_SCCS and not lint */
11 
12 #include <string.h>
13 
14 char *
15 strerror(errnum)
16 	int errnum;
17 {
18 	extern int sys_nerr;
19 	extern char *sys_errlist[];
20 	static char ebuf[40];		/* 64-bit number + slop */
21 
22 	if ((unsigned int)errnum < sys_nerr)
23 		return(sys_errlist[errnum]);
24 	(void)sprintf(ebuf, "Unknown error: %d", errnum);
25 	return(ebuf);
26 }
27