diff options
author | Eric Andersen <andersen@codepoet.org> | 2000-09-14 21:46:30 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2000-09-14 21:46:30 +0000 |
commit | 5d63884a8fb2ccf63f16c3be61849e859b762cd0 (patch) | |
tree | 605007988fd548de8a2c57a3d8bd50875c6a8252 | |
parent | 31e6829bd8661711b8f5ec3d8b4fb7cb6a512ca9 (diff) | |
download | busybox-w32-5d63884a8fb2ccf63f16c3be61849e859b762cd0.tar.gz busybox-w32-5d63884a8fb2ccf63f16c3be61849e859b762cd0.tar.bz2 busybox-w32-5d63884a8fb2ccf63f16c3be61849e859b762cd0.zip |
Bug fix for wget, and proper attribution of Chip Rosenthal and
Covad Communications for the contribution of wget.
-Erik
-rw-r--r-- | AUTHORS | 3 | ||||
-rw-r--r-- | Changelog | 2 | ||||
-rw-r--r-- | networking/wget.c | 12 | ||||
-rw-r--r-- | wget.c | 12 |
4 files changed, 13 insertions, 16 deletions
@@ -46,6 +46,9 @@ Glenn McGrath <bug1@netconnect.com.au> | |||
46 | Bruce Perens <bruce@pixar.com> | 46 | Bruce Perens <bruce@pixar.com> |
47 | Original author of BusyBox. His code is still in many apps. | 47 | Original author of BusyBox. His code is still in many apps. |
48 | 48 | ||
49 | Chip Rosenthal <chip@unicom.com>, <crosenth@covad.com> | ||
50 | wget - Contributed by permission of Covad Communications | ||
51 | |||
49 | Pavel Roskin <proski@gnu.org> | 52 | Pavel Roskin <proski@gnu.org> |
50 | Lots of bugs fixes and patches. | 53 | Lots of bugs fixes and patches. |
51 | 54 | ||
@@ -13,6 +13,8 @@ | |||
13 | Sterling Huxley <sterling@europa.com> | 13 | Sterling Huxley <sterling@europa.com> |
14 | * lsmod now uses the query_module syscall, rather then /proc | 14 | * lsmod now uses the query_module syscall, rather then /proc |
15 | * Added 'rdate' command from Sterling Huxley <sterling@europa.com> | 15 | * Added 'rdate' command from Sterling Huxley <sterling@europa.com> |
16 | * Added 'wget' command, contributed by Chip Rosenthal <chip@unicom.com>, | ||
17 | <crosenth@covad.com> and Covad Communications | ||
16 | * Added 'getopt' from "Alfred M. Szmidt" <ams@trillian.itslinux.org> | 18 | * Added 'getopt' from "Alfred M. Szmidt" <ams@trillian.itslinux.org> |
17 | * Fixed chmod option parsing so things like 'chmod -r /tmp/file' | 19 | * Fixed chmod option parsing so things like 'chmod -r /tmp/file' |
18 | wouldn't work (since it thought -r was an option). Doh! | 20 | wouldn't work (since it thought -r was an option). Doh! |
diff --git a/networking/wget.c b/networking/wget.c index 4f894fcaa..c06e76d90 100644 --- a/networking/wget.c +++ b/networking/wget.c | |||
@@ -50,7 +50,7 @@ int wget_main(int argc, char **argv) | |||
50 | ++do_continue; | 50 | ++do_continue; |
51 | break; | 51 | break; |
52 | case 'O': | 52 | case 'O': |
53 | fname_out = optarg; | 53 | fname_out = (strcmp(optarg, "-") == 0 ? NULL : optarg); |
54 | break; | 54 | break; |
55 | default: | 55 | default: |
56 | usage(wget_usage); | 56 | usage(wget_usage); |
@@ -74,12 +74,8 @@ int wget_main(int argc, char **argv) | |||
74 | * Open the output stream. | 74 | * Open the output stream. |
75 | */ | 75 | */ |
76 | if (fname_out != NULL) { | 76 | if (fname_out != NULL) { |
77 | /* Check if the file is supposed to go to stdout */ | 77 | if (freopen(fname_out, (do_continue ? "a" : "w"), stdout) == NULL) |
78 | if (!strcmp(fname_out, "-") == 0) { | 78 | fatalError("wget: freopen(%s): %s\n", fname_out, strerror(errno)); |
79 | /* Nope -- so open the output file */ | ||
80 | if (freopen(fname_out, (do_continue ? "a" : "w"), stdout) == NULL) | ||
81 | fatalError("wget: freopen(%s): %s\n", fname_out, strerror(errno)); | ||
82 | } | ||
83 | } | 79 | } |
84 | 80 | ||
85 | /* | 81 | /* |
@@ -248,7 +244,7 @@ char *gethdr(char *buf, size_t bufsiz, FILE *fp, int *istrunc) | |||
248 | return hdrval; | 244 | return hdrval; |
249 | } | 245 | } |
250 | 246 | ||
251 | /* Rat! The buffer isn't big enough to hold the entire header value. */ | 247 | /* Rats! The buffer isn't big enough to hold the entire header value. */ |
252 | while (c = getc(fp), c != EOF && c != '\n') | 248 | while (c = getc(fp), c != EOF && c != '\n') |
253 | ; | 249 | ; |
254 | *istrunc = 1; | 250 | *istrunc = 1; |
@@ -50,7 +50,7 @@ int wget_main(int argc, char **argv) | |||
50 | ++do_continue; | 50 | ++do_continue; |
51 | break; | 51 | break; |
52 | case 'O': | 52 | case 'O': |
53 | fname_out = optarg; | 53 | fname_out = (strcmp(optarg, "-") == 0 ? NULL : optarg); |
54 | break; | 54 | break; |
55 | default: | 55 | default: |
56 | usage(wget_usage); | 56 | usage(wget_usage); |
@@ -74,12 +74,8 @@ int wget_main(int argc, char **argv) | |||
74 | * Open the output stream. | 74 | * Open the output stream. |
75 | */ | 75 | */ |
76 | if (fname_out != NULL) { | 76 | if (fname_out != NULL) { |
77 | /* Check if the file is supposed to go to stdout */ | 77 | if (freopen(fname_out, (do_continue ? "a" : "w"), stdout) == NULL) |
78 | if (!strcmp(fname_out, "-") == 0) { | 78 | fatalError("wget: freopen(%s): %s\n", fname_out, strerror(errno)); |
79 | /* Nope -- so open the output file */ | ||
80 | if (freopen(fname_out, (do_continue ? "a" : "w"), stdout) == NULL) | ||
81 | fatalError("wget: freopen(%s): %s\n", fname_out, strerror(errno)); | ||
82 | } | ||
83 | } | 79 | } |
84 | 80 | ||
85 | /* | 81 | /* |
@@ -248,7 +244,7 @@ char *gethdr(char *buf, size_t bufsiz, FILE *fp, int *istrunc) | |||
248 | return hdrval; | 244 | return hdrval; |
249 | } | 245 | } |
250 | 246 | ||
251 | /* Rat! The buffer isn't big enough to hold the entire header value. */ | 247 | /* Rats! The buffer isn't big enough to hold the entire header value. */ |
252 | while (c = getc(fp), c != EOF && c != '\n') | 248 | while (c = getc(fp), c != EOF && c != '\n') |
253 | ; | 249 | ; |
254 | *istrunc = 1; | 250 | *istrunc = 1; |