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:
parent
146f9b6e5b
commit
51b0b001d3
|
@ -30,15 +30,16 @@ void string_list_print_by_column(struct string_list *sl)
|
||||||
if (!len)
|
if (!len)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
num = 80 / len;
|
num = 80 / (len + 1);
|
||||||
if (len == 0)
|
if (len == 0)
|
||||||
len = 1;
|
len = 1;
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
list_for_each_entry(entry, &sl->list, list) {
|
list_for_each_entry(entry, &sl->list, list) {
|
||||||
printf("%-*s ", len, entry->str);
|
|
||||||
if (!(++i % num))
|
if (!(++i % num))
|
||||||
printf("\n");
|
printf("%s\n", entry->str);
|
||||||
|
else
|
||||||
|
printf("%-*s", len, entry->str);
|
||||||
}
|
}
|
||||||
if (i % num)
|
if (i % num)
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
|
Loading…
Reference in New Issue