summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2011-07-07 03:30:47 +0200
committerLennart Poettering <lennart@poettering.net>2011-07-07 03:30:47 +0200
commitef3a24de028efe885db1303b4843aba5ffd0f531 (patch)
tree6e953e0ce290386713b6700e56c761789c905243
parent3b0727f5ec728206bf0db669088c9aa9ebb3c829 (diff)
systemctl: use cached tty value where possible
-rw-r--r--src/systemctl.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/systemctl.c b/src/systemctl.c
index 6b4f981061..3b12441c80 100644
--- a/src/systemctl.c
+++ b/src/systemctl.c
@@ -785,7 +785,7 @@ static int dot(DBusConnection *bus, char **args, unsigned n) {
" red = Conflicts\n"
" green = After\n");
- if (isatty(fileno(stdout)))
+ if (on_tty())
log_notice("-- You probably want to process this output with graphviz' dot tool.\n"
"-- Try a shell pipeline like 'systemctl dot | dot -Tsvg > systemd.svg'!\n");
@@ -841,7 +841,7 @@ static int list_jobs(DBusConnection *bus, char **args, unsigned n) {
dbus_message_iter_recurse(&iter, &sub);
- if (isatty(STDOUT_FILENO))
+ if (on_tty())
printf("%4s %-25s %-15s %-7s\n", "JOB", "UNIT", "TYPE", "STATE");
while (dbus_message_iter_get_arg_type(&sub) != DBUS_TYPE_INVALID) {
@@ -877,7 +877,7 @@ static int list_jobs(DBusConnection *bus, char **args, unsigned n) {
dbus_message_iter_next(&sub);
}
- if (isatty(STDOUT_FILENO))
+ if (on_tty())
printf("\n%u jobs listed.\n", k);
r = 0;