]> git.sur5r.net Git - openldap/commitdiff
complain if "-T" is not the first option
authorPierangelo Masarati <ando@openldap.org>
Fri, 8 Sep 2006 18:25:34 +0000 (18:25 +0000)
committerPierangelo Masarati <ando@openldap.org>
Fri, 8 Sep 2006 18:25:34 +0000 (18:25 +0000)
servers/slapd/main.c

index 8b1ee9c9c6300cd01aef7a657f6ef554e21be8e5..e3693d02ed7828f91efb8f16526f6e8f9f83a105 100644 (file)
@@ -369,6 +369,7 @@ int main( int argc, char **argv )
        size_t  l;
 
        int slapd_pid_file_unlink = 0, slapd_args_file_unlink = 0;
+       int firstopt = 1;
 
 #ifdef CSRIMALLOC
        FILE *leakfile;
@@ -623,6 +624,12 @@ int main( int argc, char **argv )
                        break;
 
                case 'T':
+                       if ( firstopt == 0 ) {
+                               fprintf( stderr, "warning: \"-T %s\" "
+                                       "should be the first option.\n",
+                                       optarg );
+                       }
+
                        /* try full option string first */
                        for ( i = 0; tools[i].name; i++ ) {
                                if ( strcmp( optarg, &tools[i].name[4] ) == 0 ) {
@@ -653,6 +660,10 @@ unhandled_option:;
                        SERVICE_EXIT( ERROR_SERVICE_SPECIFIC_ERROR, 15 );
                        goto stop;
                }
+
+               if ( firstopt ) {
+                       firstopt = 0;
+               }
        }
 
        ber_set_option(NULL, LBER_OPT_DEBUG_LEVEL, &slap_debug);