3 * Copyright 1998-2003 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;
24 slap_tool_init( "slapcat", SLAPCAT, argc, argv );
26 if( !be->be_entry_open ||
27 !be->be_entry_close ||
28 !be->be_entry_first ||
32 fprintf( stderr, "%s: database doesn't support necessary operations.\n",
37 if( be->be_entry_open( be, 0 ) != 0 ) {
38 fprintf( stderr, "%s: could not open database.\n",
43 for ( id = be->be_entry_first( be );
45 id = be->be_entry_next( be ) )
49 Entry* e = be->be_entry_get( be, id );
52 printf( "# id=%08lx\n", (long) id );
56 printf("# no data for entry id=%08lx\n\n", (long) id );
58 if( continuemode ) continue;
62 data = entry2str( e, &len );
64 be_entry_release_r( &op, e );
67 printf("# bad data for entry id=%08lx\n\n", (long) id );
69 if( continuemode ) continue;
73 fputs( data, ldiffp );
74 fputs( "\n", ldiffp );
77 be->be_entry_close( be );