From 1fc464f6fbecfc5d8ba9f7b98d19e21fb324bfb9 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Sat, 19 Sep 2015 00:45:05 +0200 Subject: cgtop: underline table header Let's underline the header line of the table shown by cgtop, how it is customary for tables. In order to do this, let's introduce new ANSI underline macros, and clean up the existing ones as side effect. --- src/journal/coredumpctl.c | 6 +++--- src/journal/journal-verify.c | 4 ++-- src/journal/journalctl.c | 10 +++++----- src/journal/test-journal-verify.c | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) (limited to 'src/journal') diff --git a/src/journal/coredumpctl.c b/src/journal/coredumpctl.c index 0546290318..6628e82421 100644 --- a/src/journal/coredumpctl.c +++ b/src/journal/coredumpctl.c @@ -402,11 +402,11 @@ static int print_info(FILE *file, sd_journal *j, bool need_space) { if (comm) fprintf(file, " PID: %s%s%s (%s)\n", - ansi_highlight(), strna(pid), ansi_highlight_off(), comm); + ansi_highlight(), strna(pid), ansi_normal(), comm); else fprintf(file, " PID: %s%s%s\n", - ansi_highlight(), strna(pid), ansi_highlight_off()); + ansi_highlight(), strna(pid), ansi_normal()); if (uid) { uid_t n; @@ -470,7 +470,7 @@ static int print_info(FILE *file, sd_journal *j, bool need_space) { if (cmdline) fprintf(file, " Command Line: %s\n", cmdline); if (exe) - fprintf(file, " Executable: %s%s%s\n", ansi_highlight(), exe, ansi_highlight_off()); + fprintf(file, " Executable: %s%s%s\n", ansi_highlight(), exe, ansi_normal()); if (cgroup) fprintf(file, " Control Group: %s\n", cgroup); if (unit) diff --git a/src/journal/journal-verify.c b/src/journal/journal-verify.c index 00f70d3a53..32d59c716f 100644 --- a/src/journal/journal-verify.c +++ b/src/journal/journal-verify.c @@ -53,12 +53,12 @@ static void draw_progress(uint64_t p, usec_t *last_usec) { j = (n * (unsigned) p) / 65535ULL; k = n - j; - fputs("\r\x1B[?25l" ANSI_HIGHLIGHT_GREEN_ON, stdout); + fputs("\r\x1B[?25l" ANSI_HIGHLIGHT_GREEN, stdout); for (i = 0; i < j; i++) fputs("\xe2\x96\x88", stdout); - fputs(ANSI_HIGHLIGHT_OFF, stdout); + fputs(ANSI_NORMAL, stdout); for (i = 0; i < k; i++) fputs("\xe2\x96\x91", stdout); diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c index 9b483413e7..b38b151485 100644 --- a/src/journal/journalctl.c +++ b/src/journal/journalctl.c @@ -1493,15 +1493,15 @@ static int setup_keys(void) { if (on_tty()) { fprintf(stderr, "\n" - "The new key pair has been generated. The " ANSI_HIGHLIGHT_ON "secret sealing key" ANSI_HIGHLIGHT_OFF " has been written to\n" + "The new key pair has been generated. The " ANSI_HIGHLIGHT "secret sealing key" ANSI_NORMAL " has been written to\n" "the following local file. This key file is automatically updated when the\n" "sealing key is advanced. It should not be used on multiple hosts.\n" "\n" "\t%s\n" "\n" - "Please write down the following " ANSI_HIGHLIGHT_ON "secret verification key" ANSI_HIGHLIGHT_OFF ". It should be stored\n" + "Please write down the following " ANSI_HIGHLIGHT "secret verification key" ANSI_NORMAL ". It should be stored\n" "at a safe location and should not be saved locally on disk.\n" - "\n\t" ANSI_HIGHLIGHT_RED_ON, p); + "\n\t" ANSI_HIGHLIGHT_RED, p); fflush(stderr); } for (i = 0; i < seed_size; i++) { @@ -1516,7 +1516,7 @@ static int setup_keys(void) { char tsb[FORMAT_TIMESPAN_MAX], *hn; fprintf(stderr, - ANSI_HIGHLIGHT_OFF "\n" + ANSI_NORMAL "\n" "The sealing key is automatically changed every %s.\n", format_timespan(tsb, sizeof(tsb), arg_interval, 0)); @@ -2144,7 +2144,7 @@ int main(int argc, char *argv[]) { if (previous_boot_id_valid && !sd_id128_equal(boot_id, previous_boot_id)) printf("%s-- Reboot --%s\n", - ansi_highlight(), ansi_highlight_off()); + ansi_highlight(), ansi_normal()); previous_boot_id = boot_id; previous_boot_id_valid = true; diff --git a/src/journal/test-journal-verify.c b/src/journal/test-journal-verify.c index 9dd9cb853f..d89123dc64 100644 --- a/src/journal/test-journal-verify.c +++ b/src/journal/test-journal-verify.c @@ -137,7 +137,7 @@ int main(int argc, char *argv[]) { log_info("[ %"PRIu64"+%"PRIu64"]", p / 8, p % 8); if (raw_verify("test.journal", verification_key) >= 0) - log_notice(ANSI_HIGHLIGHT_RED_ON ">>>> %"PRIu64" (bit %"PRIu64") can be toggled without detection." ANSI_HIGHLIGHT_OFF, p / 8, p % 8); + log_notice(ANSI_HIGHLIGHT_RED ">>>> %"PRIu64" (bit %"PRIu64") can be toggled without detection." ANSI_NORMAL, p / 8, p % 8); bit_toggle("test.journal", p); } -- cgit v1.2.3-54-g00ecf