wget: wrap one atrociously long line (around 200 chars long!).

This commit is contained in:
Denis Vlasenko 2006-09-09 12:20:57 +00:00
parent d797fcd726
commit 3526a1320a

View File

@ -100,8 +100,8 @@ static char *safe_fgets(char *s, int size, FILE *stream)
/*
* Base64-encode character string and return the string.
*/
static char *base64enc(unsigned char *p, char *buf, int len) {
static char *base64enc(unsigned char *p, char *buf, int len)
{
bb_uuencode(p, buf, len, bb_uuenc_tbl_base64);
return buf;
}
@ -182,7 +182,8 @@ int wget_main(int argc, char **argv)
while (headers_llist) {
int arglen = strlen(headers_llist->data);
if (extra_headers_left - arglen - 2 <= 0)
bb_error_msg_and_die("extra_headers buffer too small(need %i)", extra_headers_left - arglen);
bb_error_msg_and_die("extra_headers buffer too small "
"(need %i)", extra_headers_left - arglen);
strcpy(extra_headers_ptr, headers_llist->data);
extra_headers_ptr += arglen;
extra_headers_left -= ( arglen + 2 );
@ -253,7 +254,7 @@ int wget_main(int argc, char **argv)
*/
if (do_continue) {
if (fstat(fileno(output), &sbuf) < 0)
bb_perror_msg_and_die("fstat()");
bb_perror_msg_and_die("fstat");
if (sbuf.st_size > 0)
beg_range = sbuf.st_size;
else
@ -266,7 +267,7 @@ int wget_main(int argc, char **argv)
bb_lookup_host(&s_in, server.host);
s_in.sin_port = server.port;
if (quiet_flag == FALSE) {
fprintf(stdout, "Connecting to %s[%s]:%d\n",
printf("Connecting to %s[%s]:%d\n",
server.host, inet_ntoa(s_in.sin_addr), ntohs(server.port));
}
@ -480,7 +481,13 @@ read_response:
progressmeter(-1);
do {
while ((filesize > 0 || !got_clen) && (n = safe_fread(buf, 1, ((chunked || got_clen) && (filesize < sizeof(buf)) ? filesize : sizeof(buf)), dfp)) > 0) {
while (filesize > 0 || !got_clen) {
unsigned rdsz = sizeof(buf);
if (filesize < sizeof(buf) && (chunked || got_clen))
rdsz = filesize;
n = safe_fread(buf, 1, rdsz, dfp);
if (n <= 0)
break;
if (safe_fwrite(buf, 1, n, output) != n) {
bb_perror_msg_and_die(bb_msg_write_error);
}
@ -580,7 +587,7 @@ FILE *open_socket(struct sockaddr_in *s_in)
fp = fdopen(xconnect(s_in), "r+");
if (fp == NULL)
bb_perror_msg_and_die("fdopen()");
bb_perror_msg_and_die("fdopen");
return fp;
}
@ -645,7 +652,7 @@ static int ftpcmd(char *s1, char *s2, FILE *fp, char *buf)
char *buf_ptr;
if (fgets(buf, 510, fp) == NULL) {
bb_perror_msg_and_die("fgets()");
bb_perror_msg_and_die("fgets");
}
buf_ptr = strstr(buf, "\r\n");
if (buf_ptr) {