]> git.sur5r.net Git - openldap/blobdiff - libraries/libldap/test.c
Improved ldap_int_strtok. If strtok_r does not exists, it will be worked
[openldap] / libraries / libldap / test.c
index d37556a5cfb2a82d0f5a869d3f4133bd64afe359..7e3770f53826bf72be15fe360dd4fe62cb605490 100644 (file)
@@ -1,3 +1,8 @@
+/*
+ * Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+
 #include "portable.h"
 
 #include <stdio.h>
@@ -8,7 +13,6 @@
 #include <ac/string.h>
 #include <ac/time.h>
 #include <ac/unistd.h>
-extern char *strdup (const char *);
 
 #include <sys/stat.h>
 
@@ -79,7 +83,7 @@ get_list( char *prompt )
                        result = (char **) realloc( result,
                            sizeof(char *) * (num + 1) );
 
-               result[num++] = (char *) strdup( buf );
+               result[num++] = (char *) ldap_strdup( buf );
        }
        if ( result == (char **) 0 )
                return( NULL );
@@ -173,7 +177,7 @@ get_modlist( char *prompt1, char *prompt2, char *prompt3 )
                getline( buf, sizeof(buf), stdin, prompt2 );
                if ( buf[0] == '\0' )
                        break;
-               tmp.mod_type = strdup( buf );
+               tmp.mod_type = ldap_strdup( buf );
 
                tmp.mod_values = get_list( prompt3 );
 
@@ -278,9 +282,6 @@ main( int argc, char **argv )
        int             copyoptions = 0;
        LDAPURLDesc     *ludp;
 
-       extern char     *optarg;
-       extern int      optind;
-
        host = NULL;
        port = LDAP_PORT;
        dnsuffix = "";
@@ -299,9 +300,11 @@ main( int argc, char **argv )
                case 'd':
 #ifdef LDAP_DEBUG
                        ldap_debug = atoi( optarg );
+#ifdef LBER_DEBUG
                        if ( ldap_debug & LDAP_DEBUG_PACKETS ) {
                                lber_debug = ldap_debug;
                        }
+#endif
 #else
                        printf( "Compile with -DLDAP_DEBUG for debugging\n" );
 #endif
@@ -320,12 +323,12 @@ main( int argc, char **argv )
                        break;
 
                case 't':       /* copy ber's to given file */
-                       copyfname = strdup( optarg );
+                       copyfname = ldap_strdup( optarg );
                        copyoptions = LBER_TO_FILE;
                        break;
 
                case 'T':       /* only output ber's to given file */
-                       copyfname = strdup( optarg );
+                       copyfname = ldap_strdup( optarg );
                        copyoptions = (LBER_TO_FILE | LBER_TO_FILE_ONLY);
                        break;
 
@@ -481,9 +484,11 @@ main( int argc, char **argv )
 #ifdef LDAP_DEBUG
                        getline( line, sizeof(line), stdin, "debug level? " );
                        ldap_debug = atoi( line );
+#ifdef LBER_DEBUG
                        if ( ldap_debug & LDAP_DEBUG_PACKETS ) {
                                lber_debug = ldap_debug;
                        }
+#endif
 #else
                        printf( "Compile with -DLDAP_DEBUG for debugging\n" );
 #endif