diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2006-11-27 14:43:21 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2006-11-27 14:43:21 +0000 |
commit | d686a045c8134d3a42fa5cc6b2e09118e08d603f (patch) | |
tree | 38f509fc9556f68f758c77b06b480cc33b2725eb /networking/wget.c | |
parent | 8a0a83d503a7971895254efa9e79cf15ba1850d4 (diff) | |
download | busybox-w32-d686a045c8134d3a42fa5cc6b2e09118e08d603f.tar.gz busybox-w32-d686a045c8134d3a42fa5cc6b2e09118e08d603f.tar.bz2 busybox-w32-d686a045c8134d3a42fa5cc6b2e09118e08d603f.zip |
safe_strtoXX interface proved to be a bit unconvenient.
Remove it, introduce saner bb_strtoXX.
Saved ~350 bytes.
Diffstat (limited to 'networking/wget.c')
-rw-r--r-- | networking/wget.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/networking/wget.c b/networking/wget.c index 1e51ce96b..49ebda73c 100644 --- a/networking/wget.c +++ b/networking/wget.c | |||
@@ -335,7 +335,8 @@ int wget_main(int argc, char **argv) | |||
335 | */ | 335 | */ |
336 | while ((s = gethdr(buf, sizeof(buf), sfp, &n)) != NULL) { | 336 | while ((s = gethdr(buf, sizeof(buf), sfp, &n)) != NULL) { |
337 | if (strcasecmp(buf, "content-length") == 0) { | 337 | if (strcasecmp(buf, "content-length") == 0) { |
338 | if (SAFE_STRTOOFF(s, &content_len) || content_len < 0) { | 338 | content_len = BB_STRTOOFF(s, NULL, 10); |
339 | if (errno || content_len < 0) { | ||
339 | bb_error_msg_and_die("content-length %s is garbage", s); | 340 | bb_error_msg_and_die("content-length %s is garbage", s); |
340 | } | 341 | } |
341 | got_clen = 1; | 342 | got_clen = 1; |
@@ -402,7 +403,8 @@ int wget_main(int argc, char **argv) | |||
402 | * Querying file size | 403 | * Querying file size |
403 | */ | 404 | */ |
404 | if (ftpcmd("SIZE ", target.path, sfp, buf) == 213) { | 405 | if (ftpcmd("SIZE ", target.path, sfp, buf) == 213) { |
405 | if (SAFE_STRTOOFF(buf+4, &content_len) || content_len < 0) { | 406 | content_len = BB_STRTOOFF(buf+4, NULL, 10); |
407 | if (errno || content_len < 0) { | ||
406 | bb_error_msg_and_die("SIZE value is garbage"); | 408 | bb_error_msg_and_die("SIZE value is garbage"); |
407 | } | 409 | } |
408 | got_clen = 1; | 410 | got_clen = 1; |
@@ -437,7 +439,7 @@ int wget_main(int argc, char **argv) | |||
437 | } | 439 | } |
438 | 440 | ||
439 | if (ftpcmd("RETR ", target.path, sfp, buf) > 150) | 441 | if (ftpcmd("RETR ", target.path, sfp, buf) > 150) |
440 | bb_error_msg_and_die("bad response to %s: %s", "RETR", buf); | 442 | bb_error_msg_and_die("bad response to RETR: %s", buf); |
441 | } | 443 | } |
442 | 444 | ||
443 | 445 | ||
@@ -446,7 +448,7 @@ int wget_main(int argc, char **argv) | |||
446 | */ | 448 | */ |
447 | if (chunked) { | 449 | if (chunked) { |
448 | fgets(buf, sizeof(buf), dfp); | 450 | fgets(buf, sizeof(buf), dfp); |
449 | content_len = STRTOOFF(buf, (char **) NULL, 16); | 451 | content_len = STRTOOFF(buf, NULL, 16); |
450 | /* FIXME: error check?? */ | 452 | /* FIXME: error check?? */ |
451 | } | 453 | } |
452 | 454 | ||
@@ -480,7 +482,7 @@ int wget_main(int argc, char **argv) | |||
480 | if (chunked) { | 482 | if (chunked) { |
481 | safe_fgets(buf, sizeof(buf), dfp); /* This is a newline */ | 483 | safe_fgets(buf, sizeof(buf), dfp); /* This is a newline */ |
482 | safe_fgets(buf, sizeof(buf), dfp); | 484 | safe_fgets(buf, sizeof(buf), dfp); |
483 | content_len = STRTOOFF(buf, (char **) NULL, 16); | 485 | content_len = STRTOOFF(buf, NULL, 16); |
484 | /* FIXME: error check? */ | 486 | /* FIXME: error check? */ |
485 | if (content_len == 0) { | 487 | if (content_len == 0) { |
486 | chunked = 0; /* all done! */ | 488 | chunked = 0; /* all done! */ |