diff --git a/doc/ChangeLog b/doc/ChangeLog index 2127bd83..e1b79ca7 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,7 +1,11 @@ 2000-10-19 Dan Harkless * wget.texi (HTTP Options): Documented my new -E / --html-extension. - + (Wgetrc Commands): Documented my new html_extension option and + John Daily's "quad" values (which I renamed to "lockable + Boolean"). When I documented Damir Dzeko's --referer, I forgot to + add the .wgetrc equivalent; mentioned the "referrer" spelling issue. + 2000-10-09 Dan Harkless * wget.texi (FTP Options): --retr-symlinks wasn't documented properly. @@ -9,7 +13,8 @@ 2000-08-30 Dan Harkless * wget.texi (Recursive Retrieval Options): Documented new -p option. - + (Wgetrc Commands): Documented -p's equvialent, page_requisites. + 2000-08-23 Dan Harkless * wget.texi (Download Options): Using -c on a file that's already fully @@ -69,7 +74,7 @@ * sample.wgetrc: Added entries for backup_converted and waitretry. - * wget.texi (Download Options): Herold Heiko + * wget.texi (Download Options and Wgetrc Commands): Herold Heiko 's new --waitretry option was undocumented until now. Reworded the suggested documentation he sent to the list. @@ -105,7 +110,9 @@ 2000-02-18 Dan Harkless - * wget.texi (-K / --backup-converted): Documented this new option. + * wget.texi (Recursive Retrieval Options): Documented my new -K / + --backup-converted option. + (Wgetrc Commands): Documented backup_converted equivalent. 1998-09-10 Hrvoje Niksic diff --git a/doc/wget.info b/doc/wget.info index 468ec3ca..a3e3fab5 100644 --- a/doc/wget.info +++ b/doc/wget.info @@ -27,7 +27,7 @@ notice identical to this one. Indirect: wget.info-1: 961 wget.info-2: 48421 -wget.info-3: 96314 +wget.info-3: 96945  Tag Table: (Indirect) @@ -61,28 +61,28 @@ Node: Startup File57815 Node: Wgetrc Location58688 Node: Wgetrc Syntax59503 Node: Wgetrc Commands60218 -Node: Sample Wgetrc67844 -Node: Examples72863 -Node: Simple Usage73470 -Node: Advanced Usage75864 -Node: Guru Usage78615 -Node: Various80277 -Node: Proxies80801 -Node: Distribution83566 -Node: Mailing List83917 -Node: Reporting Bugs84616 -Node: Portability86401 -Node: Signals87776 -Node: Appendices88430 -Node: Robots88845 -Node: Introduction to RES89992 -Node: RES Format91885 -Node: User-Agent Field92989 -Node: Disallow Field93753 -Node: Norobots Examples94364 -Node: Security Considerations95318 -Node: Contributors96314 -Node: Copying98953 -Node: Concept Index118116 +Node: Sample Wgetrc68475 +Node: Examples73494 +Node: Simple Usage74101 +Node: Advanced Usage76495 +Node: Guru Usage79246 +Node: Various80908 +Node: Proxies81432 +Node: Distribution84197 +Node: Mailing List84548 +Node: Reporting Bugs85247 +Node: Portability87032 +Node: Signals88407 +Node: Appendices89061 +Node: Robots89476 +Node: Introduction to RES90623 +Node: RES Format92516 +Node: User-Agent Field93620 +Node: Disallow Field94384 +Node: Norobots Examples94995 +Node: Security Considerations95949 +Node: Contributors96945 +Node: Copying99584 +Node: Concept Index118747  End Tag Table diff --git a/doc/wget.info-2 b/doc/wget.info-2 index c323b0e3..474c32e7 100644 --- a/doc/wget.info-2 +++ b/doc/wget.info-2 @@ -333,15 +333,20 @@ File: wget.info, Node: Wgetrc Commands, Next: Sample Wgetrc, Prev: Wgetrc Syn Wgetrc Commands =============== - The complete set of commands is listed below, the letter after `=' -denoting the value the command takes. It is `on/off' for `on' or `off' -(which can also be `1' or `0'), STRING for any non-empty string or N -for a positive integer. For example, you may specify `use_proxy = off' -to disable use of proxy servers by default. You may use `inf' for -infinite values, where appropriate. + The complete set of commands is listed below. Legal values are +listed after the `='. Simple Boolean values can be set or unset using +`on' and `off' or `1' and `0'. A fancier kind of Boolean allowed in +some cases is the "lockable" Boolean, which may be set to `on', `off', +`always', or `never'. If an option is set to `always' or `never', that +value will be locked in for the duration of the wget invocation - +commandline options will not override. - Most of the commands have their equivalent command-line option -(*Note Invoking::), except some more obscure or rarely used ones. + Some commands take pseudo-arbitrary values. STRING values can be +any non-empty string. N can be any positive integer, or `inf' for +infinity, where appropriate. + + Most of these commands have commandline equivalents (*Note +Invoking::), though some of the more obscure or rarely used ones do not. accept/reject = STRING Same as `-A'/`-R' (*Note Types of Files::). @@ -501,8 +506,11 @@ page_requisites = on/off Download all ancillary documents necessary for a single HTML page to display properly - the same as `-p'. -passive_ftp = on/off - Set passive FTP - the same as `--passive-ftp'. +passive_ftp = on/off/always/never + Set passive FTP - the same as `--passive-ftp'. Some scripts and + `.pm' (Perl module) files download files using `wget + --passive-ftp'. If your firewall does not allow this, you can set + `passive_ftp = never' to override the commandline. passwd = STRING Set your FTP password to PASSWORD. Without this setting, the @@ -514,6 +522,11 @@ proxy_user = STRING proxy_passwd = STRING Set proxy authentication password to STRING, like `--proxy-passwd'. +referer = STRING + Set HTTP `Referer:' header just like `--referer'. (Note it was + the folks who wrote the HTTP spec who got the spelling of + "referrer" wrong.) + quiet = on/off Quiet mode - the same as `-q'. diff --git a/doc/wget.texi b/doc/wget.texi index 816e79eb..c492f055 100644 --- a/doc/wget.texi +++ b/doc/wget.texi @@ -1697,16 +1697,21 @@ reject = @section Wgetrc Commands @cindex wgetrc commands -The complete set of commands is listed below, the letter after @samp{=} -denoting the value the command takes. It is @samp{on/off} for @samp{on} -or @samp{off} (which can also be @samp{1} or @samp{0}), @var{string} for -any non-empty string or @var{n} for a positive integer. For example, -you may specify @samp{use_proxy = off} to disable use of proxy servers -by default. You may use @samp{inf} for infinite values, where -appropriate. +The complete set of commands is listed below. Legal values are listed +after the @samp{=}. Simple Boolean values can be set or unset using +@samp{on} and @samp{off} or @samp{1} and @samp{0}. A fancier kind of +Boolean allowed in some cases is the "lockable" Boolean, which may be +set to @samp{on}, @samp{off}, @samp{always}, or @samp{never}. If an +option is set to @samp{always} or @samp{never}, that value will be +locked in for the duration of the wget invocation -- commandline options +will not override. -Most of the commands have their equivalent command-line option -(@xref{Invoking}), except some more obscure or rarely used ones. +Some commands take pseudo-arbitrary values. @var{string} values can be +any non-empty string. @var{n} can be any positive integer, or +@samp{inf} for infinity, where appropriate. + +Most of these commands have commandline equivalents (@xref{Invoking}), +though some of the more obscure or rarely used ones do not. @table @asis @item accept/reject = @var{string} @@ -1872,20 +1877,26 @@ Set the output filename -- the same as @samp{-O}. Download all ancillary documents necessary for a single HTML page to display properly -- the same as @samp{-p}. -@item passive_ftp = on/off -Set passive @sc{ftp} -- the same as @samp{--passive-ftp}. +@item passive_ftp = on/off/always/never +Set passive @sc{ftp} -- the same as @samp{--passive-ftp}. Some scripts +and @samp{.pm} (Perl module) files download files using @samp{wget +--passive-ftp}. If your firewall does not allow this, you can set +@samp{passive_ftp = never} to override the commandline. @item passwd = @var{string} Set your @sc{ftp} password to @var{password}. Without this setting, the password defaults to @samp{username@@hostname.domainname}. @item proxy_user = @var{string} -Set proxy authentication user name to @var{string}, like -@samp{--proxy-user}. +Set proxy authentication user name to @var{string}, like @samp{--proxy-user}. @item proxy_passwd = @var{string} -Set proxy authentication password to @var{string}, like -@samp{--proxy-passwd}. +Set proxy authentication password to @var{string}, like @samp{--proxy-passwd}. + +@item referer = @var{string} +Set HTTP @samp{Referer:} header just like @samp{--referer}. (Note it +was the folks who wrote the @sc{http} spec who got the spelling of +"referrer" wrong.) @item quiet = on/off Quiet mode -- the same as @samp{-q}. diff --git a/src/ChangeLog b/src/ChangeLog index 54ccece3..8bcf7308 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -8,6 +8,9 @@ the case of gethttp() called xrealloc() on u->local. * init.c (commands): Added new "htmlextension" command. + Also renamed John Daily's cmd_quad() to the more descriptive + cmd_lockable_boolean(), alpha-sorted the CMD_DECLARE()s and + removed duplicate cmd_boolean() declaration. * main.c (print_help): Added my new -E / --html-extension option. (main): Undocumented --email-address option previously used -E synonym. @@ -30,6 +33,14 @@ * main.c (print_help): Clarified what --retr-symlinks does. +2000-09-15 John Daily + + * init.c: Add support for "always" and "never" values to allow + .wgetrc to override commandline (useful e.g. with .pm files + calling `wget --passive-ftp' when your firewall doesn't allow that). + + * ftp.c (getftp): passive_ftp is first option to support always/never. + 2000-08-30 Dan Harkless * ftp.c (ftp_retrieve_list): Use new INFINITE_RECURSION #define. diff --git a/src/ftp.c b/src/ftp.c index 1f65c254..bfb4e028 100644 --- a/src/ftp.c +++ b/src/ftp.c @@ -337,7 +337,7 @@ Error in server response, closing control connection.\n")); /* If anything is to be retrieved, PORT (or PASV) must be sent. */ if (cmd & (DO_LIST | DO_RETR)) { - if (opt.ftp_pasv) + if (opt.ftp_pasv > 0) { char thost[256]; unsigned short tport; diff --git a/src/init.c b/src/init.c index 874e05a9..b1169b23 100644 --- a/src/init.c +++ b/src/init.c @@ -53,14 +53,14 @@ extern int errno; PARAMS ((const char *, const char *, void *)) CMD_DECLARE (cmd_boolean); -CMD_DECLARE (cmd_boolean); +CMD_DECLARE (cmd_bytes); +CMD_DECLARE (cmd_directory_vector); +CMD_DECLARE (cmd_lockable_boolean); CMD_DECLARE (cmd_number); CMD_DECLARE (cmd_number_inf); CMD_DECLARE (cmd_string); -CMD_DECLARE (cmd_vector); -CMD_DECLARE (cmd_directory_vector); -CMD_DECLARE (cmd_bytes); CMD_DECLARE (cmd_time); +CMD_DECLARE (cmd_vector); CMD_DECLARE (cmd_spec_dirstruct); CMD_DECLARE (cmd_spec_dotstyle); @@ -131,7 +131,7 @@ static struct { { "numtries", &opt.ntry, cmd_number_inf },/* deprecated*/ { "outputdocument", NULL, cmd_spec_outputdocument }, { "pagerequisites", &opt.page_requisites, cmd_boolean }, - { "passiveftp", &opt.ftp_pasv, cmd_boolean }, + { "passiveftp", &opt.ftp_pasv, cmd_lockable_boolean }, { "passwd", &opt.ftp_pass, cmd_string }, { "proxypasswd", &opt.proxy_passwd, cmd_string }, { "proxyuser", &opt.proxy_user, cmd_string }, @@ -499,6 +499,51 @@ cmd_boolean (const char *com, const char *val, void *closure) return 1; } +/* Store the lockable_boolean {2, 1, 0, -1} value from VAL to CLOSURE. COM is + ignored, except for error messages. Values 2 and -1 indicate that once + defined, the value may not be changed by successive wgetrc files or + command-line arguments. + + Values: 2 - Enable a particular option for good ("always") + 1 - Enable an option ("on") + 0 - Disable an option ("off") + -1 - Disable an option for good ("never") */ +static int +cmd_lockable_boolean (const char *com, const char *val, void *closure) +{ + int lockable_boolean_value; + + /* + * If a config file said "always" or "never", don't allow command line + * arguments to override the config file. + */ + if (*(int *)closure == -1 || *(int *)closure == 2) + return 1; + + if (!strcasecmp (val, "always") + || (*val == '2' && !*(val + 1))) + lockable_boolean_value = 2; + else if (!strcasecmp (val, "on") + || (*val == '1' && !*(val + 1))) + lockable_boolean_value = 1; + else if (!strcasecmp (val, "off") + || (*val == '0' && !*(val + 1))) + lockable_boolean_value = 0; + else if (!strcasecmp (val, "never") + || (*val == '-' && *(val + 1) == '1' && !*(val + 2))) + lockable_boolean_value = -1; + else + { + fprintf (stderr, _("%s: %s: Please specify always, on, off, " + "or never.\n"), + exec_name, com); + return 0; + } + + *(int *)closure = lockable_boolean_value; + return 1; +} + /* Set the non-negative integer value from VAL to CLOSURE. With incorrect specification, the number remains unchanged. */ static int