2001-03-06 11:17:54 +03:00
|
|
|
/* public domain rewrite of strerror(3) */
|
1998-01-16 15:13:05 +03:00
|
|
|
|
2010-07-28 12:12:01 +04:00
|
|
|
#include "ruby/missing.h"
|
|
|
|
|
1998-01-16 15:13:05 +03:00
|
|
|
extern int sys_nerr;
|
|
|
|
extern char *sys_errlist[];
|
|
|
|
|
|
|
|
static char msg[50];
|
|
|
|
|
|
|
|
char *
|
2005-10-22 05:28:00 +04:00
|
|
|
strerror(int error)
|
1998-01-16 15:13:05 +03:00
|
|
|
{
|
2001-03-06 11:17:54 +03:00
|
|
|
if (error <= sys_nerr && error > 0) {
|
1998-01-16 15:13:05 +03:00
|
|
|
return sys_errlist[error];
|
|
|
|
}
|
2001-03-06 11:17:54 +03:00
|
|
|
sprintf(msg, "Unknown error (%d)", error);
|
1998-01-16 15:13:05 +03:00
|
|
|
return msg;
|
|
|
|
}
|