3 * Copyright 1998-2000 The OpenLDAP Foundation, All Rights Reserved.
4 * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
10 #include <ac/stdlib.h>
13 #include <ac/string.h>
14 #include <ac/socket.h>
15 #include <ac/unistd.h>
17 #include "slapcommon.h"
20 main( int argc, char **argv )
23 AttributeDescription *desc;
26 int rc = EXIT_SUCCESS;
28 slap_tool_init( "slapindex", SLAPINDEX, argc, argv );
30 if( !be->be_entry_open &&
31 !be->be_entry_close &&
32 !be->be_entry_first &&
34 !be->be_entry_reindex )
36 fprintf( stderr, "%s: database doesn't support necessary operations.\n",
41 type = argv[argc - 1];
43 rc = slap_str2ad( type, &desc, &text );
45 if( rc != LDAP_SUCCESS ) {
46 fprintf( stderr, "%s: unrecognized attribute type: %s\n",
51 if( be->be_entry_open( be, 0 ) != 0 ) {
52 fprintf( stderr, "%s: could not open database.\n",
57 for ( id = be->be_entry_first( be );
59 id = be->be_entry_next( be ) )
64 printf("indexing id=%08lx\n", (long) id );
67 rtn = be->be_entry_reindex( be, id );
69 if( rtn != LDAP_SUCCESS ) {
71 if( continuemode ) continue;
76 (void) be->be_entry_close( be );