mirror of
https://github.com/systemd/systemd.git
synced 2024-12-26 03:22:00 +03:00
format-table: before outputting a color, check if colors are available
This is in many cases redundant, as a similar check is done by various callers already, but in other cases (where we read the color from a static table for example), it's nice to let the color check be done by the table code itself, and since it doesn't hurt in the other cases just do it again.
This commit is contained in:
parent
165ca5663e
commit
a22318e554
@ -1209,13 +1209,13 @@ int table_print(Table *t, FILE *f) {
|
||||
if (j > 0)
|
||||
fputc(' ', f); /* column separator */
|
||||
|
||||
if (d->color)
|
||||
if (d->color && colors_enabled())
|
||||
fputs(d->color, f);
|
||||
|
||||
fputs(field, f);
|
||||
|
||||
if (d->color)
|
||||
fputs(ansi_normal(), f);
|
||||
if (d->color && colors_enabled())
|
||||
fputs(ANSI_NORMAL, f);
|
||||
}
|
||||
|
||||
fputc('\n', f);
|
||||
|
Loading…
Reference in New Issue
Block a user