]> sjero.net Git - wget/commitdiff
[svn] Allow --foo=yes/no in addition to --foo=on/off.
authorhniksic <devnull@localhost>
Wed, 10 Sep 2003 20:21:21 +0000 (13:21 -0700)
committerhniksic <devnull@localhost>
Wed, 10 Sep 2003 20:21:21 +0000 (13:21 -0700)
NEWS
src/ChangeLog
src/init.c

diff --git a/NEWS b/NEWS
index 27b5b5a350696248ec788c2c2c01f25b6f81396b..073a95bda46873cdbcda5219ac9672d12cb490d9 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -29,6 +29,9 @@ log on to the proxy as "username@host".
 ** The new option `--retry-connrefused' makes Wget retry downloads
 even in the face of refused connections, which are otherwise
 considered a fatal error.
+
+** The new option `--dns-cache=off' may be used to prevent Wget from
+caching DNS lookups.
 \f
 * Wget 1.8.1 is a bugfix release with no user-visible changes.
 \f
index e9137edd8a22c6df5ac2c3cd87d8a2d7c8b5f86a..26efc2241ed4cc0dfdeaae3911bc8655b0237c6f 100644 (file)
@@ -1,3 +1,8 @@
+2003-09-10  Hrvoje Niksic  <hniksic@xemacs.org>
+
+       * init.c (cmd_boolean): Accept yes/no along with on/off.
+       (cmd_lockable_boolean): Ditto.
+
 2003-09-10  Hrvoje Niksic  <hniksic@xemacs.org>
 
        * init.c: New command dns_cache.
index 16ef2561d4f2345abdbc79b67319e5022b7fc213..124bfb10926b59eaca1829c71d084fffb69296dd 100644 (file)
@@ -543,12 +543,22 @@ static int
 cmd_boolean (const char *com, const char *val, void *closure)
 {
   int bool_value;
-
-  if (!strcasecmp (val, "on")
-      || (*val == '1' && !*(val + 1)))
+  const char *v = val;
+#define LC(x) TOLOWER(x)
+
+  if ((LC(v[0]) == 'o' && LC(v[1]) == 'n' && !v[2])
+      ||
+      (LC(v[0]) == 'y' && LC(v[1]) == 'e' && LC(v[2]) == 's' && !v[3])
+      ||
+      (v[0] == '1' && !v[1]))
+    /* "on", "yes" and "1" mean true. */
     bool_value = 1;
-  else if (!strcasecmp (val, "off")
-          || (*val == '0' && !*(val + 1)))
+  else if ((LC(v[0]) == 'o' && LC(v[1]) == 'f' && LC(v[2]) == 'f' && !v[3])
+          ||
+          (LC(v[0]) == 'n' && LC(v[1]) == 'o' && !v[2])
+          ||
+          (v[0] == '0' && !v[1]))
+    /* "off", "no" and "0" mean false. */
     bool_value = 0;
   else
     {
@@ -582,17 +592,17 @@ cmd_lockable_boolean (const char *com, const char *val, void *closure)
   if (*(int *)closure == -1 || *(int *)closure == 2)
     return 1;
 
-  if (!strcasecmp (val, "always")
-      || (*val == '2' && !*(val + 1)))
+  if (!strcasecmp (val, "always") || !strcmp (val, "2"))
     lockable_boolean_value = 2;
   else if (!strcasecmp (val, "on")
-      || (*val == '1' && !*(val + 1)))
+          || !strcasecmp (val, "yes")
+          || !strcmp (val, "1"))
     lockable_boolean_value = 1;
   else if (!strcasecmp (val, "off")
-          || (*val == '0' && !*(val + 1)))
+          || !strcasecmp (val, "no")
+          || !strcmp (val, "0"))
     lockable_boolean_value = 0;
-  else if (!strcasecmp (val, "never")
-      || (*val == '-' && *(val + 1) == '1' && !*(val + 2)))
+  else if (!strcasecmp (val, "never") || !strcmp (val, "-1"))
     lockable_boolean_value = -1;
   else
     {