]> err.no Git - varnish/commitdiff
Rewrite tackle_warg(): don't override the default max or timeout unless
authordes <des@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Wed, 8 Nov 2006 08:59:20 +0000 (08:59 +0000)
committerdes <des@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Wed, 8 Nov 2006 08:59:20 +0000 (08:59 +0000)
the user asks; bail if max < min; fix usage string.

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@1221 d4fa192b-c00b-0410-8231-f00ffab90ce4

varnish-cache/bin/varnishd/varnishd.c

index e069e372ec24014b3321e47bca8495cb904f5768..90b88b50b05733f6211d306188509eb59941e6ce 100644 (file)
@@ -194,7 +194,7 @@ usage(void)
        fprintf(stderr, "    %-28s # %s\n", "",
            "  -w min,max");
        fprintf(stderr, "    %-28s # %s\n", "",
-           "  -w min,max,timeout [default: -w1,INF,10]");
+           "  -w min,max,timeout [default: -w1,1000,120]");
 #if 0
        -c clusterid@cluster_controller
        -m memory_limit
@@ -211,21 +211,23 @@ usage(void)
 static void
 tackle_warg(const char *argv)
 {
-       int i;
-       unsigned ua, ub, uc;
+       unsigned int ua, ub, uc;
 
-       i = sscanf(argv, "%u,%u,%u", &ua, &ub, &uc);
-       if (i == 0)
-               usage();
-       if (ua < 1)
-               usage();
-       params->wthread_min = ua;
-       params->wthread_max = ua;
-       params->wthread_timeout = 10;
-       if (i >= 2)
-               params->wthread_max = ub;
-       if (i >= 3)
+       switch (sscanf(argv, "%u,%u,%u", &ua, &ub, &uc)) {
+       case 3:
                params->wthread_timeout = uc;
+       case 2:
+               if (ub < ua)
+                       usage();
+               params->wthread_max = ub;
+       case 1:
+               if (ua < 1)
+                       usage();
+               params->wthread_min = ua;
+               break;
+       default:
+               usage();
+       }
 }
 
 /*--------------------------------------------------------------------