]> git.sur5r.net Git - openldap/blobdiff - libraries/libldap/test.c
Changes for URI spport: New routines ldap_initialize and ldap_create; LDAPURLDesc...
[openldap] / libraries / libldap / test.c
index dc52cd1f6b68a7ab08c98567379136e089538171..d52859042b85d5ae88243885531cbc12a712c52a 100644 (file)
@@ -1,3 +1,4 @@
+/* $OpenLDAP$ */
 /*
  * Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
@@ -301,7 +302,7 @@ main( int argc, char **argv )
                        ldap_debug = atoi( optarg );
 #ifdef LBER_DEBUG
                        if ( ldap_debug & LDAP_DEBUG_PACKETS ) {
-                               lber_debug = ldap_debug;
+                               ber_set_option( NULL, LBER_OPT_DEBUG_LEVEL, &ldap_debug );
                        }
 #endif
 #else
@@ -343,7 +344,7 @@ main( int argc, char **argv )
 
        if ( errflg || optind < argc - 1 ) {
                fprintf( stderr, usage, argv[ 0 ] );
-               exit( 1 );
+               exit( EXIT_FAILURE );
        }
        
        printf( "%s( %s, %d )\n",
@@ -360,14 +361,14 @@ main( int argc, char **argv )
 
        if ( ld == NULL ) {
                perror( cldapflg ? "cldap_open" : "ldap_init" );
-               exit(1);
+               exit( EXIT_FAILURE );
        }
 
        if ( copyfname != NULL ) {
                if ( (ld->ld_sb.sb_fd = open( copyfname, O_WRONLY | O_CREAT,
                    0600 ))  == -1 ) {
                        perror( copyfname );
-                       exit ( 1 );
+                       exit ( EXIT_FAILURE );
                }
                ld->ld_sb.sb_options = copyoptions;
        }
@@ -486,7 +487,7 @@ main( int argc, char **argv )
                        ldap_debug = atoi( line );
 #ifdef LBER_DEBUG
                        if ( ldap_debug & LDAP_DEBUG_PACKETS ) {
-                               lber_debug = ldap_debug;
+                               ber_set_option( NULL, LBER_OPT_DEBUG_LEVEL, &ldap_debug );
                        }
 #endif
 #else
@@ -549,7 +550,7 @@ main( int argc, char **argv )
                        if ( !cldapflg ) {
                                ldap_unbind( ld );
                        }
-                       exit( 0 );
+                       exit( EXIT_SUCCESS );
                        break;
 
                case 'r':       /* result or remove */
@@ -889,7 +890,8 @@ handle_result( LDAP *ld, LDAPMessage *lm )
                break;
 
        default:
-               printf( "Unknown result type 0x%x\n", lm->lm_msgtype );
+               printf( "Unknown result type 0x%lx\n",
+                       (unsigned long) lm->lm_msgtype );
                print_ldap_result( ld, lm, "unknown" );
        }
 }
@@ -954,7 +956,7 @@ print_search_entry( LDAP *ld, LDAPMessage *res )
                                        if ( nonascii ) {
                                                printf( "\t\t\tlength (%ld) (not ascii)\n", vals[i]->bv_len );
 #ifdef BPRINT_NONASCII
-                                               lber_bprint( vals[i]->bv_val,
+                                               ber_bprint( vals[i]->bv_val,
                                                    vals[i]->bv_len );
 #endif /* BPRINT_NONASCII */
                                                continue;