diff options
Diffstat (limited to 'otherlibs/unix/errmsg.c')
| -rw-r--r-- | otherlibs/unix/errmsg.c | 49 |
1 files changed, 0 insertions, 49 deletions
diff --git a/otherlibs/unix/errmsg.c b/otherlibs/unix/errmsg.c deleted file mode 100644 index ca09364eeb..0000000000 --- a/otherlibs/unix/errmsg.c +++ /dev/null @@ -1,49 +0,0 @@ -/***********************************************************************/ -/* */ -/* Objective Caml */ -/* */ -/* Xavier Leroy, projet Cristal, INRIA Rocquencourt */ -/* */ -/* Copyright 1996 Institut National de Recherche en Informatique et */ -/* en Automatique. All rights reserved. This file is distributed */ -/* under the terms of the GNU Library General Public License, with */ -/* the special exception on linking described in file ../../LICENSE. */ -/* */ -/***********************************************************************/ - -/* $Id$ */ - -#include <errno.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 |
