]> git.sur5r.net Git - openldap/blobdiff - clients/gopher/go500gw.c
s/exit(1)/exit(EXIT_FAILURE)/
[openldap] / clients / gopher / go500gw.c
index 4ee45391c706b63a5a989085e31ef3057e82ac58..c68b3522ef6344b56bfa0d4a158a055a4f1262e2 100644 (file)
 #endif
 
 
-#include "lber.h"
-#include "ldap.h"
+#include <ldap.h>
+#include <disptmpl.h>
 
 #define ldap_debug debug
 #include "ldap_log.h"
 
 #include "lutil.h"
 
-#include "disptmpl.h"
 
 #include "ldap_defaults.h"
 
@@ -88,7 +87,7 @@ static void
 usage( char *name )
 {
        fprintf( stderr, "usage: %s [-d debuglevel] [-I] [-p port] [-P ldapport] [-l]\r\n\t[-x ldaphost] [-a] [-h helpfile] [-f filterfile] [-t templatefile] [-c rdncount]\r\n", name );
-       exit( 1 );
+       exit( EXIT_FAILURE );
 }
 
 int
@@ -182,7 +181,7 @@ main (int  argc, char **argv )
        if ( myhost[0] == '\0' && gethostname( myhost, sizeof(myhost) )
            == -1 ) {
                perror( "gethostname" );
-               exit( 1 );
+               exit( EXIT_FAILURE );
        }
 #endif
 
@@ -248,7 +247,7 @@ main (int  argc, char **argv )
 
                tcp_close( 0 );
 
-               exit( 0 );
+               exit( EXIT_SUCCESS );
        }
 
        for ( ;; ) {
@@ -269,7 +268,7 @@ main (int  argc, char **argv )
                if ( (ns = accept( s, (struct sockaddr *) &from, &fromlen ))
                    == -1 ) {
                        if ( debug ) perror( "accept" );
-                       exit( 1 );
+                       exit( EXIT_FAILURE );
                }
 
                hp = gethostbyaddr( (char *) &(from.sin_addr.s_addr),
@@ -313,7 +312,7 @@ set_socket( int port )
 
        if ( (s = socket( AF_INET, SOCK_STREAM, 0 )) == -1 ) {
                 perror( "socket" );
-                exit( 1 );
+                exit( EXIT_FAILURE );
         }
 
         /* set option so clients can't keep us from coming back up */
@@ -321,7 +320,7 @@ set_socket( int port )
         if ( setsockopt( s, SOL_SOCKET, SO_REUSEADDR, (char *) &one,
            sizeof(one) ) < 0 ) {
                 perror( "setsockopt" );
-                exit( 1 );
+                exit( EXIT_FAILURE );
         }
 
         /* bind to a name */
@@ -330,13 +329,13 @@ set_socket( int port )
         addr.sin_port = htons( port );
         if ( bind( s, (struct sockaddr *) &addr, sizeof(addr) ) ) {
                 perror( "bind" );
-                exit( 1 );
+                exit( EXIT_FAILURE );
         }
 
        /* listen for connections */
         if ( listen( s, 5 ) == -1 ) {
                 perror( "listen" );
-                exit( 1 );
+                exit( EXIT_FAILURE );
         }
 
         if ( debug )
@@ -379,7 +378,7 @@ do_queries( int s )
 
        if ( (fp = fdopen( s, "a+")) == NULL ) {
                perror( "fdopen" );
-               exit( 1 );
+               exit( EXIT_FAILURE );
        }
 
        timeout.tv_sec = GO500GW_TIMEOUT;
@@ -388,10 +387,10 @@ do_queries( int s )
        FD_SET( fileno( fp ), &readfds );
 
        if ( (rc = select( dtblsize, &readfds, 0, 0, &timeout )) <= 0 )
-               exit( 1 );
+               exit( EXIT_FAILURE );
 
        if ( fgets( buf, sizeof(buf), fp ) == NULL )
-               exit( 1 );
+               exit( EXIT_FAILURE );
 
        len = strlen( buf );
        if ( debug ) {
@@ -437,7 +436,7 @@ do_queries( int s )
                fprintf( fp, ".\r\n" );
                rewind(fp);
 
-               exit( 0 );
+               exit( EXIT_SUCCESS );
                /* NOT REACHED */
        }
 
@@ -447,7 +446,7 @@ do_queries( int s )
                    LDAP_SERVER_DOWN, myhost, myport );
                fprintf( fp, ".\r\n" );
                rewind(fp);
-               exit( 1 );
+               exit( EXIT_FAILURE );
        }
 
        deref = LDAP_DEREF_ALWAYS;
@@ -463,7 +462,7 @@ do_queries( int s )
                    rc, myhost, myport );
                fprintf( fp, ".\r\n" );
                rewind(fp);
-               exit( 1 );
+               exit( EXIT_FAILURE );
        }
 
        switch ( *query++ ) {
@@ -487,7 +486,7 @@ do_queries( int s )
        fprintf( fp, ".\r\n" );
        rewind(fp);
 
-       exit( 0 );
+       exit( EXIT_SUCCESS );
        /* NOT REACHED */
 }
 
@@ -729,7 +728,7 @@ do_search( LDAP *ld, FILE *fp, char *query )
 
        if ( (filter = strchr( query, '\t' )) == NULL ) {
                fprintf( fp, "3Missing filter!\r\n" );
-               exit( 1 );
+               exit( EXIT_FAILURE );
        }
        *filter++ = '\0';
        base = query;
@@ -757,7 +756,7 @@ do_search( LDAP *ld, FILE *fp, char *query )
 #endif
                if ( (scope = make_scope( ld, base )) == -1 ) {
                        fprintf( fp, "3Bad scope\r\n" );
-                       exit( 1 );
+                       exit( EXIT_FAILURE );
                }
 
                filtertype = (scope == LDAP_SCOPE_ONELEVEL ?
@@ -771,7 +770,7 @@ do_search( LDAP *ld, FILE *fp, char *query )
                if ( (filtd = ldap_init_getfilter( filterfile )) == NULL ) {
                        fprintf( stderr, "Cannot open filter file (%s)\n",
                            filterfile );
-                       exit( 1 );
+                       exit( EXIT_FAILURE );
                }
 
                count = 0;