X-Git-Url: http://sjero.net/git/?p=wget;a=blobdiff_plain;f=src%2Finit.c;h=b4336502057a425143a60d318cb49fff52b26cb6;hp=813781fb590257817bed987f92c0415d5e1eaaea;hb=550457bcade62a8f072ce0d50d0d85bcb60d22bb;hpb=8dc52c6eaa1993d140a52bc0627e436efd9870d0 diff --git a/src/init.c b/src/init.c index 813781fb..b4336502 100644 --- a/src/init.c +++ b/src/init.c @@ -87,6 +87,7 @@ CMD_DECLARE (cmd_directory_vector); CMD_DECLARE (cmd_number); CMD_DECLARE (cmd_number_inf); CMD_DECLARE (cmd_string); +CMD_DECLARE (cmd_string_uppercase); CMD_DECLARE (cmd_file); CMD_DECLARE (cmd_directory); CMD_DECLARE (cmd_time); @@ -212,7 +213,7 @@ static const struct { { "logfile", &opt.lfilename, cmd_file }, { "login", &opt.ftp_user, cmd_string },/* deprecated*/ { "maxredirect", &opt.max_redirect, cmd_number }, - { "method", &opt.method, cmd_string }, + { "method", &opt.method, cmd_string_uppercase }, { "mirror", NULL, cmd_spec_mirror }, { "netrc", &opt.netrc, cmd_boolean }, { "noclobber", &opt.noclobber, cmd_boolean }, @@ -959,8 +960,24 @@ cmd_string (const char *com, const char *val, void *place) return true; } +/* Like cmd_string but ensure the string is upper case. */ +static bool +cmd_string_uppercase (const char *com, const char *val, void *place) +{ + char *q; + bool ret = cmd_string (com, val, place); + q = *((char **) place); + if (!ret || q == NULL) + return false; + + while (*q) + *q++ = c_toupper (*q); + + return true; +} + -/* Like the above, but handles tilde-expansion when reading a user's +/* Like cmd_string, but handles tilde-expansion when reading a user's `.wgetrc'. In that case, and if VAL begins with `~', the tilde gets expanded to the user's home directory. */ static bool