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.5 (Berkeley) 02/24/91"; 10 #endif /* LIBC_SCCS and not lint */ 11 12 #include <string.h> 13 #include <stdio.h> 14 15 char * 16 strerror(errnum) 17 int errnum; 18 { 19 extern int sys_nerr; 20 extern char *sys_errlist[]; 21 static char ebuf[40]; /* 64-bit number + slop */ 22 23 if ((unsigned int)errnum < sys_nerr) 24 return(sys_errlist[errnum]); 25 (void)sprintf(ebuf, "Unknown error: %d", errnum); 26 return(ebuf); 27 } 28