4 * Copyright 1998-2002 The OpenLDAP Foundation, Redwood City, California, USA
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted only as authorized by the OpenLDAP
9 * Public License. A copy of this license is available at
10 * http://www.OpenLDAP.org/license.html or in file LICENSE in the
11 * top-level directory of the distribution.
17 #if defined( HAVE_ERRNO_H )
19 #elif defined( HAVE_SYS_ERRNO_H )
20 # include <sys/errno.h>
23 #ifndef HAVE_SYS_ERRLIST
26 # define sys_errlist ((char **)0)
27 #elif DECL_SYS_ERRLIST
28 /* have sys_errlist but need declaration */
29 LDAP_LIBC_V(int) sys_nerr;
30 LDAP_LIBC_V(char) *sys_errlist[];
33 #undef _AC_ERRNO_UNKNOWN
34 #define _AC_ERRNO_UNKNOWN "unknown error"
36 #ifdef HAVE_SYS_ERRLIST
37 /* this is thread safe */
38 # define STRERROR(e) ( (e) > -1 && (e) < sys_nerr \
39 ? sys_errlist[(e)] : _AC_ERRNO_UNKNOWN )
41 #elif defined( HAVE_STRERROR )
42 /* this may not be thread safe */
43 /* and, yes, some implementations of strerror may return NULL */
44 # define STRERROR(e) ( strerror(e) \
45 ? strerror(e) : _AC_ERRNO_UNKNOWN )
48 /* this is thread safe */
49 # define STRERROR(e) ( _AC_ERRNO_UNKNOWN )
52 #endif /* _AC_ERRNO_H */