X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=clients%2Fgopher%2Fgo500.c;h=bbd64abefed641be2cee7a96655fae3455839391;hb=34c945b86d995d762826f90b24f51189ba1d8af3;hp=42cb5e4f6d62b93c4c8f8f332ac1accee7af00b6;hpb=d2ef362f99f3fe5d5d2bb56ce2b4a96a08dbb41d;p=openldap diff --git a/clients/gopher/go500.c b/clients/gopher/go500.c index 42cb5e4f6d..bbd64abefe 100644 --- a/clients/gopher/go500.c +++ b/clients/gopher/go500.c @@ -10,32 +10,35 @@ * is provided ``as is'' without express or implied warranty. */ +#include "portable.h" + #include -#include -#include -#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef HAVE_SYS_PARAM_H #include -#include -#include -#include -#include -#include -#include +#endif + #include -#include -#ifdef aix -#include -#endif /* aix */ -#include -#include "portable.h" + #include "ldapconfig.h" #include "lber.h" #include "ldap.h" -#include "disptmpl.h" -#ifdef USE_SYSCONF -#include -#endif /* USE_SYSCONF */ +#if LDAP_VERSION < LDAP_VERSION3 +/* quick fix until we have ldap_set_options */ +#include "../libraries/libldap/ldap-int.h" +#endif + +#include "disptmpl.h" int debug; int dosyslog; @@ -52,7 +55,7 @@ char myhost[MAXHOSTNAMELEN]; int myport; static set_socket(); -static SIG_FN wait4child(); +static RETSIGTYPE wait4child(); static do_queries(); static do_error(); static do_search(); @@ -78,7 +81,7 @@ char **argv; struct hostent *hp; struct sockaddr_in from; int fromlen; - SIG_FN wait4child(); + RETSIGTYPE wait4child(); extern char *optarg; extern char **Argv; extern int Argc; @@ -140,11 +143,13 @@ char **argv; } #endif -#ifdef USE_SYSCONF +#ifdef HAVE_SYSCONF dtblsize = sysconf( _SC_OPEN_MAX ); -#else /* USE_SYSCONF */ +#elif HAVE_GETDTABLESIZE dtblsize = getdtablesize(); -#endif /* USE_SYSCONF */ +#else + dtblsize = FD_SETSIZE; +#endif #ifdef FD_SETSIZE if (dtblsize > FD_SETSIZE) { @@ -177,7 +182,7 @@ char **argv; s = set_socket( port ); /* arrange to reap children */ - (void) signal( SIGCHLD, (void *) wait4child ); + (void) SIGNAL( SIGCHLD, wait4child ); } else { myport = GO500_PORT; @@ -299,20 +304,24 @@ int port; return( s ); } -static SIG_FN +static RETSIGTYPE wait4child() { +#ifndef HAVE_WAITPID WAITSTATUSTYPE status; +#endif if ( debug ) printf( "parent: catching child status\n" ); -#ifdef USE_WAITPID + +#ifdef HAVE_WAITPID while (waitpid ((pid_t) -1, 0, WAIT_FLAGS) > 0) -#else /* USE_WAITPID */ - while ( wait3( &status, WAIT_FLAGS, 0 ) > 0 ) -#endif /* USE_WAITPID */ - ; /* NULL */ + ; /* NULL */ +#else + while ( wait3( &status, WAIT_FLAGS, 0 ) > 0 ) + ; /* NULL */ +#endif - (void) signal( SIGCHLD, (void *) wait4child ); + (void) SIGNAL( SIGCHLD, wait4child ); } static