1
0
mirror of https://github.com/moparisthebest/wget synced 2024-07-03 16:38:41 -04:00

[svn] Allow --foo=yes/no in addition to --foo=on/off.

This commit is contained in:
hniksic 2003-09-10 13:21:21 -07:00
parent 10137bd186
commit bda244f564
3 changed files with 28 additions and 10 deletions

3
NEWS
View File

@ -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.
* Wget 1.8.1 is a bugfix release with no user-visible changes.

View 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.

View File

@ -543,12 +543,22 @@ static int
cmd_boolean (const char *com, const char *val, void *closure)
{
int bool_value;
const char *v = val;
#define LC(x) TOLOWER(x)
if (!strcasecmp (val, "on")
|| (*val == '1' && !*(val + 1)))
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
{