9
0
Fork 0

stringlist: Fix printing on smaller consoles

Do not add additional space between strings, we already
did this by adding 4 to the string length.

Signed-off-by: Sascha Hauer <sha@pengutronix.de>
This commit is contained in:
Sascha Hauer 2009-10-13 16:47:35 +02:00
parent 146f9b6e5b
commit 51b0b001d3
1 changed files with 4 additions and 3 deletions

View File

@ -30,15 +30,16 @@ void string_list_print_by_column(struct string_list *sl)
if (!len)
return;
num = 80 / len;
num = 80 / (len + 1);
if (len == 0)
len = 1;
i = 0;
list_for_each_entry(entry, &sl->list, list) {
printf("%-*s ", len, entry->str);
if (!(++i % num))
printf("\n");
printf("%s\n", entry->str);
else
printf("%-*s", len, entry->str);
}
if (i % num)
printf("\n");