summaryrefslogtreecommitdiff
path: root/wget.c
diff options
context:
space:
mode:
authorEric Andersen2000-09-14 21:46:30 +0000
committerEric Andersen2000-09-14 21:46:30 +0000
commit5d63884a8fb2ccf63f16c3be61849e859b762cd0 (patch)
tree605007988fd548de8a2c57a3d8bd50875c6a8252 /wget.c
parent31e6829bd8661711b8f5ec3d8b4fb7cb6a512ca9 (diff)
downloadbusybox-5d63884a8fb2ccf63f16c3be61849e859b762cd0.zip
busybox-5d63884a8fb2ccf63f16c3be61849e859b762cd0.tar.gz
Bug fix for wget, and proper attribution of Chip Rosenthal and
Covad Communications for the contribution of wget. -Erik
Diffstat (limited to 'wget.c')
-rw-r--r--wget.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/wget.c b/wget.c
index 4f894fc..c06e76d 100644
--- a/wget.c
+++ b/wget.c
@@ -50,7 +50,7 @@ int wget_main(int argc, char **argv)
++do_continue;
break;
case 'O':
- fname_out = optarg;
+ fname_out = (strcmp(optarg, "-") == 0 ? NULL : optarg);
break;
default:
usage(wget_usage);
@@ -74,12 +74,8 @@ int wget_main(int argc, char **argv)
* Open the output stream.
*/
if (fname_out != NULL) {
- /* Check if the file is supposed to go to stdout */
- if (!strcmp(fname_out, "-") == 0) {
- /* Nope -- so open the output file */
- if (freopen(fname_out, (do_continue ? "a" : "w"), stdout) == NULL)
- fatalError("wget: freopen(%s): %s\n", fname_out, strerror(errno));
- }
+ if (freopen(fname_out, (do_continue ? "a" : "w"), stdout) == NULL)
+ fatalError("wget: freopen(%s): %s\n", fname_out, strerror(errno));
}
/*
@@ -248,7 +244,7 @@ char *gethdr(char *buf, size_t bufsiz, FILE *fp, int *istrunc)
return hdrval;
}
- /* Rat! The buffer isn't big enough to hold the entire header value. */
+ /* Rats! The buffer isn't big enough to hold the entire header value. */
while (c = getc(fp), c != EOF && c != '\n')
;
*istrunc = 1;