1998-10-08 18:40:27 +08:00
|
|
|
#include "system.h"
|
1997-05-07 23:09:39 +08:00
|
|
|
|
|
|
|
extern int sys_nerr;
|
|
|
|
extern char *sys_errlist[];
|
|
|
|
static char buf[64];
|
|
|
|
|
1998-10-08 18:40:27 +08:00
|
|
|
char *
|
|
|
|
strerror(int errnum)
|
1997-05-07 23:09:39 +08:00
|
|
|
{
|
|
|
|
if (errnum < 0 || errnum > sys_nerr)
|
|
|
|
{
|
|
|
|
static char fmt[] = "Unknown error %d";
|
|
|
|
size_t len = (size_t) sprintf (buf, fmt, errnum);
|
|
|
|
if (len < (size_t) sizeof(fmt) - 2)
|
|
|
|
return NULL;
|
|
|
|
buf[len - 1] = '\0';
|
|
|
|
return buf;
|
|
|
|
}
|
|
|
|
|
|
|
|
return (char *) sys_errlist[errnum];
|
|
|
|
}
|