From b1ab654fbe852070df3931ba63594c7a52f30942 Mon Sep 17 00:00:00 2001 From: Hallvard Furuseth Date: Tue, 17 Nov 1998 01:25:45 +0000 Subject: [PATCH] Kill off #elif in ldap/include/. K&R does not support it. --- include/ac/errno.h | 6 ++++-- include/ac/krb.h | 16 ++++++++++------ include/ac/socket.h | 10 ++++++---- include/ac/string.h | 14 ++++++++++---- include/ac/syslog.h | 18 ++++++++++++------ include/ac/termios.h | 4 +++- include/ac/time.h | 9 ++++++--- include/ac/unistd.h | 8 +++++--- include/ldbm.h | 15 +++++++++++---- include/lthread.h | 20 +++++++++++++------- 10 files changed, 80 insertions(+), 40 deletions(-) diff --git a/include/ac/errno.h b/include/ac/errno.h index b083cbbdf5..de2b033430 100644 --- a/include/ac/errno.h +++ b/include/ac/errno.h @@ -5,8 +5,10 @@ #if defined( HAVE_ERRNO_H ) # include -#elif defined( HAVE_SYS_ERRNO_H ) -# include +#else +# if defined( HAVE_SYS_ERRNO_H ) +# include +# endif #endif #ifdef DECL_SYS_ERRLIST diff --git a/include/ac/krb.h b/include/ac/krb.h index d371350354..75113137e0 100644 --- a/include/ac/krb.h +++ b/include/ac/krb.h @@ -6,15 +6,19 @@ #if defined( HAVE_KERBEROS ) #if defined( HAVE_KERBEROSIV_KRB_H ) -#include -#elif defined( HAVE_KRB_H ) -#include +# include +#else +# if defined( HAVE_KRB_H ) +# include +# endif #endif #if defined( HAVE_KERBEROSIV_DES_H ) -#include -#elif defined( HAVE_DES_H ) -#include +# include +#else +# if defined( HAVE_DES_H ) +# include +# endif #endif #endif /* HAVE_KERBEROS */ diff --git a/include/ac/socket.h b/include/ac/socket.h index 1527d02e5f..310402d24d 100644 --- a/include/ac/socket.h +++ b/include/ac/socket.h @@ -24,11 +24,13 @@ #endif #ifdef HAVE_WINSOCK2 -#include -#elif HAVE_WINSOCK -#include +# include #else -#define WSACleanup() +# if HAVE_WINSOCK +# include +# else +# define WSACleanup() +# endif #endif #ifdef HAVE_PCNFS diff --git a/include/ac/string.h b/include/ac/string.h index 8df4116cff..87c5cb258f 100644 --- a/include/ac/string.h +++ b/include/ac/string.h @@ -8,8 +8,10 @@ #else # ifdef HAVE_STRING_H # include -# elif HAVE_STRINGS_H +# else +# ifdef HAVE_STRINGS_H # include +# endif # endif # ifndef HAVE_STRCHR @@ -41,13 +43,17 @@ #ifndef SAFEMEMCPY # if defined( HAVE_MEMMOVE ) # define SAFEMEMCPY( d, s, n ) memmove((d), (s), (n)) -# elif defined( HAVE_BCOPY ) +# else +# if defined( HAVE_BCOPY ) # define SAFEMEMCPY( d, s, n ) bcopy((s), (d), (n)) -# elif defined( MACOS ) +# else +# if defined( MACOS ) # define SAFEMEMCPY( d, s, n ) BlockMoveData((Ptr)(s), (Ptr)(d), (n)) -# else +# else /* nothing left but memcpy() */ # define SAFEMEMCPY( d, s, n ) memcpy((d), (s), (n)) +# endif +# endif # endif #endif diff --git a/include/ac/syslog.h b/include/ac/syslog.h index c7afb100ba..8ac3950750 100644 --- a/include/ac/syslog.h +++ b/include/ac/syslog.h @@ -5,19 +5,25 @@ #define _AC_SYSLOG_H_ #if defined( HAVE_SYSLOG_H ) -#include -#elif defined ( HAVE_SYS_SYSLOG_H ) -#include +# include +#else +# if defined ( HAVE_SYS_SYSLOG_H ) +# include +# endif #endif #if defined( LOG_NDELAY ) && defined( LOG_NOWAIT ) # define OPENLOG_OPTIONS ( LOG_PID | LOG_NDELAY | LOG_NOWAIT ) -#elif defined( LOG_NDELAY ) +#else +# if defined( LOG_NDELAY ) # define OPENLOG_OPTIONS ( LOG_PID | LOG_NDELAY ) -#elif defined( LOG_NOWAIT ) +# else +# if defined( LOG_NOWAIT ) # define OPENLOG_OPTIONS ( LOG_PID | LOG_NOWAIT ) -#else +# else # define OPENLOG_OPTIONS ( LOG_PID ) +# endif +# endif #endif #endif /* _AC_SYSLOG_H_ */ diff --git a/include/ac/termios.h b/include/ac/termios.h index 5590ab0df6..b5adaa94c7 100644 --- a/include/ac/termios.h +++ b/include/ac/termios.h @@ -13,7 +13,8 @@ #define GETFLAGS( tio ) ((tio).c_lflag) #define SETFLAGS( tio, flags ) ((tio).c_lflag = (flags)) -#elif defined( HAVE_SGTTY_H ) +#else /* !HAVE_TERMIOS_H */ +#if defined( HAVE_SGTTY_H ) #include #ifdef HAVE_SYS_IOCTL_H @@ -28,5 +29,6 @@ #define SETFLAGS( tio, flags ) ((tio).sg_flags = (flags)) #endif /* HAVE_SGTTY_H */ +#endif /* HAVE_TERMIOS_H */ #endif /* _AC_TERMIOS_H */ diff --git a/include/ac/time.h b/include/ac/time.h index ba18790a4c..0742a5ce60 100644 --- a/include/ac/time.h +++ b/include/ac/time.h @@ -6,10 +6,13 @@ #if TIME_WITH_SYS_TIME # include # include -#elif HAVE_SYS_TIME_H -# include #else -# include + /* Do not use #elif, not all non-ANSI compilers support it. */ +# if HAVE_SYS_TIME_H +# include +# else +# include +# endif #endif #endif /* _AC_TIME_H */ diff --git a/include/ac/unistd.h b/include/ac/unistd.h index a52b288417..1c5a82ba82 100644 --- a/include/ac/unistd.h +++ b/include/ac/unistd.h @@ -22,15 +22,17 @@ #if HAVE_GETOPT_H # include -#elif !defined(HAVE_GETOPT) +#else +# if !defined(HAVE_GETOPT) /* no getopt, assume we need getopt-compat.h */ # include -#else +# else /* assume we need to declare these externs */ extern char *optarg; extern int optind, opterr, optopt; -#endif +# endif +#endif /* HAVE_GETOPT_H */ #ifndef HAVE_TEMPNAM extern char *tempnam(const char *tmpdir, const char *prefix); diff --git a/include/ldbm.h b/include/ldbm.h index 0f4c07c3ad..4990371359 100644 --- a/include/ldbm.h +++ b/include/ldbm.h @@ -57,7 +57,9 @@ typedef DB *LDBM; #define LDBM_REPLACE 0 #define LDBM_SYNC 0x80000000 -#elif defined( LDBM_USE_DBHASH ) +/* Do not use #elif. K&R does not support it. */ +#else /* !LDBM_USE_DBBTREE */ +#ifdef LDBM_USE_DBHASH /***************************************************************** * * @@ -108,7 +110,8 @@ typedef DB *LDBM; #define LDBM_REPLACE 0 #define LDBM_SYNC 0x80000000 -#elif defined( HAVE_GDBM ) +#else /* !LDBM_USE_DBHASH */ +#ifdef HAVE_GDBM /***************************************************************** * * @@ -139,7 +142,8 @@ extern gdbm_error gdbm_errno; #define LDBM_SYNC 0x80000000 -#elif defined( HAVE_NDBM ) +#else /* !HAVE_GDBM */ +#ifdef HAVE_NDBM /***************************************************************** * * @@ -171,7 +175,10 @@ typedef DBM *LDBM; #define LDBM_REPLACE DBM_REPLACE #define LDBM_SYNC 0 -#endif +#endif /* HAVE_NDBM */ +#endif /* HAVE_GDBM */ +#endif /* LDBM_USE_DBHASH */ +#endif /* LDBM_USE_DBBTREE */ int ldbm_errno( LDBM ldbm ); LDBM ldbm_open( char *name, int rw, int mode, int dbcachesize ); diff --git a/include/lthread.h b/include/lthread.h index 2a23c7791f..123b7efa87 100644 --- a/include/lthread.h +++ b/include/lthread.h @@ -5,7 +5,7 @@ #include "portable.h" -#if defined( HAVE_PTHREADS ) +#ifdef HAVE_PTHREADS /********************************** * * * definitions for POSIX Threads * @@ -51,7 +51,9 @@ LDAP_F void pthread_kill LDAP_P(( pthread_t tid, int sig )); LDAP_END_DECL -#elif defined ( HAVE_MACH_CTHREADS ) +/* Do not use #elif. K&R does not support it. */ +#else /* !HAVE_PTHREADS */ +#ifdef HAVE_MACH_CTHREADS /********************************** * * * definitions for Mach CThreads * @@ -91,7 +93,8 @@ typedef struct condition pthread_cond_t; LDAP_END_DECL -#elif defined( HAVE_THR ) +#else /* !HAVE_MACH_CTHREADS */ +#ifdef HAVE_THR /************************************** * * * thread definitions for Solaris LWP * @@ -136,7 +139,8 @@ typedef cond_t pthread_cond_t; LDAP_END_DECL -#elif defined( HAVE_LWP ) +#else /* !HAVE_THR */ +#ifdef HAVE_LWP /************************************* * * * thread definitions for SunOS LWP * @@ -185,8 +189,7 @@ typedef struct lwpcv { LDAP_END_DECL -#else - +#else /* !HAVE_LWP */ /*********************************** * * * thread definitions for no * @@ -236,5 +239,8 @@ typedef int pthread_cond_t; LDAP_END_DECL -#endif /* no threads support */ +#endif /* HAVE_LWP */ +#endif /* HAVE_THR */ +#endif /* HAVE_MACH_CTHREADS */ +#endif /* HAVE_PTHREADS */ #endif /* _LTHREAD_H */ -- 2.39.5