aboutsummaryrefslogtreecommitdiff
path: root/wget.c
diff options
context:
space:
mode:
authorandersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277>2000-09-14 21:46:30 +0000
committerandersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277>2000-09-14 21:46:30 +0000
commit1092ae283d9c70f2a1876269a6d479ebece0adac (patch)
tree605007988fd548de8a2c57a3d8bd50875c6a8252 /wget.c
parentfe7a20b973c4717df06a1437ec0012f1f3ccfcfe (diff)
downloadbusybox-w32-1092ae283d9c70f2a1876269a6d479ebece0adac.tar.gz
busybox-w32-1092ae283d9c70f2a1876269a6d479ebece0adac.tar.bz2
busybox-w32-1092ae283d9c70f2a1876269a6d479ebece0adac.zip
Bug fix for wget, and proper attribution of Chip Rosenthal and
Covad Communications for the contribution of wget. -Erik git-svn-id: svn://busybox.net/trunk/busybox@1050 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to '')
-rw-r--r--wget.c12
1 files changed, 4 insertions, 8 deletions
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)
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;