3 * Copyright 1998-2000 The OpenLDAP Foundation, All Rights Reserved.
4 * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
10 #include <ac/stdlib.h>
12 #include <ac/socket.h>
13 #include <ac/string.h>
15 #include "slapcommon.h"
18 main( int argc, char **argv )
21 int rc = EXIT_SUCCESS;
23 slap_tool_init( "slapcat", SLAPCAT, argc, argv );
25 if( !be->be_entry_open ||
26 !be->be_entry_close ||
27 !be->be_entry_first ||
31 fprintf( stderr, "%s: database doesn't support necessary operations.\n",
36 if( be->be_entry_open( be, 0 ) != 0 ) {
37 fprintf( stderr, "%s: could not open database.\n",
42 for ( id = be->be_entry_first( be );
44 id = be->be_entry_next( be ) )
48 Entry* e = be->be_entry_get( be, id );
51 printf( "# id=%08lx\n", (long) id );
55 printf("# no data for entry id=%08lx\n\n", (long) id );
57 if( continuemode ) continue;
61 data = entry2str( e, &len );
65 printf("# bad data for entry id=%08lx\n\n", (long) id );
67 if( continuemode ) continue;
71 fputs( data, ldiffp );
72 fputs( "\n", ldiffp );
75 be->be_entry_close( be );