aboutsummaryrefslogtreecommitdiff
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
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
-rw-r--r--applets/usage.h3
-rw-r--r--include/usage.h3
-rw-r--r--networking/wget.c10
-rw-r--r--usage.h3
-rw-r--r--wget.c10
5 files changed, 20 insertions, 9 deletions
diff --git a/applets/usage.h b/applets/usage.h
index acba3677c..9fd3a2e1c 100644
--- a/applets/usage.h
+++ b/applets/usage.h
@@ -1729,12 +1729,13 @@
1729 " 31 46 1365 /etc/passwd\n" 1729 " 31 46 1365 /etc/passwd\n"
1730 1730
1731#define wget_trivial_usage \ 1731#define wget_trivial_usage \
1732 "[-c|--continue] [-q|--quiet] [-O|--output-document file] [--header 'header: value'] url" 1732 "[-c|--continue] [-q|--quiet] [-O|--output-document file]\n\t[--header 'header: value'] [-P DIR] url"
1733#define wget_full_usage \ 1733#define wget_full_usage \
1734 "wget retrieves files via HTTP or FTP\n\n" \ 1734 "wget retrieves files via HTTP or FTP\n\n" \
1735 "Options:\n" \ 1735 "Options:\n" \
1736 "\t-c\tcontinue retrieval of aborted transfers\n" \ 1736 "\t-c\tcontinue retrieval of aborted transfers\n" \
1737 "\t-q\tquiet mode - do not print\n" \ 1737 "\t-q\tquiet mode - do not print\n" \
1738 "\t-P\tSet directory prefix to DIR\n" \
1738 "\t-O\tsave to filename ('-' for stdout)" 1739 "\t-O\tsave to filename ('-' for stdout)"
1739 1740
1740#define which_trivial_usage \ 1741#define which_trivial_usage \
diff --git a/include/usage.h b/include/usage.h
index acba3677c..9fd3a2e1c 100644
--- a/include/usage.h
+++ b/include/usage.h
@@ -1729,12 +1729,13 @@
1729 " 31 46 1365 /etc/passwd\n" 1729 " 31 46 1365 /etc/passwd\n"
1730 1730
1731#define wget_trivial_usage \ 1731#define wget_trivial_usage \
1732 "[-c|--continue] [-q|--quiet] [-O|--output-document file] [--header 'header: value'] url" 1732 "[-c|--continue] [-q|--quiet] [-O|--output-document file]\n\t[--header 'header: value'] [-P DIR] url"
1733#define wget_full_usage \ 1733#define wget_full_usage \
1734 "wget retrieves files via HTTP or FTP\n\n" \ 1734 "wget retrieves files via HTTP or FTP\n\n" \
1735 "Options:\n" \ 1735 "Options:\n" \
1736 "\t-c\tcontinue retrieval of aborted transfers\n" \ 1736 "\t-c\tcontinue retrieval of aborted transfers\n" \
1737 "\t-q\tquiet mode - do not print\n" \ 1737 "\t-q\tquiet mode - do not print\n" \
1738 "\t-P\tSet directory prefix to DIR\n" \
1738 "\t-O\tsave to filename ('-' for stdout)" 1739 "\t-O\tsave to filename ('-' for stdout)"
1739 1740
1740#define which_trivial_usage \ 1741#define which_trivial_usage \
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
diff --git a/usage.h b/usage.h
index acba3677c..9fd3a2e1c 100644
--- a/usage.h
+++ b/usage.h
@@ -1729,12 +1729,13 @@
1729 " 31 46 1365 /etc/passwd\n" 1729 " 31 46 1365 /etc/passwd\n"
1730 1730
1731#define wget_trivial_usage \ 1731#define wget_trivial_usage \
1732 "[-c|--continue] [-q|--quiet] [-O|--output-document file] [--header 'header: value'] url" 1732 "[-c|--continue] [-q|--quiet] [-O|--output-document file]\n\t[--header 'header: value'] [-P DIR] url"
1733#define wget_full_usage \ 1733#define wget_full_usage \
1734 "wget retrieves files via HTTP or FTP\n\n" \ 1734 "wget retrieves files via HTTP or FTP\n\n" \
1735 "Options:\n" \ 1735 "Options:\n" \
1736 "\t-c\tcontinue retrieval of aborted transfers\n" \ 1736 "\t-c\tcontinue retrieval of aborted transfers\n" \
1737 "\t-q\tquiet mode - do not print\n" \ 1737 "\t-q\tquiet mode - do not print\n" \
1738 "\t-P\tSet directory prefix to DIR\n" \
1738 "\t-O\tsave to filename ('-' for stdout)" 1739 "\t-O\tsave to filename ('-' for stdout)"
1739 1740
1740#define which_trivial_usage \ 1741#define which_trivial_usage \
diff --git a/wget.c b/wget.c
index 6fd170d4d..61945b7d1 100644
--- a/wget.c
+++ b/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