Full_Name: Xin LI Version: -HEAD OS: FreeBSD/amd64 URL: http://people.freebsd.org/~delphij/misc/openldap-elif.diff Submission from: (NULL) (206.40.55.65)
OpenLDAP uses several #elif to test if a macro is being defined, which should be spelled as #elif defined.
Here is a patch against CVS -HEAD.
Index: include/ac/regex.h =================================================================== RCS file: /repo/OpenLDAP/pkg/ldap/include/ac/regex.h,v retrieving revision 1.20 diff -u -p -u -p -r1.20 regex.h --- include/ac/regex.h 21 Jan 2009 23:40:18 -0000 1.20 +++ include/ac/regex.h 1 Mar 2010 20:12:52 -0000 @@ -28,7 +28,7 @@ */ #error "No POSIX REGEX available."
-#elif HAVE_GNUREGEX_H +#elif defined(HAVE_GNUREGEX_H) /* system has GNU gnuregex.h */ # include <gnuregex.h> #else Index: include/ac/signal.h =================================================================== RCS file: /repo/OpenLDAP/pkg/ldap/include/ac/signal.h,v retrieving revision 1.28 diff -u -p -u -p -r1.28 signal.h --- include/ac/signal.h 21 Jan 2009 23:40:18 -0000 1.28 +++ include/ac/signal.h 1 Mar 2010 20:12:52 -0000 @@ -72,7 +72,7 @@ LDAP_LUTIL_F(lutil_sig_t) lutil_sigactio #ifndef LDAP_SIGCHLD #ifdef SIGCHLD #define LDAP_SIGCHLD SIGCHLD -#elif SIGCLD +#elif defined(SIGCLD) #define LDAP_SIGCHLD SIGCLD #endif #endif Index: include/ac/socket.h =================================================================== RCS file: /repo/OpenLDAP/pkg/ldap/include/ac/socket.h,v retrieving revision 1.77 diff -u -p -u -p -r1.77 socket.h --- include/ac/socket.h 23 Oct 2009 10:29:50 -0000 1.77 +++ include/ac/socket.h 1 Mar 2010 20:12:52 -0000 @@ -62,7 +62,7 @@
#ifdef HAVE_WINSOCK2 #include <winsock2.h> -#elif HAVE_WINSOCK +#elif defined(HAVE_WINSOCK) #include <winsock.h> #endif
@@ -110,12 +110,12 @@
LBER_F( char * ) ber_pvt_wsa_err2string LDAP_P((int));
-#elif MACOS +#elif defined(MACOS) # define tcp_close( s ) tcpclose( s ) # define tcp_read( s, buf, len ) tcpread( s, buf, len ) # define tcp_write( s, buf, len ) tcpwrite( s, buf, len )
-#elif DOS +#elif defined(DOS) # ifdef PCNFS # define tcp_close( s ) close( s ) # define tcp_read( s, buf, len ) recv( s, buf, len, 0 ) Index: libraries/liblber/nt_err.c =================================================================== RCS file: /repo/OpenLDAP/pkg/ldap/libraries/liblber/nt_err.c,v retrieving revision 1.18 diff -u -p -u -p -r1.18 nt_err.c --- libraries/liblber/nt_err.c 21 Jan 2009 23:40:19 -0000 1.18 +++ libraries/liblber/nt_err.c 1 Mar 2010 20:12:52 -0000 @@ -17,7 +17,7 @@
#ifdef HAVE_WINSOCK2 #include <winsock2.h> -#elif HAVE_WINSOCK +#elif defined(HAVE_WINSOCK) #include <winsock.h> #endif /* HAVE_WINSOCK(2) */
Index: libraries/libldap/init.c =================================================================== RCS file: /repo/OpenLDAP/pkg/ldap/libraries/libldap/init.c,v retrieving revision 1.123 diff -u -p -u -p -r1.123 init.c --- libraries/libldap/init.c 15 Nov 2009 20:48:49 -0000 1.123 +++ libraries/libldap/init.c 1 Mar 2010 20:12:52 -0000 @@ -616,7 +616,7 @@ void ldap_int_initialize( struct ldapopt return; } } /* The WinSock DLL is acceptable. Proceed. */ -#elif HAVE_WINSOCK +#elif defined(HAVE_WINSOCK) { WSADATA wsaData; if ( WSAStartup( 0x0101, &wsaData ) != 0 ) { return; Index: libraries/liblutil/detach.c =================================================================== RCS file: /repo/OpenLDAP/pkg/ldap/libraries/liblutil/detach.c,v retrieving revision 1.22 diff -u -p -u -p -r1.22 detach.c --- libraries/liblutil/detach.c 21 Jan 2009 23:40:23 -0000 1.22 +++ libraries/liblutil/detach.c 1 Mar 2010 20:12:52 -0000 @@ -128,7 +128,7 @@ lutil_detach( int debug, int do_close )
#ifdef HAVE_SETSID (void) setsid(); -#elif TIOCNOTTY +#elif defined(TIOCNOTTY) if ( (sd = open( "/dev/tty", O_RDWR )) != -1 ) { (void) ioctl( sd, TIOCNOTTY, NULL ); (void) close( sd ); Index: libraries/liblutil/entropy.c =================================================================== RCS file: /repo/OpenLDAP/pkg/ldap/libraries/liblutil/entropy.c,v retrieving revision 1.32 diff -u -p -u -p -r1.32 entropy.c --- libraries/liblutil/entropy.c 21 Jan 2009 23:40:23 -0000 1.32 +++ libraries/liblutil/entropy.c 1 Mar 2010 20:12:52 -0000 @@ -73,7 +73,7 @@ int lutil_entropy( unsigned char *buf, b close(fd); return nbytes > 0 ? -1 : 0; } -#elif PROV_RSA_FULL +#elif defined(PROV_RSA_FULL) { /* Not used since _WIN32_WINNT not set... */ HCRYPTPROV hProv = 0; [delphij@delta] ~/scratch/oo/ldap-src> cvs -qR diff -uNp > ~/openldap-elif.diff [delphij@delta] ~/scratch/oo/ldap-src> cat ~/open openldap-elif.diff openvpn.conf [delphij@delta] ~/scratch/oo/ldap-src> cat ~/openldap-elif.diff Index: include/ac/regex.h =================================================================== RCS file: /repo/OpenLDAP/pkg/ldap/include/ac/regex.h,v retrieving revision 1.20 diff -u -p -u -p -r1.20 regex.h --- include/ac/regex.h 21 Jan 2009 23:40:18 -0000 1.20 +++ include/ac/regex.h 1 Mar 2010 20:13:03 -0000 @@ -28,7 +28,7 @@ */ #error "No POSIX REGEX available."
-#elif HAVE_GNUREGEX_H +#elif defined(HAVE_GNUREGEX_H) /* system has GNU gnuregex.h */ # include <gnuregex.h> #else Index: include/ac/signal.h =================================================================== RCS file: /repo/OpenLDAP/pkg/ldap/include/ac/signal.h,v retrieving revision 1.28 diff -u -p -u -p -r1.28 signal.h --- include/ac/signal.h 21 Jan 2009 23:40:18 -0000 1.28 +++ include/ac/signal.h 1 Mar 2010 20:13:03 -0000 @@ -72,7 +72,7 @@ LDAP_LUTIL_F(lutil_sig_t) lutil_sigactio #ifndef LDAP_SIGCHLD #ifdef SIGCHLD #define LDAP_SIGCHLD SIGCHLD -#elif SIGCLD +#elif defined(SIGCLD) #define LDAP_SIGCHLD SIGCLD #endif #endif Index: include/ac/socket.h =================================================================== RCS file: /repo/OpenLDAP/pkg/ldap/include/ac/socket.h,v retrieving revision 1.77 diff -u -p -u -p -r1.77 socket.h --- include/ac/socket.h 23 Oct 2009 10:29:50 -0000 1.77 +++ include/ac/socket.h 1 Mar 2010 20:13:03 -0000 @@ -62,7 +62,7 @@
#ifdef HAVE_WINSOCK2 #include <winsock2.h> -#elif HAVE_WINSOCK +#elif defined(HAVE_WINSOCK) #include <winsock.h> #endif
@@ -110,12 +110,12 @@
LBER_F( char * ) ber_pvt_wsa_err2string LDAP_P((int));
-#elif MACOS +#elif defined(MACOS) # define tcp_close( s ) tcpclose( s ) # define tcp_read( s, buf, len ) tcpread( s, buf, len ) # define tcp_write( s, buf, len ) tcpwrite( s, buf, len )
-#elif DOS +#elif defined(DOS) # ifdef PCNFS # define tcp_close( s ) close( s ) # define tcp_read( s, buf, len ) recv( s, buf, len, 0 ) Index: libraries/liblber/nt_err.c =================================================================== RCS file: /repo/OpenLDAP/pkg/ldap/libraries/liblber/nt_err.c,v retrieving revision 1.18 diff -u -p -u -p -r1.18 nt_err.c --- libraries/liblber/nt_err.c 21 Jan 2009 23:40:19 -0000 1.18 +++ libraries/liblber/nt_err.c 1 Mar 2010 20:13:03 -0000 @@ -17,7 +17,7 @@
#ifdef HAVE_WINSOCK2 #include <winsock2.h> -#elif HAVE_WINSOCK +#elif defined(HAVE_WINSOCK) #include <winsock.h> #endif /* HAVE_WINSOCK(2) */
Index: libraries/libldap/init.c =================================================================== RCS file: /repo/OpenLDAP/pkg/ldap/libraries/libldap/init.c,v retrieving revision 1.123 diff -u -p -u -p -r1.123 init.c --- libraries/libldap/init.c 15 Nov 2009 20:48:49 -0000 1.123 +++ libraries/libldap/init.c 1 Mar 2010 20:13:03 -0000 @@ -616,7 +616,7 @@ void ldap_int_initialize( struct ldapopt return; } } /* The WinSock DLL is acceptable. Proceed. */ -#elif HAVE_WINSOCK +#elif defined(HAVE_WINSOCK) { WSADATA wsaData; if ( WSAStartup( 0x0101, &wsaData ) != 0 ) { return; Index: libraries/liblutil/detach.c =================================================================== RCS file: /repo/OpenLDAP/pkg/ldap/libraries/liblutil/detach.c,v retrieving revision 1.22 diff -u -p -u -p -r1.22 detach.c --- libraries/liblutil/detach.c 21 Jan 2009 23:40:23 -0000 1.22 +++ libraries/liblutil/detach.c 1 Mar 2010 20:13:03 -0000 @@ -128,7 +128,7 @@ lutil_detach( int debug, int do_close )
#ifdef HAVE_SETSID (void) setsid(); -#elif TIOCNOTTY +#elif defined(TIOCNOTTY) if ( (sd = open( "/dev/tty", O_RDWR )) != -1 ) { (void) ioctl( sd, TIOCNOTTY, NULL ); (void) close( sd ); Index: libraries/liblutil/entropy.c =================================================================== RCS file: /repo/OpenLDAP/pkg/ldap/libraries/liblutil/entropy.c,v retrieving revision 1.32 diff -u -p -u -p -r1.32 entropy.c --- libraries/liblutil/entropy.c 21 Jan 2009 23:40:23 -0000 1.32 +++ libraries/liblutil/entropy.c 1 Mar 2010 20:13:03 -0000 @@ -73,7 +73,7 @@ int lutil_entropy( unsigned char *buf, b close(fd); return nbytes > 0 ? -1 : 0; } -#elif PROV_RSA_FULL +#elif defined(PROV_RSA_FULL) { /* Not used since _WIN32_WINNT not set... */ HCRYPTPROV hProv = 0;