]> git.sur5r.net Git - openldap/commitdiff
cleanup option parsing
authorPierangelo Masarati <ando@openldap.org>
Tue, 7 Sep 2010 05:45:36 +0000 (05:45 +0000)
committerPierangelo Masarati <ando@openldap.org>
Tue, 7 Sep 2010 05:45:36 +0000 (05:45 +0000)
servers/slapd/slapcommon.c

index 1c3c489dd6674f527d544f8f1f0f8f1440ed2bf0..a043764ada06fd09ff0b615adb603bd39656cbd8 100644 (file)
@@ -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 */