Ruby  2.0.0p247(2013-06-27revision41674)
missing/strerror.c
Go to the documentation of this file.
00001 /* public domain rewrite of strerror(3) */
00002 
00003 #include "ruby/missing.h"
00004 
00005 extern int sys_nerr;
00006 extern char *sys_errlist[];
00007 
00008 static char msg[50];
00009 
00010 char *
00011 strerror(int error)
00012 {
00013     if (error <= sys_nerr && error > 0) {
00014         return sys_errlist[error];
00015     }
00016     sprintf(msg, "Unknown error (%d)", error);
00017     return msg;
00018 }
00019