}
while( ldif_read_record( ldiffp, &lineno, &buf, &lmax ) ) {
- ID id;
Entry *e = str2entry( buf );
struct berval bvtext = { textlen, textbuf };
}
}
- id = be->be_entry_put( be, e, &bvtext );
- if( id == NOID ) {
- fprintf( stderr, "%s: could not add entry dn=\"%s\" (line=%d): %s\n",
- progname, e->e_dn, lineno, bvtext.bv_val );
- rc = EXIT_FAILURE;
- entry_free( e );
- if( continuemode ) continue;
- break;
-
- }
+ if (!dryrun) {
+ ID id = be->be_entry_put( be, e, &bvtext );
+ if( id == NOID ) {
+ fprintf( stderr, "%s: could not add entry dn=\"%s\" (line=%d): %s\n",
+ progname, e->e_dn, lineno, bvtext.bv_val );
+ rc = EXIT_FAILURE;
+ entry_free( e );
+ if( continuemode ) continue;
+ break;
+ }
- if ( verbose ) {
- fprintf( stderr, "added: \"%s\" (%08lx)\n",
- e->e_dn, (long) id );
+ if ( verbose ) {
+ fprintf( stderr, "added: \"%s\" (%08lx)\n",
+ e->e_dn, (long) id );
+ }
+ } else {
+ if ( verbose ) {
+ fprintf( stderr, "(dry) added: \"%s\"\n", e->e_dn );
+ }
}
entry_free( e );
int verbose = 0;
int continuemode = 0;
int nosubordinates = 0;
+int dryrun = 0;
char *ldiffile = NULL;
FILE *ldiffp = NULL;
switch( tool ) {
case SLAPADD:
- options = "b:cd:f:l:n:tv";
+ options = "b:cd:f:l:n:tuv";
break;
case SLAPINDEX:
mode |= SLAP_TRUNCATE_MODE;
break;
+ case 'u': /* dry run */
+ dryrun++;
+ break;
+
case 'v': /* turn on verbose */
verbose++;
break;