2 * Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
3 * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
11 #include <ac/socket.h>
12 #include <ac/string.h>
14 #include "slapcommon.h"
17 main( int argc, char **argv )
20 int rc = EXIT_SUCCESS;
22 slap_tool_init( "slapcat", SLAPCAT, argc, argv );
24 if( !be->be_entry_open &&
25 !be->be_entry_close &&
26 !be->be_entry_first &&
30 fprintf( stderr, "%s: database doesn't support necessary operations.\n",
35 if( be->be_entry_open( be, 0 ) != 0 ) {
36 fprintf( stderr, "%s: could not open database.\n",
41 for ( id = be->be_entry_first( be );
43 id = be->be_entry_next( be ) )
47 Entry* e = be->be_entry_get( be, id );
50 printf( "# id=%08lx\n", (long) id );
54 printf("# no data for entry id=%08lx\n\n", (long) id );
56 if( continuemode ) continue;
60 data = entry2str( e, &len );
64 printf("# bad data for entry id=%08lx\n\n", (long) id );
66 if( continuemode ) continue;
70 fputs( data, ldiffp );
71 fputs( "\n", ldiffp );
74 be->be_entry_close( be );