X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=servers%2Fslapd%2Ftools%2Fldif2index.c;h=60688763beffb19e65857f0586fd35fff136d632;hb=ca7dba5182ff8fed583078d54623fc8689516d54;hp=18f497f48f607f7a70570070e35c39a3226817a0;hpb=82b94e2258a4ee7dbd21155418b34f0596c18611;p=openldap diff --git a/servers/slapd/tools/ldif2index.c b/servers/slapd/tools/ldif2index.c index 18f497f48f..60688763be 100644 --- a/servers/slapd/tools/ldif2index.c +++ b/servers/slapd/tools/ldif2index.c @@ -26,9 +26,7 @@ usage( char *name ) int main( int argc, char **argv ) { - int i, cargc, indb, stop; - char *cargv[MAXARGS]; - char *defargv[MAXARGS]; + int i, stop; char *tailorfile, *inputfile; char *linep, *buf, *attr; char line[BUFSIZ]; @@ -41,6 +39,8 @@ main( int argc, char **argv ) struct berval bv; struct berval *vals[2]; + ldbm_ignore_nextid_file = 1; + inputfile = NULL; tailorfile = SLAPD_DEFAULT_CONFIGFILE; dbnum = -1; @@ -77,8 +77,8 @@ main( int argc, char **argv ) } } - init(); - read_config( tailorfile, &be, NULL ); + slap_init(SLAP_TOOL_MODE, ch_strdup(argv[0])); + read_config( tailorfile ); if ( dbnum == -1 ) { for ( dbnum = 0; dbnum < nbackends; dbnum++ ) { @@ -99,6 +99,9 @@ main( int argc, char **argv ) fprintf( stderr, "Database number %d selected via -n is not an ldbm database\n", dbnum ); exit( 1 ); } + + slap_startup(dbnum); + be = &backends[dbnum]; /* disable write sync'ing */ @@ -137,7 +140,7 @@ main( int argc, char **argv ) } if ( line[0] == '\n' || stop && buf && *buf ) { if ( *buf != '\n' ) { - if (isdigit(*buf)) { + if (isdigit((unsigned char) *buf)) { id = atol(buf); } else { id++; @@ -166,7 +169,9 @@ main( int argc, char **argv ) lcur = 0; } } - (*be->be_close)( be ); - exit( 0 ); + slap_shutdown(dbnum); + slap_destroy(); + + return( 0 ); }