summaryrefslogtreecommitdiffstats
path: root/src/shared/logs-show.c
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2021-01-17 22:37:18 +0100
committerYu Watanabe <watanabe.yu+github@gmail.com>2021-01-25 12:52:20 +0100
commitcd7ae1b44e48b4658476d65fe4b104a75ef05d43 (patch)
tree24aa535fc05b5e8147ad5ea61b8ef78806cbaeed /src/shared/logs-show.c
parentterminal-util: use ansi_normal() or friends instead of ANSI_NORMAL (diff)
downloadsystemd-cd7ae1b44e48b4658476d65fe4b104a75ef05d43.tar.xz
systemd-cd7ae1b44e48b4658476d65fe4b104a75ef05d43.zip
logs-show: simplify code
Diffstat (limited to 'src/shared/logs-show.c')
-rw-r--r--src/shared/logs-show.c15
1 files changed, 3 insertions, 12 deletions
diff --git a/src/shared/logs-show.c b/src/shared/logs-show.c
index 6a1810888c..e60ee50e1c 100644
--- a/src/shared/logs-show.c
+++ b/src/shared/logs-show.c
@@ -66,26 +66,17 @@ static int print_catalog(FILE *f, sd_journal *j) {
else
prefix = "--";
- if (colors_enabled())
- newline = strjoina(ANSI_NORMAL "\n", ansi_grey(), prefix, ANSI_NORMAL " ", ansi_green());
- else
- newline = strjoina("\n", prefix, " ");
+ newline = strjoina(ansi_normal(), "\n", ansi_grey(), prefix, ansi_normal(), " ", ansi_green());
z = strreplace(strstrip(t), "\n", newline);
if (!z)
return log_oom();
- if (colors_enabled())
- fprintf(f, "%s%s %s%s", ansi_grey(), prefix, ANSI_NORMAL, ansi_green());
- else
- fprintf(f, "%s ", prefix);
+ fprintf(f, "%s%s %s%s", ansi_grey(), prefix, ansi_normal(), ansi_green());
fputs(z, f);
- if (colors_enabled())
- fputs(ANSI_NORMAL "\n", f);
- else
- fputc('\n', f);
+ fprintf(f, "%s\n", ansi_normal());
return 1;
}