summaryrefslogtreecommitdiff
path: root/networking/wget.c
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2001-06-21 19:45:06 +0000
committerEric Andersen <andersen@codepoet.org>2001-06-21 19:45:06 +0000
commit8071c021311afb592bb6710b841350018ba97b9d (patch)
tree8c4977f9b0a6a58e97813de86bcaf2196eb833f2 /networking/wget.c
parentceeff7381929930fe8d7e33543e285d5fdcf1c68 (diff)
downloadbusybox-w32-8071c021311afb592bb6710b841350018ba97b9d.tar.gz
busybox-w32-8071c021311afb592bb6710b841350018ba97b9d.tar.bz2
busybox-w32-8071c021311afb592bb6710b841350018ba97b9d.zip
Add wget -P support, finishing off bug #1176
-Erik
Diffstat (limited to 'networking/wget.c')
-rw-r--r--networking/wget.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/networking/wget.c b/networking/wget.c
index 6fd170d4d..61945b7d1 100644
--- a/networking/wget.c
+++ b/networking/wget.c
@@ -160,6 +160,7 @@ int wget_main(int argc, char **argv)
160 int n, try=5, status; 160 int n, try=5, status;
161 int port; 161 int port;
162 char *proxy; 162 char *proxy;
163 char *dir_prefix=NULL;
163 char *s, buf[512]; 164 char *s, buf[512];
164 struct stat sbuf; 165 struct stat sbuf;
165 char extra_headers[1024]; 166 char extra_headers[1024];
@@ -188,11 +189,14 @@ int wget_main(int argc, char **argv)
188 /* 189 /*
189 * Crack command line. 190 * Crack command line.
190 */ 191 */
191 while ((n = getopt_long(argc, argv, "cqO:", long_options, &option_index)) != EOF) { 192 while ((n = getopt_long(argc, argv, "cqO:P:", long_options, &option_index)) != EOF) {
192 switch (n) { 193 switch (n) {
193 case 'c': 194 case 'c':
194 ++do_continue; 195 ++do_continue;
195 break; 196 break;
197 case 'P':
198 dir_prefix = optarg;
199 break;
196 case 'q': 200 case 'q':
197 quiet_flag = TRUE; 201 quiet_flag = TRUE;
198 break; 202 break;
@@ -224,7 +228,6 @@ int wget_main(int argc, char **argv)
224 } 228 }
225 } 229 }
226 230
227 fprintf(stderr, "extra_headers='%s'\n", extra_headers);
228 if (argc - optind != 1) 231 if (argc - optind != 1)
229 show_usage(); 232 show_usage();
230 233
@@ -269,6 +272,7 @@ int wget_main(int argc, char **argv)
269 output = stdout; 272 output = stdout;
270 quiet_flag = TRUE; 273 quiet_flag = TRUE;
271 } else { 274 } else {
275 fname_out = concat_path_file(dir_prefix, fname_out);
272 output = xfopen(fname_out, (do_continue ? "a" : "w")); 276 output = xfopen(fname_out, (do_continue ? "a" : "w"));
273 } 277 }
274 278
@@ -812,7 +816,7 @@ progressmeter(int flag)
812 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 816 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
813 * SUCH DAMAGE. 817 * SUCH DAMAGE.
814 * 818 *
815 * $Id: wget.c,v 1.41 2001/05/16 15:40:48 kraai Exp $ 819 * $Id: wget.c,v 1.42 2001/06/21 19:45:06 andersen Exp $
816 */ 820 */
817 821
818 822