diff options
author | Xavier Leroy <xavier.leroy@inria.fr> | 2004-05-23 15:53:50 +0000 |
---|---|---|
committer | Xavier Leroy <xavier.leroy@inria.fr> | 2004-05-23 15:53:50 +0000 |
commit | 94c928299c89e6799647f852dd4a77b759c3650b (patch) | |
tree | bc1dfbdd0db1c24986a1559746bf24d2638b0499 /otherlibs/unix | |
parent | beb679f2604a0f8c312b691820d6838ab344dde6 (diff) |
strerror est standard ANSI C
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@6315 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'otherlibs/unix')
-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 |