aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Griebl <griebl@gmx.de>2002-05-14 23:36:45 +0000
committerRobert Griebl <griebl@gmx.de>2002-05-14 23:36:45 +0000
commitd77601178d9c9f5084e3842d0156dc4723592e44 (patch)
tree567b8b380536381cf2861fdb248c15bd3a67d468
parent64f70cc755b89c29aa03dc9555a1df37de17bcfd (diff)
downloadbusybox-w32-d77601178d9c9f5084e3842d0156dc4723592e44.tar.gz
busybox-w32-d77601178d9c9f5084e3842d0156dc4723592e44.tar.bz2
busybox-w32-d77601178d9c9f5084e3842d0156dc4723592e44.zip
Added support for -Y|--proxy=on/off to wget
-rw-r--r--include/usage.h5
-rw-r--r--networking/wget.c20
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 @@
1960 " 31 46 1365 /etc/passwd\n" 1960 " 31 46 1365 /etc/passwd\n"
1961 1961
1962#define wget_trivial_usage \ 1962#define wget_trivial_usage \
1963 "[-c|--continue] [-q|--quiet] [-O|--output-document file]\n\t[--header 'header: value'] [-P DIR] url" 1963 "[-c|--continue] [-q|--quiet] [-O|--output-document file]\n\t[--header 'header: value'] [-Y|--proxy on/off] [-P DIR] url"
1964#define wget_full_usage \ 1964#define wget_full_usage \
1965 "wget retrieves files via HTTP or FTP\n\n" \ 1965 "wget retrieves files via HTTP or FTP\n\n" \
1966 "Options:\n" \ 1966 "Options:\n" \
1967 "\t-c\tcontinue retrieval of aborted transfers\n" \ 1967 "\t-c\tcontinue retrieval of aborted transfers\n" \
1968 "\t-q\tquiet mode - do not print\n" \ 1968 "\t-q\tquiet mode - do not print\n" \
1969 "\t-P\tSet directory prefix to DIR\n" \ 1969 "\t-P\tSet directory prefix to DIR\n" \
1970 "\t-O\tsave to filename ('-' for stdout)" 1970 "\t-O\tsave to filename ('-' for stdout)\n" \
1971 "\t-Y\tuse proxy ('on' or 'off')"
1971 1972
1972#define which_trivial_usage \ 1973#define which_trivial_usage \
1973 "[COMMAND ...]" 1974 "[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)
159{ 159{
160 int n, try=5, status; 160 int n, try=5, status;
161 int port; 161 int port;
162 char *proxy; 162 char *proxy = 0;
163 char *dir_prefix=NULL; 163 char *dir_prefix=NULL;
164 char *s, buf[512]; 164 char *s, buf[512];
165 struct stat sbuf; 165 struct stat sbuf;
@@ -177,6 +177,7 @@ int wget_main(int argc, char **argv)
177 int got_clen = 0; /* got content-length: from server */ 177 int got_clen = 0; /* got content-length: from server */
178 FILE *output; /* socket to web server */ 178 FILE *output; /* socket to web server */
179 int quiet_flag = FALSE; /* Be verry, verry quiet... */ 179 int quiet_flag = FALSE; /* Be verry, verry quiet... */
180 int noproxy = 0; /* Use proxies if env vars are set */
180 181
181#define LONG_HEADER 1 182#define LONG_HEADER 1
182 struct option long_options[] = { 183 struct option long_options[] = {
@@ -184,12 +185,13 @@ int wget_main(int argc, char **argv)
184 { "quiet", 0, NULL, 'q' }, 185 { "quiet", 0, NULL, 'q' },
185 { "output-document", 1, NULL, 'O' }, 186 { "output-document", 1, NULL, 'O' },
186 { "header", 1, &which_long_opt, LONG_HEADER }, 187 { "header", 1, &which_long_opt, LONG_HEADER },
188 { "proxy", 1, NULL, 'Y' },
187 { 0, 0, 0, 0 } 189 { 0, 0, 0, 0 }
188 }; 190 };
189 /* 191 /*
190 * Crack command line. 192 * Crack command line.
191 */ 193 */
192 while ((n = getopt_long(argc, argv, "cqO:P:", long_options, &option_index)) != EOF) { 194 while ((n = getopt_long(argc, argv, "cqO:P:Y:", long_options, &option_index)) != EOF) {
193 switch (n) { 195 switch (n) {
194 case 'c': 196 case 'c':
195 ++do_continue; 197 ++do_continue;
@@ -207,6 +209,10 @@ int wget_main(int argc, char **argv)
207 */ 209 */
208 fname_out = optarg; 210 fname_out = optarg;
209 break; 211 break;
212 case 'Y':
213 if (strcmp(optarg, "off") == 0)
214 noproxy=1;
215 break;
210 case 0: 216 case 0:
211 switch (which_long_opt) { 217 switch (which_long_opt) {
212 case LONG_HEADER: { 218 case LONG_HEADER: {
@@ -238,9 +244,11 @@ int wget_main(int argc, char **argv)
238 /* 244 /*
239 * Use the proxy if necessary. 245 * Use the proxy if necessary.
240 */ 246 */
241 proxy = getenv(target.is_ftp ? "ftp_proxy" : "http_proxy"); 247 if (!noproxy) {
242 if (proxy) 248 proxy = getenv(target.is_ftp ? "ftp_proxy" : "http_proxy");
243 parse_url(xstrdup(proxy), &server); 249 if (proxy)
250 parse_url(xstrdup(proxy), &server);
251 }
244 252
245 /* Guess an output filename */ 253 /* Guess an output filename */
246 if (!fname_out) { 254 if (!fname_out) {
@@ -818,7 +826,7 @@ progressmeter(int flag)
818 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 826 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
819 * SUCH DAMAGE. 827 * SUCH DAMAGE.
820 * 828 *
821 * $Id: wget.c,v 1.48 2002/04/17 15:33:24 kraai Exp $ 829 * $Id: wget.c,v 1.49 2002/05/14 23:36:45 sandman Exp $
822 */ 830 */
823 831
824 832