diff options
Diffstat (limited to 'otherlibs/unix/errmsg.c')
-rw-r--r-- | otherlibs/unix/errmsg.c | 23 |
1 files changed, 1 insertions, 22 deletions
diff --git a/otherlibs/unix/errmsg.c b/otherlibs/unix/errmsg.c index ca09364ee..ae8793e19 100644 --- a/otherlibs/unix/errmsg.c +++ b/otherlibs/unix/errmsg.c @@ -14,36 +14,15 @@ /* $Id$ */ #include <errno.h> +#include <string.h> #include <mlvalues.h> #include <alloc.h> extern int error_table[]; -#ifdef HAS_STRERROR - -extern char * strerror(int); - CAMLprim value unix_error_message(value err) { int errnum; errnum = Is_block(err) ? Int_val(Field(err, 0)) : error_table[Int_val(err)]; return copy_string(strerror(errnum)); } - -#else - -extern int sys_nerr; -extern char *sys_errlist[]; - -CAMLprim value unix_error_message(value err) -{ - int errnum; - errnum = Is_block(err) ? Int_val(Field(err, 0)) : error_table[Int_val(err)]; - if (errnum < 0 || errnum >= sys_nerr) { - return copy_string("Unknown error"); - } else { - return copy_string(sys_errlist[errnum]); - } -} - -#endif |