+/* $OpenLDAP$ */
+/*
+ * Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
#include "portable.h"
#include <stdio.h>
#include <ac/string.h>
#include <ac/unistd.h>
+#ifdef HAVE_IO_H
+#include <io.h>
+#endif
+
#include <ldap.h>
-#include <ldif.h>
+#include "ldif.h"
#include "ldap_defaults.h"
#define DEFSEP "="
static void
-usage( char *s )
+usage( const char *s )
{
fprintf( stderr,
"usage: %s [options] filter [attributes...]\nwhere:\n"
#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 );
}
filtpattern );
if ( attrs == NULL ) {
- printf( "ALL" );
+ fprintf( stderr, "ALL" );
} else {
for ( i = 0; attrs[ i ] != NULL; ++i ) {
fprintf( stderr, "%s ", attrs[ i ] );
if ( ldif ) {
if (ldif < 3 ) {
- /* TEMPORARILY put the version in a comment many tools cannot yet a version attribute */
- printf( "# version: 1\n");
+ printf( "version: 1\n\n");
}
if (ldif < 2 ) {
}
-void print_entry(
+static void
+print_entry(
LDAP *ld,
LDAPMessage *entry,
int attrsonly)
bvals[i]->bv_len );
printf( "%s%s", a, sep );
puts( notprint ? "NOT PRINTABLE" : bvals[ i ]->bv_val );
- puts( "\n" );
}
}
}
}
-int
+static int
write_ldif( int type, char *name, char *value, ber_len_t vallen )
{
char *ldif;