projects
/
oweals
/
busybox.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
This is vodz' latest patch. Sorry it took so long...
[oweals/busybox.git]
/
wget.c
diff --git
a/wget.c
b/wget.c
index e561ae287959c9fb1a20639aa8b3693dafffb838..61945b7d1ec641af658a3805da416c3757bbd52c 100644
(file)
--- a/
wget.c
+++ b/
wget.c
@@
-160,6
+160,7
@@
int wget_main(int argc, char **argv)
int n, try=5, status;
int port;
char *proxy;
int n, try=5, status;
int port;
char *proxy;
+ char *dir_prefix=NULL;
char *s, buf[512];
struct stat sbuf;
char extra_headers[1024];
char *s, buf[512];
struct stat sbuf;
char extra_headers[1024];
@@
-188,11
+189,14
@@
int wget_main(int argc, char **argv)
/*
* Crack command line.
*/
/*
* Crack command line.
*/
- while ((n = getopt_long(argc, argv, "cqO:", long_options, &option_index)) != EOF) {
+ while ((n = getopt_long(argc, argv, "cqO:
P:
", long_options, &option_index)) != EOF) {
switch (n) {
case 'c':
++do_continue;
break;
switch (n) {
case 'c':
++do_continue;
break;
+ case 'P':
+ dir_prefix = optarg;
+ break;
case 'q':
quiet_flag = TRUE;
break;
case 'q':
quiet_flag = TRUE;
break;
@@
-224,7
+228,6
@@
int wget_main(int argc, char **argv)
}
}
}
}
- fprintf(stderr, "extra_headers='%s'\n", extra_headers);
if (argc - optind != 1)
show_usage();
if (argc - optind != 1)
show_usage();
@@
-269,6
+272,7
@@
int wget_main(int argc, char **argv)
output = stdout;
quiet_flag = TRUE;
} else {
output = stdout;
quiet_flag = TRUE;
} else {
+ fname_out = concat_path_file(dir_prefix, fname_out);
output = xfopen(fname_out, (do_continue ? "a" : "w"));
}
output = xfopen(fname_out, (do_continue ? "a" : "w"));
}
@@
-325,7
+329,7
@@
int wget_main(int argc, char **argv)
if (do_continue)
fprintf(sfp, "Range: bytes=%ld-\r\n", beg_range);
if(extra_headers_left < sizeof(extra_headers))
if (do_continue)
fprintf(sfp, "Range: bytes=%ld-\r\n", beg_range);
if(extra_headers_left < sizeof(extra_headers))
- fp
rintf(sfp,extra_headers
);
+ fp
uts(extra_headers,sfp
);
fprintf(sfp,"Connection: close\r\n\r\n");
/*
fprintf(sfp,"Connection: close\r\n\r\n");
/*
@@
-556,8
+560,7
@@
FILE *open_socket(char *host, int port)
memset(&s_in, 0, sizeof(s_in));
s_in.sin_family = AF_INET;
memset(&s_in, 0, sizeof(s_in));
s_in.sin_family = AF_INET;
- if ((hp = (struct hostent *) gethostbyname(host)) == NULL)
- error_msg_and_die("cannot resolve %s", host);
+ hp = xgethostbyname(host);
memcpy(&s_in.sin_addr, hp->h_addr_list[0], hp->h_length);
s_in.sin_port = htons(port);
memcpy(&s_in.sin_addr, hp->h_addr_list[0], hp->h_length);
s_in.sin_port = htons(port);
@@
-813,7
+816,7
@@
progressmeter(int flag)
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: wget.c,v 1.
39 2001/05/15 17:51:37
andersen Exp $
+ * $Id: wget.c,v 1.
42 2001/06/21 19:45:06
andersen Exp $
*/
*/