summaryrefslogtreecommitdiff
path: root/src/journal
diff options
context:
space:
mode:
authorDaniel Schaal <farbing@web.de>2013-08-02 07:59:02 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2013-08-04 08:33:02 -0400
commit0b5a519c89b5fb48ec7a3cfbd9c02283ae0f23ac (patch)
treef97494aceb6e7feb68c2ef554f4fa59485f6e7f1 /src/journal
parent92d700dea651e2a09ee75c7713b8387f11435cec (diff)
systemd-delta: Only print colors when on a tty
This make systemd-delta follow the behaviour of systemctl and journalctl. https://bugs.freedesktop.org/show_bug.cgi?id=67656 [zj: unify color query methods between those three programs.]
Diffstat (limited to 'src/journal')
-rw-r--r--src/journal/journalctl.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c
index dde2ed7e37..feea6bf19e 100644
--- a/src/journal/journalctl.c
+++ b/src/journal/journalctl.c
@@ -1605,14 +1605,13 @@ int main(int argc, char *argv[]) {
if (!arg_merge) {
sd_id128_t boot_id;
- const char *color_on = on_tty() ? ANSI_HIGHLIGHT_ON : "",
- *color_off = on_tty() ? ANSI_HIGHLIGHT_OFF : "";
r = sd_journal_get_monotonic_usec(j, NULL, &boot_id);
if (r >= 0) {
if (previous_boot_id_valid &&
!sd_id128_equal(boot_id, previous_boot_id))
- printf("%s-- Reboot --%s\n", color_on, color_off);
+ printf("%s-- Reboot --%s\n",
+ ansi_highlight(), ansi_highlight_off());
previous_boot_id = boot_id;
previous_boot_id_valid = true;