]> git.sur5r.net Git - openldap/blobdiff - clients/gopher/go500.c
merged with autoconf branch
[openldap] / clients / gopher / go500.c
index 42cb5e4f6d62b93c4c8f8f332ac1accee7af00b6..6a8a70c5281ace4afcf7036b437e666d76073958 100644 (file)
  * is provided ``as is'' without express or implied warranty.
  */
 
+#include "portable.h"
+
 #include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-#include <sys/types.h>
+
+#include <ac/ctype.h>
+#include <ac/signal.h>
+#include <ac/socket.h>
+#include <ac/string.h>
+#include <ac/syslog.h>
+#include <ac/time.h>
+#include <ac/unistd.h>
+#include <ac/wait.h>
+
+#ifdef HAVE_SYS_PARAM_H
 #include <sys/param.h>
-#include <sys/time.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <netdb.h>
-#include <syslog.h>
+#endif
+
 #include <sys/resource.h>
-#include <sys/wait.h>
-#ifdef aix
-#include <sys/select.h>
-#endif /* aix */
-#include <signal.h>
-#include "portable.h"
+
 #include "ldapconfig.h"
 #include "lber.h"
 #include "ldap.h"
 #include "disptmpl.h"
 
-#ifdef USE_SYSCONF
-#include <unistd.h>
-#endif /* USE_SYSCONF */
-
 int    debug;
 int    dosyslog;
 int    inetd;
@@ -52,7 +49,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 +75,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 +137,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 +176,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 +298,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