diff options
-rw-r--r-- | include/usage.h | 5 | ||||
-rw-r--r-- | networking/wget.c | 20 |
2 files changed, 17 insertions, 8 deletions
diff --git a/include/usage.h b/include/usage.h index c24d71ebd..823d95296 100644 --- a/include/usage.h +++ b/include/usage.h @@ -1960,14 +1960,15 @@ " 31 46 1365 /etc/passwd\n" #define wget_trivial_usage \ - "[-c|--continue] [-q|--quiet] [-O|--output-document file]\n\t[--header 'header: value'] [-P DIR] url" + "[-c|--continue] [-q|--quiet] [-O|--output-document file]\n\t[--header 'header: value'] [-Y|--proxy on/off] [-P DIR] url" #define wget_full_usage \ "wget retrieves files via HTTP or FTP\n\n" \ "Options:\n" \ "\t-c\tcontinue retrieval of aborted transfers\n" \ "\t-q\tquiet mode - do not print\n" \ "\t-P\tSet directory prefix to DIR\n" \ - "\t-O\tsave to filename ('-' for stdout)" + "\t-O\tsave to filename ('-' for stdout)\n" \ + "\t-Y\tuse proxy ('on' or 'off')" #define which_trivial_usage \ "[COMMAND ...]" diff --git a/networking/wget.c b/networking/wget.c index a1c18bcf1..6974c70a8 100644 --- a/networking/wget.c +++ b/networking/wget.c @@ -159,7 +159,7 @@ int wget_main(int argc, char **argv) { int n, try=5, status; int port; - char *proxy; + char *proxy = 0; char *dir_prefix=NULL; char *s, buf[512]; struct stat sbuf; @@ -177,6 +177,7 @@ int wget_main(int argc, char **argv) int got_clen = 0; /* got content-length: from server */ FILE *output; /* socket to web server */ int quiet_flag = FALSE; /* Be verry, verry quiet... */ + int noproxy = 0; /* Use proxies if env vars are set */ #define LONG_HEADER 1 struct option long_options[] = { @@ -184,12 +185,13 @@ int wget_main(int argc, char **argv) { "quiet", 0, NULL, 'q' }, { "output-document", 1, NULL, 'O' }, { "header", 1, &which_long_opt, LONG_HEADER }, + { "proxy", 1, NULL, 'Y' }, { 0, 0, 0, 0 } }; /* * Crack command line. */ - while ((n = getopt_long(argc, argv, "cqO:P:", long_options, &option_index)) != EOF) { + while ((n = getopt_long(argc, argv, "cqO:P:Y:", long_options, &option_index)) != EOF) { switch (n) { case 'c': ++do_continue; @@ -207,6 +209,10 @@ int wget_main(int argc, char **argv) */ fname_out = optarg; break; + case 'Y': + if (strcmp(optarg, "off") == 0) + noproxy=1; + break; case 0: switch (which_long_opt) { case LONG_HEADER: { @@ -238,9 +244,11 @@ int wget_main(int argc, char **argv) /* * Use the proxy if necessary. */ - proxy = getenv(target.is_ftp ? "ftp_proxy" : "http_proxy"); - if (proxy) - parse_url(xstrdup(proxy), &server); + if (!noproxy) { + proxy = getenv(target.is_ftp ? "ftp_proxy" : "http_proxy"); + if (proxy) + parse_url(xstrdup(proxy), &server); + } /* Guess an output filename */ if (!fname_out) { @@ -818,7 +826,7 @@ progressmeter(int flag) * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: wget.c,v 1.48 2002/04/17 15:33:24 kraai Exp $ + * $Id: wget.c,v 1.49 2002/05/14 23:36:45 sandman Exp $ */ |