No empty .Rs/.Re
[netbsd-mini2440.git] / external / bsd / openldap / dist / include / ac / errno.h
blob97f02ab3583d17b11d5ff84aa20bc6251aaef2fa
1 /* Generic errno.h */
2 /* $OpenLDAP: pkg/ldap/include/ac/errno.h,v 1.30.2.3 2008/02/11 23:26:40 kurt Exp $ */
3 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
5 * Copyright 1998-2008 The OpenLDAP Foundation.
6 * All rights reserved.
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted only as authorized by the OpenLDAP
10 * Public License.
12 * A copy of this license is available in file LICENSE in the
13 * top-level directory of the distribution or, alternatively, at
14 * <http://www.OpenLDAP.org/license.html>.
17 #ifndef _AC_ERRNO_H
18 #define _AC_ERRNO_H
20 #if defined( HAVE_ERRNO_H )
21 # include <errno.h>
22 #elif defined( HAVE_SYS_ERRNO_H )
23 # include <sys/errno.h>
24 #endif
26 #ifndef HAVE_SYS_ERRLIST
27 /* no sys_errlist */
28 # define sys_nerr 0
29 # define sys_errlist ((char **)0)
30 #elif defined( DECL_SYS_ERRLIST )
31 /* have sys_errlist but need declaration */
32 LDAP_LIBC_V(int) sys_nerr;
33 LDAP_LIBC_V(char) *sys_errlist[];
34 #endif
36 #undef _AC_ERRNO_UNKNOWN
37 #define _AC_ERRNO_UNKNOWN "unknown error"
39 #ifdef HAVE_SYS_ERRLIST
40 /* this is thread safe */
41 # define STRERROR(e) ( (e) > -1 && (e) < sys_nerr \
42 ? sys_errlist[(e)] : _AC_ERRNO_UNKNOWN )
44 #elif defined( HAVE_STRERROR )
45 /* this may not be thread safe */
46 /* and, yes, some implementations of strerror may return NULL */
47 # define STRERROR(e) ( strerror(e) \
48 ? strerror(e) : _AC_ERRNO_UNKNOWN )
50 #else
51 /* this is thread safe */
52 # define STRERROR(e) ( _AC_ERRNO_UNKNOWN )
53 #endif
55 #endif /* _AC_ERRNO_H */