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