]> git.sur5r.net Git - openldap/blobdiff - clients/tools/ldapsearch.c
Update for new password codes for MSVC5
[openldap] / clients / tools / ldapsearch.c
index 0476b198f8ab5f0bba4dc415e54d2fd53203d0be..6a66a80ad16f96c7e421d2075dcdb92317580252 100644 (file)
@@ -1,3 +1,8 @@
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
 #include "portable.h"
 
 #include <stdio.h>
@@ -9,6 +14,10 @@
 #include <ac/string.h>
 #include <ac/unistd.h>
 
+#ifdef HAVE_IO_H
+#include <io.h>
+#endif
+
 #include <ldap.h>
 
 #include "ldif.h"
@@ -17,7 +26,7 @@
 #define DEFSEP         "="
 
 static void
-usage( char *s )
+usage( const char *s )
 {
        fprintf( stderr,
 "usage: %s [options] filter [attributes...]\nwhere:\n"
@@ -335,7 +344,8 @@ main( int argc, char **argv )
 #endif
 
        if ( verbose ) {
-               fprintf( stderr, "ldap_init( %s, %d )\n",
+               fprintf( stderr,
+                       (ldapport ? "ldap_init( %s, %d )\n" : "ldap_init( %s, <DEFAULT> )\n"),
                        (ldaphost != NULL) ? ldaphost : "<DEFAULT>",
                        ldapport );
        }
@@ -411,7 +421,7 @@ main( int argc, char **argv )
                        filtpattern );
 
                if ( attrs == NULL ) {
-                       printf( "ALL" );
+                       fprintf( stderr, "ALL" );
                } else {
                        for ( i = 0; attrs[ i ] != NULL; ++i ) {
                                fprintf( stderr, "%s ", attrs[ i ] );
@@ -422,7 +432,6 @@ main( int argc, char **argv )
 
        if ( ldif ) {
                if (ldif < 3 ) {
-                       /* TEMPORARILY put the version in a comment many tools cannot yet a version attribute  */
                        printf( "version: 1\n\n");
                }
 
@@ -557,7 +566,8 @@ static int dosearch(
 }
 
 
-void print_entry(
+static void
+print_entry(
        LDAP    *ld,
        LDAPMessage     *entry,
        int             attrsonly)
@@ -662,7 +672,6 @@ void print_entry(
                                                                bvals[i]->bv_len ); 
                                                printf( "%s%s", a, sep );
                                                puts( notprint ? "NOT PRINTABLE" : bvals[ i ]->bv_val );
-                                               puts( "\n" );
                                        }
                                }
                        }
@@ -676,7 +685,7 @@ void print_entry(
 }
 
 
-int
+static int
 write_ldif( int type, char *name, char *value, ber_len_t vallen )
 {
        char    *ldif;