2 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
4 * Copyright 1998-2004 The OpenLDAP Foundation.
5 * Portions Copyright 1998-2003 Kurt D. Zeilenga.
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted only as authorized by the OpenLDAP
12 * A copy of this license is available in file LICENSE in the
13 * top-level directory of the distribution or, alternatively, at
14 * <http://www.OpenLDAP.org/license.html>.
17 * This work was initially developed by Kurt Zeilenga for inclusion
18 * in OpenLDAP Software.
25 #include <ac/stdlib.h>
28 #include <ac/string.h>
29 #include <ac/socket.h>
30 #include <ac/unistd.h>
32 #include "slapcommon.h"
35 slapindex( int argc, char **argv )
38 int rc = EXIT_SUCCESS;
39 const char *progname = "slapindex";
41 slap_tool_init( progname, SLAPINDEX, argc, argv );
43 if( !be->be_entry_open ||
44 !be->be_entry_close ||
45 !be->be_entry_first ||
47 !be->be_entry_reindex )
49 fprintf( stderr, "%s: database doesn't support necessary operations.\n",
54 if( be->be_entry_open( be, 0 ) != 0 ) {
55 fprintf( stderr, "%s: could not open database.\n",
60 for ( id = be->be_entry_first( be );
62 id = be->be_entry_next( be ) )
67 printf("indexing id=%08lx\n", (long) id );
70 rtn = be->be_entry_reindex( be, id );
72 if( rtn != LDAP_SUCCESS ) {
74 if( continuemode ) continue;
79 (void) be->be_entry_close( be );