1997-03-19 03:37:42 +01:00
|
|
|
/*
|
|
|
|
* strerror - map error number to descriptive string
|
|
|
|
*
|
|
|
|
* This version is obviously somewhat Unix-specific.
|
|
|
|
*
|
|
|
|
* based on code by Henry Spencer
|
|
|
|
* modified for ANSI by D'Arcy J.M. Cain
|
|
|
|
*/
|
|
|
|
|
1997-09-07 07:04:48 +02:00
|
|
|
#include <string.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <errno.h>
|
1997-03-19 03:37:42 +01:00
|
|
|
|
1997-09-07 07:04:48 +02:00
|
|
|
extern const char *const sys_errlist[];
|
|
|
|
extern int sys_nerr;
|
1997-03-19 03:37:42 +01:00
|
|
|
|
1997-09-07 07:04:48 +02:00
|
|
|
const char *
|
1997-03-19 03:37:42 +01:00
|
|
|
strerror(int errnum)
|
|
|
|
{
|
1997-09-07 07:04:48 +02:00
|
|
|
static char buf[24];
|
1997-03-19 03:37:42 +01:00
|
|
|
|
1997-09-07 07:04:48 +02:00
|
|
|
if (errnum < 0 || errnum > sys_nerr)
|
|
|
|
{
|
|
|
|
sprintf(buf, "unknown error %d", errnum);
|
|
|
|
return (buf);
|
|
|
|
}
|
1997-03-19 03:37:42 +01:00
|
|
|
|
1997-09-07 07:04:48 +02:00
|
|
|
return (sys_errlist[errnum]);
|
1997-03-19 03:37:42 +01:00
|
|
|
}
|