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