add a -n maxloops option so this can be run in a script and end after a
authorHerb Lewis <herb@samba.org>
Fri, 22 Mar 2002 00:09:09 +0000 (00:09 +0000)
committerHerb Lewis <herb@samba.org>
Fri, 22 Mar 2002 00:09:09 +0000 (00:09 +0000)
certain number of iterations.
(This used to be commit bdac7cb9c5bdd52db06b2507d8660bc1c9debea5)

source3/torture/masktest.c

index 0e0b531080ff0913477377f1ef751bf40b45685a..637e9ef63a00b8096e569f352cb187afc4a72d62 100644 (file)
@@ -32,6 +32,7 @@ static char *maskchars = "<>\"?*abc.";
 static char *filechars = "abcdefghijklm.";
 static int verbose;
 static int die_on_error;
+static int NumLoops = 0;
 
 /* a test fn for LANMAN mask support */
 int ms_fnmatch_lanman_core(char *pattern, char *string)
@@ -380,6 +381,8 @@ static void test_mask(int argc, char *argv[],
                if (strspn(file+l, ".") == strlen(file+l)) continue;
 
                testpair(cli, mask, file);
+               if (NumLoops && (--NumLoops == 0))
+                       break;
        }
 
  finished:
@@ -394,6 +397,7 @@ static void usage(void)
   masktest //server/share [options..]\n\
   options:\n\
        -d debuglevel\n\
+       -n numloops\n\
         -W workgroup\n\
         -U user%%pass\n\
         -s seed\n\
@@ -455,8 +459,11 @@ static void usage(void)
 
        seed = time(NULL);
 
-       while ((opt = getopt(argc, argv, "d:U:s:hm:f:aoW:M:vE")) != EOF) {
+       while ((opt = getopt(argc, argv, "n:d:U:s:hm:f:aoW:M:vE")) != EOF) {
                switch (opt) {
+               case 'n':
+                       NumLoops = atoi(optarg);
+                       break;
                case 'd':
                        DEBUGLEVEL = atoi(optarg);
                        break;