Bug fix for wget, and proper attribution of Chip Rosenthal and

Covad Communications for the contribution of wget.
 -Erik
This commit is contained in:
Eric Andersen 2000-09-14 21:46:30 +00:00
parent 31e6829bd8
commit 5d63884a8f
4 changed files with 13 additions and 16 deletions

View File

@ -46,6 +46,9 @@ Glenn McGrath <bug1@netconnect.com.au>
Bruce Perens <bruce@pixar.com> Bruce Perens <bruce@pixar.com>
Original author of BusyBox. His code is still in many apps. Original author of BusyBox. His code is still in many apps.
Chip Rosenthal <chip@unicom.com>, <crosenth@covad.com>
wget - Contributed by permission of Covad Communications
Pavel Roskin <proski@gnu.org> Pavel Roskin <proski@gnu.org>
Lots of bugs fixes and patches. Lots of bugs fixes and patches.

View File

@ -13,6 +13,8 @@
Sterling Huxley <sterling@europa.com> Sterling Huxley <sterling@europa.com>
* lsmod now uses the query_module syscall, rather then /proc * lsmod now uses the query_module syscall, rather then /proc
* Added 'rdate' command from Sterling Huxley <sterling@europa.com> * Added 'rdate' command from Sterling Huxley <sterling@europa.com>
* Added 'wget' command, contributed by Chip Rosenthal <chip@unicom.com>,
<crosenth@covad.com> and Covad Communications
* Added 'getopt' from "Alfred M. Szmidt" <ams@trillian.itslinux.org> * Added 'getopt' from "Alfred M. Szmidt" <ams@trillian.itslinux.org>
* Fixed chmod option parsing so things like 'chmod -r /tmp/file' * Fixed chmod option parsing so things like 'chmod -r /tmp/file'
wouldn't work (since it thought -r was an option). Doh! wouldn't work (since it thought -r was an option). Doh!

View File

@ -50,7 +50,7 @@ int wget_main(int argc, char **argv)
++do_continue; ++do_continue;
break; break;
case 'O': case 'O':
fname_out = optarg; fname_out = (strcmp(optarg, "-") == 0 ? NULL : optarg);
break; break;
default: default:
usage(wget_usage); usage(wget_usage);
@ -74,12 +74,8 @@ int wget_main(int argc, char **argv)
* Open the output stream. * Open the output stream.
*/ */
if (fname_out != NULL) { if (fname_out != NULL) {
/* Check if the file is supposed to go to stdout */ if (freopen(fname_out, (do_continue ? "a" : "w"), stdout) == NULL)
if (!strcmp(fname_out, "-") == 0) { fatalError("wget: freopen(%s): %s\n", fname_out, strerror(errno));
/* 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));
}
} }
/* /*
@ -248,7 +244,7 @@ char *gethdr(char *buf, size_t bufsiz, FILE *fp, int *istrunc)
return hdrval; 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') while (c = getc(fp), c != EOF && c != '\n')
; ;
*istrunc = 1; *istrunc = 1;

12
wget.c
View File

@ -50,7 +50,7 @@ int wget_main(int argc, char **argv)
++do_continue; ++do_continue;
break; break;
case 'O': case 'O':
fname_out = optarg; fname_out = (strcmp(optarg, "-") == 0 ? NULL : optarg);
break; break;
default: default:
usage(wget_usage); usage(wget_usage);
@ -74,12 +74,8 @@ int wget_main(int argc, char **argv)
* Open the output stream. * Open the output stream.
*/ */
if (fname_out != NULL) { if (fname_out != NULL) {
/* Check if the file is supposed to go to stdout */ if (freopen(fname_out, (do_continue ? "a" : "w"), stdout) == NULL)
if (!strcmp(fname_out, "-") == 0) { fatalError("wget: freopen(%s): %s\n", fname_out, strerror(errno));
/* 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));
}
} }
/* /*
@ -248,7 +244,7 @@ char *gethdr(char *buf, size_t bufsiz, FILE *fp, int *istrunc)
return hdrval; 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') while (c = getc(fp), c != EOF && c != '\n')
; ;
*istrunc = 1; *istrunc = 1;