From 5d63884a8fb2ccf63f16c3be61849e859b762cd0 Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Thu, 14 Sep 2000 21:46:30 +0000 Subject: [PATCH] Bug fix for wget, and proper attribution of Chip Rosenthal and Covad Communications for the contribution of wget. -Erik --- AUTHORS | 3 +++ Changelog | 2 ++ networking/wget.c | 12 ++++-------- wget.c | 12 ++++-------- 4 files changed, 13 insertions(+), 16 deletions(-) diff --git a/AUTHORS b/AUTHORS index 918a0015b..441e7f792 100644 --- a/AUTHORS +++ b/AUTHORS @@ -46,6 +46,9 @@ Glenn McGrath Bruce Perens Original author of BusyBox. His code is still in many apps. +Chip Rosenthal , + wget - Contributed by permission of Covad Communications + Pavel Roskin Lots of bugs fixes and patches. diff --git a/Changelog b/Changelog index 086ff2f81..958d7753f 100644 --- a/Changelog +++ b/Changelog @@ -13,6 +13,8 @@ Sterling Huxley * lsmod now uses the query_module syscall, rather then /proc * Added 'rdate' command from Sterling Huxley + * Added 'wget' command, contributed by Chip Rosenthal , + and Covad Communications * Added 'getopt' from "Alfred M. Szmidt" * Fixed chmod option parsing so things like 'chmod -r /tmp/file' 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) ++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; diff --git a/wget.c b/wget.c index 4f894fcaa..c06e76d90 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; -- 2.25.1