my previous version was wrong; this one is right
[unix-history] / usr / src / lib / libc / string / strerror.c
CommitLineData
1ff48e21
KB
1/*
2 * Copyright (c) 1988 Regents of the University of California.
3 * All rights reserved.
4 *
019bea33 5 * %sccs.include.redist.c%
1ff48e21
KB
6 */
7
8#if defined(LIBC_SCCS) && !defined(lint)
46b5f26a 9static char sccsid[] = "@(#)strerror.c 5.5 (Berkeley) %G%";
1ff48e21
KB
10#endif /* LIBC_SCCS and not lint */
11
336401ac 12#include <string.h>
46b5f26a 13#include <stdio.h>
336401ac 14
1ff48e21
KB
15char *
16strerror(errnum)
17 int errnum;
18{
19 extern int sys_nerr;
20 extern char *sys_errlist[];
6e38bb3c 21 static char ebuf[40]; /* 64-bit number + slop */
1ff48e21
KB
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}