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) |
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) */ while ((s = gethdr(buf, sizeof(buf), sfp, &n)) != NULL) { if (strcasecmp(buf, "content-length") == 0) { - if (SAFE_STRTOOFF(s, &content_len) || content_len < 0) { + content_len = BB_STRTOOFF(s, NULL, 10); + if (errno || content_len < 0) { bb_error_msg_and_die("content-length %s is garbage", s); } got_clen = 1; @@ -402,7 +403,8 @@ int wget_main(int argc, char **argv) * Querying file size */ if (ftpcmd("SIZE ", target.path, sfp, buf) == 213) { - if (SAFE_STRTOOFF(buf+4, &content_len) || content_len < 0) { + content_len = BB_STRTOOFF(buf+4, NULL, 10); + if (errno || content_len < 0) { bb_error_msg_and_die("SIZE value is garbage"); } got_clen = 1; @@ -437,7 +439,7 @@ int wget_main(int argc, char **argv) } if (ftpcmd("RETR ", target.path, sfp, buf) > 150) - bb_error_msg_and_die("bad response to %s: %s", "RETR", buf); + bb_error_msg_and_die("bad response to RETR: %s", buf); } @@ -446,7 +448,7 @@ int wget_main(int argc, char **argv) */ if (chunked) { fgets(buf, sizeof(buf), dfp); - content_len = STRTOOFF(buf, (char **) NULL, 16); + content_len = STRTOOFF(buf, NULL, 16); /* FIXME: error check?? */ } @@ -480,7 +482,7 @@ int wget_main(int argc, char **argv) if (chunked) { safe_fgets(buf, sizeof(buf), dfp); /* This is a newline */ safe_fgets(buf, sizeof(buf), dfp); - content_len = STRTOOFF(buf, (char **) NULL, 16); + content_len = STRTOOFF(buf, NULL, 16); /* FIXME: error check? */ if (content_len == 0) { chunked = 0; /* all done! */ |