diff options
author | Lennart Poettering <lennart@poettering.net> | 2016-05-30 18:23:08 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2016-05-30 18:23:08 +0200 |
commit | 7565bb98a45c51c7a79cbeda9905e5364c49e374 (patch) | |
tree | 35fbfc282a3abe3c4e8a72058f260a0d62b7821b /src/journal | |
parent | 54f8c958f1ebff12b961a1029a2aec451587c206 (diff) |
tree-wide: check colors_enabled() before outputting ANSI color strings
Diffstat (limited to 'src/journal')
-rw-r--r-- | src/journal/journal-verify.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/journal/journal-verify.c b/src/journal/journal-verify.c index 26572ddd76..a37316b8f9 100644 --- a/src/journal/journal-verify.c +++ b/src/journal/journal-verify.c @@ -54,7 +54,9 @@ static void draw_progress(uint64_t p, usec_t *last_usec) { j = (n * (unsigned) p) / 65535ULL; k = n - j; - fputs("\r\x1B[?25l" ANSI_HIGHLIGHT_GREEN, stdout); + fputs("\r", stdout); + if (colors_enabled()) + fputs("\x1B[?25l" ANSI_HIGHLIGHT_GREEN, stdout); for (i = 0; i < j; i++) fputs("\xe2\x96\x88", stdout); @@ -66,7 +68,10 @@ static void draw_progress(uint64_t p, usec_t *last_usec) { printf(" %3"PRIu64"%%", 100U * p / 65535U); - fputs("\r\x1B[?25h", stdout); + fputs("\r", stdout); + if (colors_enabled()) + fputs("\x1B[?25h", stdout); + fflush(stdout); } |