diff options
author | Robert Griebl <griebl@gmx.de> | 2002-05-14 23:36:45 +0000 |
---|---|---|
committer | Robert Griebl <griebl@gmx.de> | 2002-05-14 23:36:45 +0000 |
commit | d77601178d9c9f5084e3842d0156dc4723592e44 (patch) | |
tree | 567b8b380536381cf2861fdb248c15bd3a67d468 /networking/wget.c | |
parent | 64f70cc755b89c29aa03dc9555a1df37de17bcfd (diff) |
Added support for -Y|--proxy=on/off to wget
Diffstat (limited to 'networking/wget.c')
-rw-r--r-- | networking/wget.c | 20 |
1 files changed, 14 insertions, 6 deletions
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 $ */ |