From 34f4f38acc8530dfd80315cdd15772365e841be5 Mon Sep 17 00:00:00 2001 From: Pierangelo Masarati Date: Tue, 7 Sep 2010 05:45:36 +0000 Subject: [PATCH] cleanup option parsing --- servers/slapd/slapcommon.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/servers/slapd/slapcommon.c b/servers/slapd/slapcommon.c index 1c3c489dd6..a043764ada 100644 --- a/servers/slapd/slapcommon.c +++ b/servers/slapd/slapcommon.c @@ -108,7 +108,7 @@ usage( int tool, const char *progname ) } static int -parse_slapopt( void ) +parse_slapopt( int tool, int *mode ) { size_t len = 0; char *p; @@ -424,7 +424,7 @@ slap_tool_init( break; case 'o': - if ( parse_slapopt() ) { + if ( parse_slapopt( tool, &mode ) ) { usage( tool, progname ); } break; @@ -457,11 +457,20 @@ slap_tool_init( } break; - case 's': /* dump subtree */ - if ( tool == SLAPADD ) + case 's': + switch ( tool ) { + case SLAPADD: + case SLAPMODIFY: + /* no schema check */ mode |= SLAP_TOOL_NO_SCHEMA_CHECK; - else if ( tool == SLAPCAT || tool == SLAPSCHEMA ) + break; + + case SLAPCAT: + case SLAPSCHEMA: + /* dump subtree */ subtree = ch_strdup( optarg ); + break; + } break; case 't': /* turn on truncate */ -- 2.39.5