mirror of
https://github.com/moparisthebest/wget
synced 2024-07-03 16:38:41 -04:00
wget: Fix --version wrapping issue
This commit is contained in:
parent
ffb94036f2
commit
a12bd59111
@ -1,3 +1,7 @@
|
||||
2013-08-08 Will Dietz <w@wdtz.org> (tiny change):
|
||||
|
||||
* main.c (format_and_print_line): Wrap correctly long tokens.
|
||||
|
||||
2013-07-16 Darshit Shah <darnir@gmail.com>
|
||||
|
||||
* wget.h (err_t): Added new errors, ATTRMISSING and UNKNOWNATTR to
|
||||
|
11
src/main.c
11
src/main.c
@ -840,15 +840,16 @@ format_and_print_line (const char *prefix, const char *line,
|
||||
|
||||
assert (prefix != NULL);
|
||||
assert (line != NULL);
|
||||
assert (line_length > TABULATION);
|
||||
|
||||
line_dup = xstrdup (line);
|
||||
|
||||
if (line_length <= 0)
|
||||
line_length = MAX_CHARS_PER_LINE - TABULATION;
|
||||
|
||||
if (printf ("%s", prefix) < 0)
|
||||
return -1;
|
||||
remaining_chars = line_length;
|
||||
|
||||
/* Wrap to new line after prefix. */
|
||||
remaining_chars = 0;
|
||||
|
||||
/* We break on spaces. */
|
||||
token = strtok (line_dup, " ");
|
||||
while (token != NULL)
|
||||
@ -856,7 +857,7 @@ format_and_print_line (const char *prefix, const char *line,
|
||||
/* If however a token is much larger than the maximum
|
||||
line length, all bets are off and we simply print the
|
||||
token on the next line. */
|
||||
if (remaining_chars <= strlen (token))
|
||||
if (remaining_chars <= (int) strlen (token))
|
||||
{
|
||||
if (printf ("\n%*c", TABULATION, ' ') < 0)
|
||||
return -1;
|
||||
|
Loading…
Reference in New Issue
Block a user