}
const char *default_term_for_tty(const char *tty) {
- return tty && tty_is_vc_resolve(tty) ? "TERM=linux" : "TERM=vt220";
+ return tty && tty_is_vc_resolve(tty) ? "linux" : "vt220";
}
#endif // 0
}
#endif // 0
-static bool getenv_terminal_is_dumb(void) {
+bool terminal_is_dumb(void) {
const char *e;
+ if (!on_tty())
+ return true;
+
e = getenv("TERM");
if (!e)
return true;
return streq(e, "dumb");
}
-bool terminal_is_dumb(void) {
- if (!on_tty())
- return true;
-
- return getenv_terminal_is_dumb();
-}
-
bool colors_enabled(void) {
static int enabled = -1;
colors = getenv("SYSTEMD_COLORS");
if (colors)
enabled = parse_boolean(colors) != 0;
- else if (getpid() == 1)
- /* PID1 outputs to the console without holding it open all the time */
- enabled = !getenv_terminal_is_dumb();
else
enabled = !terminal_is_dumb();
}