summaryrefslogtreecommitdiff
path: root/src/basic
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2016-05-30 18:23:08 +0200
committerLennart Poettering <lennart@poettering.net>2016-05-30 18:23:08 +0200
commit7565bb98a45c51c7a79cbeda9905e5364c49e374 (patch)
tree35fbfc282a3abe3c4e8a72058f260a0d62b7821b /src/basic
parent54f8c958f1ebff12b961a1029a2aec451587c206 (diff)
tree-wide: check colors_enabled() before outputting ANSI color strings
Diffstat (limited to 'src/basic')
-rw-r--r--src/basic/terminal-util.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/basic/terminal-util.c b/src/basic/terminal-util.c
index 3189b8789d..2b90f2e5a1 100644
--- a/src/basic/terminal-util.c
+++ b/src/basic/terminal-util.c
@@ -155,14 +155,14 @@ int ask_char(char *ret, const char *replies, const char *text, ...) {
char c;
bool need_nl = true;
- if (on_tty())
+ if (colors_enabled())
fputs(ANSI_HIGHLIGHT, stdout);
va_start(ap, text);
vprintf(text, ap);
va_end(ap);
- if (on_tty())
+ if (colors_enabled())
fputs(ANSI_NORMAL, stdout);
fflush(stdout);
@@ -199,14 +199,14 @@ int ask_string(char **ret, const char *text, ...) {
char line[LINE_MAX];
va_list ap;
- if (on_tty())
+ if (colors_enabled())
fputs(ANSI_HIGHLIGHT, stdout);
va_start(ap, text);
vprintf(text, ap);
va_end(ap);
- if (on_tty())
+ if (colors_enabled())
fputs(ANSI_NORMAL, stdout);
fflush(stdout);