systemctl: don't do ANSI underlining on TERM=linux (#6778)

The linux console apparently can't do underlining, hence let's not do it
on the console.

Also see: #6601
This commit is contained in:
Lennart Poettering
2017-09-09 22:48:35 +02:00
committed by Zbigniew Jędrzejewski-Szmek
parent c5aaaebced
commit 526664f627
2 changed files with 32 additions and 6 deletions
+16
View File
@@ -1228,6 +1228,22 @@ bool colors_enabled(void) {
return enabled;
}
bool underline_enabled(void) {
static int enabled = -1;
if (enabled < 0) {
/* The Linux console doesn't support underlining, turn it off, but only there. */
if (!colors_enabled())
enabled = false;
else
enabled = !streq_ptr(getenv("TERM"), "linux");
}
return enabled;
}
int vt_default_utf8(void) {
_cleanup_free_ char *b = NULL;
int r;