]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
cgtop: underline table header
authorLennart Poettering <lennart@poettering.net>
Fri, 18 Sep 2015 22:45:05 +0000 (00:45 +0200)
committerLennart Poettering <lennart@poettering.net>
Tue, 22 Sep 2015 14:30:42 +0000 (16:30 +0200)
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.

24 files changed:
src/analyze/analyze.c
src/basic/log.c
src/basic/terminal-util.c
src/basic/terminal-util.h
src/cgtop/cgtop.c
src/core/failure-action.c
src/core/job.c
src/core/main.c
src/core/manager.c
src/core/transaction.c
src/delta/delta.c
src/journal/coredumpctl.c
src/journal/journal-verify.c
src/journal/journalctl.c
src/journal/test-journal-verify.c
src/libsystemd/sd-bus/bus-dump.c
src/libsystemd/sd-bus/busctl.c
src/machine/machinectl.c
src/network/networkctl.c
src/shared/ask-password-api.c
src/shared/logs-show.c
src/systemctl/systemctl.c
src/test/test-strip-tab-ansi.c
src/timedate/timedatectl.c

index d1ff156d12a55018ba5b8b2dfbd6195f064d862d..3657ef50f1a9b1ff805056a10779dbab6599f323 100644 (file)
@@ -759,9 +759,9 @@ static int list_dependencies_print(const char *name, unsigned int level, unsigne
 
         if (times) {
                 if (times->time)
-                        printf("%s%s @%s +%s%s", ANSI_HIGHLIGHT_RED_ON, name,
+                        printf("%s%s @%s +%s%s", ANSI_HIGHLIGHT_RED, name,
                                format_timespan(ts, sizeof(ts), times->activating - boot->userspace_time, USEC_PER_MSEC),
-                               format_timespan(ts2, sizeof(ts2), times->time, USEC_PER_MSEC), ANSI_HIGHLIGHT_OFF);
+                               format_timespan(ts2, sizeof(ts2), times->time, USEC_PER_MSEC), ANSI_NORMAL);
                 else if (times->activated > boot->userspace_time)
                         printf("%s @%s", name, format_timespan(ts, sizeof(ts), times->activated - boot->userspace_time, USEC_PER_MSEC));
                 else
@@ -927,8 +927,8 @@ static int list_dependencies(sd_bus *bus, const char *name) {
 
         if (times) {
                 if (times->time)
-                        printf("%s%s +%s%s\n", ANSI_HIGHLIGHT_RED_ON, id,
-                               format_timespan(ts, sizeof(ts), times->time, USEC_PER_MSEC), ANSI_HIGHLIGHT_OFF);
+                        printf("%s%s +%s%s\n", ANSI_HIGHLIGHT_RED, id,
+                               format_timespan(ts, sizeof(ts), times->time, USEC_PER_MSEC), ANSI_NORMAL);
                 else if (times->activated > boot->userspace_time)
                         printf("%s @%s\n", id, format_timespan(ts, sizeof(ts), times->activated - boot->userspace_time, USEC_PER_MSEC));
                 else
index b96afc4de4ffb93e982da40505f02d526f40e8e4..38f42b3a6e3cf23ab4e9a96be6065c999d81c0ea 100644 (file)
@@ -340,10 +340,10 @@ static int write_to_console(
         }
 
         if (highlight)
-                IOVEC_SET_STRING(iovec[n++], ANSI_HIGHLIGHT_RED_ON);
+                IOVEC_SET_STRING(iovec[n++], ANSI_HIGHLIGHT_RED);
         IOVEC_SET_STRING(iovec[n++], buffer);
         if (highlight)
-                IOVEC_SET_STRING(iovec[n++], ANSI_HIGHLIGHT_OFF);
+                IOVEC_SET_STRING(iovec[n++], ANSI_NORMAL);
         IOVEC_SET_STRING(iovec[n++], "\n");
 
         if (writev(console_fd, iovec, n) < 0) {
index c5ef5ab0d1e311ed5b4406039d667707eca687e3..dd3d525854a2ec72e714354c0df0f1daab907339 100644 (file)
@@ -139,14 +139,14 @@ int ask_char(char *ret, const char *replies, const char *text, ...) {
                 bool need_nl = true;
 
                 if (on_tty())
-                        fputs(ANSI_HIGHLIGHT_ON, stdout);
+                        fputs(ANSI_HIGHLIGHT, stdout);
 
                 va_start(ap, text);
                 vprintf(text, ap);
                 va_end(ap);
 
                 if (on_tty())
-                        fputs(ANSI_HIGHLIGHT_OFF, stdout);
+                        fputs(ANSI_NORMAL, stdout);
 
                 fflush(stdout);
 
@@ -183,14 +183,14 @@ int ask_string(char **ret, const char *text, ...) {
                 va_list ap;
 
                 if (on_tty())
-                        fputs(ANSI_HIGHLIGHT_ON, stdout);
+                        fputs(ANSI_HIGHLIGHT, stdout);
 
                 va_start(ap, text);
                 vprintf(text, ap);
                 va_end(ap);
 
                 if (on_tty())
-                        fputs(ANSI_HIGHLIGHT_OFF, stdout);
+                        fputs(ANSI_NORMAL, stdout);
 
                 fflush(stdout);
 
index b9a3809a6c821745a5c741c871455f036cf5cc77..a9e325ccb319b5a7f9af622c4b6df7e813346661 100644 (file)
 #include "macro.h"
 #include "time-util.h"
 
-#define ANSI_HIGHLIGHT_ON "\x1B[1;39m"
-#define ANSI_RED_ON "\x1B[31m"
-#define ANSI_HIGHLIGHT_RED_ON "\x1B[1;31m"
-#define ANSI_GREEN_ON "\x1B[32m"
-#define ANSI_HIGHLIGHT_GREEN_ON "\x1B[1;32m"
-#define ANSI_HIGHLIGHT_YELLOW_ON "\x1B[1;33m"
-#define ANSI_HIGHLIGHT_BLUE_ON "\x1B[1;34m"
-#define ANSI_HIGHLIGHT_OFF "\x1B[0m"
+#define ANSI_RED "\x1B[0;31m"
+#define ANSI_GREEN "\x1B[0;32m"
+#define ANSI_UNDERLINE "\x1B[0;4m"
+#define ANSI_HIGHLIGHT "\x1B[0;1;39m"
+#define ANSI_HIGHLIGHT_RED "\x1B[0;1;31m"
+#define ANSI_HIGHLIGHT_GREEN "\x1B[0;1;32m"
+#define ANSI_HIGHLIGHT_YELLOW "\x1B[0;1;33m"
+#define ANSI_HIGHLIGHT_BLUE "\x1B[0;1;34m"
+#define ANSI_HIGHLIGHT_UNDERLINE "\x1B[0;1;4m"
+#define ANSI_NORMAL "\x1B[0m"
+
 #define ANSI_ERASE_TO_END_OF_LINE "\x1B[K"
 
+/* Set cursor to top left corner and clear screen */
+#define ANSI_HOME_CLEAR "\x1B[H\x1B[2J"
+
 int reset_terminal_fd(int fd, bool switch_to_text);
 int reset_terminal(const char *name);
 
@@ -78,28 +84,36 @@ void columns_lines_cache_reset(int _unused_ signum);
 
 bool on_tty(void);
 
+static inline const char *ansi_underline(void) {
+        return on_tty() ? ANSI_UNDERLINE : "";
+}
+
 static inline const char *ansi_highlight(void) {
-        return on_tty() ? ANSI_HIGHLIGHT_ON : "";
+        return on_tty() ? ANSI_HIGHLIGHT : "";
+}
+
+static inline const char *ansi_highlight_underline(void) {
+        return on_tty() ? ANSI_HIGHLIGHT_UNDERLINE : "";
 }
 
 static inline const char *ansi_highlight_red(void) {
-        return on_tty() ? ANSI_HIGHLIGHT_RED_ON : "";
+        return on_tty() ? ANSI_HIGHLIGHT_RED : "";
 }
 
 static inline const char *ansi_highlight_green(void) {
-        return on_tty() ? ANSI_HIGHLIGHT_GREEN_ON : "";
+        return on_tty() ? ANSI_HIGHLIGHT_GREEN : "";
 }
 
 static inline const char *ansi_highlight_yellow(void) {
-        return on_tty() ? ANSI_HIGHLIGHT_YELLOW_ON : "";
+        return on_tty() ? ANSI_HIGHLIGHT_YELLOW : "";
 }
 
 static inline const char *ansi_highlight_blue(void) {
-        return on_tty() ? ANSI_HIGHLIGHT_BLUE_ON : "";
+        return on_tty() ? ANSI_HIGHLIGHT_BLUE : "";
 }
 
-static inline const char *ansi_highlight_off(void) {
-        return on_tty() ? ANSI_HIGHLIGHT_OFF : "";
+static inline const char *ansi_normal(void) {
+        return on_tty() ? ANSI_NORMAL : "";
 }
 
 int get_ctty_devnr(pid_t pid, dev_t *d);
index 1307a34ab75f18195bc1391698e96db6a20194fc..9e1af4ec7a522cdccfa443dfb2f883d1a9bbdbe3 100644 (file)
@@ -528,9 +528,6 @@ static int group_compare(const void*a, const void *b) {
         return path_compare(x->path, y->path);
 }
 
-#define ON ANSI_HIGHLIGHT_ON
-#define OFF ANSI_HIGHLIGHT_OFF
-
 static void display(Hashmap *a) {
         Iterator i;
         Group *g;
@@ -541,10 +538,8 @@ static void display(Hashmap *a) {
 
         assert(a);
 
-        /* Set cursor to top left corner and clear screen */
         if (on_tty())
-                fputs("\033[H"
-                      "\033[2J", stdout);
+                fputs(ANSI_HOME_CLEAR, stdout);
 
         array = alloca(sizeof(Group*) * hashmap_size(a));
 
@@ -576,23 +571,30 @@ static void display(Hashmap *a) {
                 rows = 10;
 
         if (on_tty()) {
+                const char *on, *off;
+
                 path_columns = columns() - 36 - strlen(buffer);
                 if (path_columns < 10)
                         path_columns = 10;
 
-                printf("%s%-*s%s %s%7s%s %s%s%s %s%8s%s %s%8s%s %s%8s%s\n\n",
-                       arg_order == ORDER_PATH ? ON : "", path_columns, "Control Group",
-                       arg_order == ORDER_PATH ? OFF : "",
-                       arg_order == ORDER_TASKS ? ON : "", arg_count == COUNT_PIDS ? "Tasks" : arg_count == COUNT_USERSPACE_PROCESSES ? "Procs" : "Proc+",
-                       arg_order == ORDER_TASKS ? OFF : "",
-                       arg_order == ORDER_CPU ? ON : "", buffer,
-                       arg_order == ORDER_CPU ? OFF : "",
-                       arg_order == ORDER_MEMORY ? ON : "", "Memory",
-                       arg_order == ORDER_MEMORY ? OFF : "",
-                       arg_order == ORDER_IO ? ON : "", "Input/s",
-                       arg_order == ORDER_IO ? OFF : "",
-                       arg_order == ORDER_IO ? ON : "", "Output/s",
-                       arg_order == ORDER_IO ? OFF : "");
+                on = ansi_highlight_underline();
+                off = ansi_underline();
+
+                printf("%s%s%-*s%s %s%7s%s %s%s%s %s%8s%s %s%8s%s %s%8s%s%s\n",
+                       ansi_underline(),
+                       arg_order == ORDER_PATH ? on : "", path_columns, "Control Group",
+                       arg_order == ORDER_PATH ? off : "",
+                       arg_order == ORDER_TASKS ? on : "", arg_count == COUNT_PIDS ? "Tasks" : arg_count == COUNT_USERSPACE_PROCESSES ? "Procs" : "Proc+",
+                       arg_order == ORDER_TASKS ? off : "",
+                       arg_order == ORDER_CPU ? on : "", buffer,
+                       arg_order == ORDER_CPU ? off : "",
+                       arg_order == ORDER_MEMORY ? on : "", "Memory",
+                       arg_order == ORDER_MEMORY ? off : "",
+                       arg_order == ORDER_IO ? on : "", "Input/s",
+                       arg_order == ORDER_IO ? off : "",
+                       arg_order == ORDER_IO ? on : "", "Output/s",
+                       arg_order == ORDER_IO ? off : "",
+                       ansi_normal());
         } else
                 path_columns = maxtpath;
 
@@ -1061,6 +1063,10 @@ int main(int argc, char *argv[]) {
 
                 case '?':
                 case 'h':
+
+#define ON ANSI_HIGHLIGHT
+#define OFF ANSI_NORMAL
+
                         fprintf(stdout,
                                 "\t<" ON "p" OFF "> By path; <" ON "t" OFF "> By tasks/procs; <" ON "c" OFF "> By CPU; <" ON "m" OFF "> By memory; <" ON "i" OFF "> By I/O\n"
                                 "\t<" ON "+" OFF "> Inc. delay; <" ON "-" OFF "> Dec. delay; <" ON "%%" OFF "> Toggle time; <" ON "SPACE" OFF "> Refresh\n"
index b06a7d2ae5f9d78da940d85019686549269532d9..3412accf3e6b4cd4cf6c85a7d58a375bfe246322 100644 (file)
@@ -32,7 +32,7 @@
 static void log_and_status(Manager *m, const char *message) {
         log_warning("%s", message);
         manager_status_printf(m, STATUS_TYPE_EMERGENCY,
-                              ANSI_HIGHLIGHT_RED_ON " !!  " ANSI_HIGHLIGHT_OFF,
+                              ANSI_HIGHLIGHT_RED " !!  " ANSI_NORMAL,
                               "%s", message);
 }
 
index 2a35d1e2dece0eeced25baa51d063d35611f7e36..558d8d2d52634c35e410fdd3e696ed836074b276 100644 (file)
@@ -670,13 +670,13 @@ _pure_ static const char *job_get_status_message_format(Unit *u, JobType t, JobR
 static void job_print_status_message(Unit *u, JobType t, JobResult result) {
         const char *format;
         static const char* const job_result_status_table[_JOB_RESULT_MAX] = {
-                [JOB_DONE]        = ANSI_GREEN_ON            "  OK  " ANSI_HIGHLIGHT_OFF,
-                [JOB_TIMEOUT]     = ANSI_HIGHLIGHT_RED_ON    " TIME " ANSI_HIGHLIGHT_OFF,
-                [JOB_FAILED]      = ANSI_HIGHLIGHT_RED_ON    "FAILED" ANSI_HIGHLIGHT_OFF,
-                [JOB_DEPENDENCY]  = ANSI_HIGHLIGHT_YELLOW_ON "DEPEND" ANSI_HIGHLIGHT_OFF,
-                [JOB_SKIPPED]     = ANSI_HIGHLIGHT_ON        " INFO " ANSI_HIGHLIGHT_OFF,
-                [JOB_ASSERT]      = ANSI_HIGHLIGHT_YELLOW_ON "ASSERT" ANSI_HIGHLIGHT_OFF,
-                [JOB_UNSUPPORTED] = ANSI_HIGHLIGHT_YELLOW_ON "UNSUPP" ANSI_HIGHLIGHT_OFF,
+                [JOB_DONE]        = ANSI_GREEN            "  OK  " ANSI_NORMAL,
+                [JOB_TIMEOUT]     = ANSI_HIGHLIGHT_RED    " TIME " ANSI_NORMAL,
+                [JOB_FAILED]      = ANSI_HIGHLIGHT_RED    "FAILED" ANSI_NORMAL,
+                [JOB_DEPENDENCY]  = ANSI_HIGHLIGHT_YELLOW "DEPEND" ANSI_NORMAL,
+                [JOB_SKIPPED]     = ANSI_HIGHLIGHT        " INFO " ANSI_NORMAL,
+                [JOB_ASSERT]      = ANSI_HIGHLIGHT_YELLOW "ASSERT" ANSI_NORMAL,
+                [JOB_UNSUPPORTED] = ANSI_HIGHLIGHT_YELLOW "UNSUPP" ANSI_NORMAL,
         };
 
         assert(u);
index 9b59648279893ebe90b1f9f79fea25edff9dd8be..9c1f8648e7203f5c6f20cb4c5e6a7d942408ab61 100644 (file)
@@ -2053,7 +2053,7 @@ finish:
         if (getpid() == 1) {
                 if (error_message)
                         manager_status_printf(NULL, STATUS_TYPE_EMERGENCY,
-                                              ANSI_HIGHLIGHT_RED_ON "!!!!!!" ANSI_HIGHLIGHT_OFF,
+                                              ANSI_HIGHLIGHT_RED "!!!!!!" ANSI_NORMAL,
                                               "%s, freezing.", error_message);
                 freeze();
         }
index 1c1763c9024be501e02d07ab26d6f4be1e81dfef..fa0d8bc4dffcb2a1659274118bea24dcb76ee900 100644 (file)
@@ -111,7 +111,7 @@ static void manager_watch_jobs_in_progress(Manager *m) {
         (void) sd_event_source_set_description(m->jobs_in_progress_event_source, "manager-jobs-in-progress");
 }
 
-#define CYLON_BUFFER_EXTRA (2*(sizeof(ANSI_RED_ON)-1) + sizeof(ANSI_HIGHLIGHT_RED_ON)-1 + 2*(sizeof(ANSI_HIGHLIGHT_OFF)-1))
+#define CYLON_BUFFER_EXTRA (2*(sizeof(ANSI_RED)-1) + sizeof(ANSI_HIGHLIGHT_RED)-1 + 2*(sizeof(ANSI_NORMAL)-1))
 
 static void draw_cylon(char buffer[], size_t buflen, unsigned width, unsigned pos) {
         char *p = buffer;
@@ -122,23 +122,23 @@ static void draw_cylon(char buffer[], size_t buflen, unsigned width, unsigned po
         if (pos > 1) {
                 if (pos > 2)
                         p = mempset(p, ' ', pos-2);
-                p = stpcpy(p, ANSI_RED_ON);
+                p = stpcpy(p, ANSI_RED);
                 *p++ = '*';
         }
 
         if (pos > 0 && pos <= width) {
-                p = stpcpy(p, ANSI_HIGHLIGHT_RED_ON);
+                p = stpcpy(p, ANSI_HIGHLIGHT_RED);
                 *p++ = '*';
         }
 
-        p = stpcpy(p, ANSI_HIGHLIGHT_OFF);
+        p = stpcpy(p, ANSI_NORMAL);
 
         if (pos < width) {
-                p = stpcpy(p, ANSI_RED_ON);
+                p = stpcpy(p, ANSI_RED);
                 *p++ = '*';
                 if (pos < width-1)
                         p = mempset(p, ' ', width-1-pos);
-                strcpy(p, ANSI_HIGHLIGHT_OFF);
+                strcpy(p, ANSI_NORMAL);
         }
 }
 
index 2d120af4b58ff50c7d812d0b0914d55e8e0a9018..d1c1b9a3cd3320ad0caf6a3f669fa4c50d15040d 100644 (file)
@@ -401,7 +401,7 @@ static int transaction_verify_order_one(Transaction *tr, Job *j, Job *from, unsi
                                        "Job %s/%s deleted to break ordering cycle starting with %s/%s",
                                        delete->unit->id, job_type_to_string(delete->type),
                                        j->unit->id, job_type_to_string(j->type));
-                        unit_status_printf(delete->unit, ANSI_HIGHLIGHT_RED_ON " SKIP " ANSI_HIGHLIGHT_OFF,
+                        unit_status_printf(delete->unit, ANSI_HIGHLIGHT_RED " SKIP " ANSI_NORMAL,
                                            "Ordering cycle found, skipping %s");
                         transaction_delete_unit(tr, delete->unit);
                         return -EAGAIN;
index b60aaef734f1473ae9476cb92cba933b0bf6888c..990130d00b853e6c02326566753c1efd8d0e82b0 100644 (file)
@@ -107,7 +107,7 @@ static int notify_override_masked(const char *top, const char *bottom) {
                 return 0;
 
         printf("%s%s%s     %s %s %s\n",
-               ansi_highlight_red(), "[MASKED]", ansi_highlight_off(),
+               ansi_highlight_red(), "[MASKED]", ansi_normal(),
                top, draw_special_char(DRAW_ARROW), bottom);
         return 1;
 }
@@ -117,7 +117,7 @@ static int notify_override_equivalent(const char *top, const char *bottom) {
                 return 0;
 
         printf("%s%s%s %s %s %s\n",
-               ansi_highlight_green(), "[EQUIVALENT]", ansi_highlight_off(),
+               ansi_highlight_green(), "[EQUIVALENT]", ansi_normal(),
                top, draw_special_char(DRAW_ARROW), bottom);
         return 1;
 }
@@ -127,7 +127,7 @@ static int notify_override_redirected(const char *top, const char *bottom) {
                 return 0;
 
         printf("%s%s%s %s %s %s\n",
-               ansi_highlight(), "[REDIRECTED]", ansi_highlight_off(),
+               ansi_highlight(), "[REDIRECTED]", ansi_normal(),
                top, draw_special_char(DRAW_ARROW), bottom);
         return 1;
 }
@@ -137,7 +137,7 @@ static int notify_override_overridden(const char *top, const char *bottom) {
                 return 0;
 
         printf("%s%s%s %s %s %s\n",
-               ansi_highlight(), "[OVERRIDDEN]", ansi_highlight_off(),
+               ansi_highlight(), "[OVERRIDDEN]", ansi_normal(),
                top, draw_special_char(DRAW_ARROW), bottom);
         return 1;
 }
@@ -147,7 +147,7 @@ static int notify_override_extended(const char *top, const char *bottom) {
                return 0;
 
         printf("%s%s%s   %s %s %s\n",
-               ansi_highlight(), "[EXTENDED]", ansi_highlight_off(),
+               ansi_highlight(), "[EXTENDED]", ansi_normal(),
                top, draw_special_char(DRAW_ARROW), bottom);
         return 1;
 }
index 0546290318985a1ab910966c26bbf20cd78d68dc..6628e82421c6174e37538aeac60031f598c17a0e 100644 (file)
@@ -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)
index 00f70d3a530dbcfe570f1dbb839ddd1d1c862b1c..32d59c716fecccf3b1e2972401f618557ba06d7f 100644 (file)
@@ -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);
index 9b483413e778fb4489842dc9ca725143bd0f7a6f..b38b151485f0c461860ebec9df4b6dc803e53b48 100644 (file)
@@ -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;
index 9dd9cb853f7a2ae4391cfcd7ee39b544c3f46515..d89123dc6449dc525c3890a55745a10d984c72e9 100644 (file)
@@ -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);
                 }
index a6b05eb88d31248844d82353e95fae8b68fe2fed..8833b9c677aa0de68b80d676b82d613df54658a8 100644 (file)
@@ -73,8 +73,8 @@ int bus_message_dump(sd_bus_message *m, FILE *f, unsigned flags) {
                         "%s%s%s Type=%s%s%s  Endian=%c  Flags=%u  Version=%u  Priority=%"PRIi64,
                         m->header->type == SD_BUS_MESSAGE_METHOD_ERROR ? ansi_highlight_red() :
                         m->header->type == SD_BUS_MESSAGE_METHOD_RETURN ? ansi_highlight_green() :
-                        m->header->type != SD_BUS_MESSAGE_SIGNAL ? ansi_highlight() : "", draw_special_char(DRAW_TRIANGULAR_BULLET), ansi_highlight_off(),
-                        ansi_highlight(), bus_message_type_to_string(m->header->type), ansi_highlight_off(),
+                        m->header->type != SD_BUS_MESSAGE_SIGNAL ? ansi_highlight() : "", draw_special_char(DRAW_TRIANGULAR_BULLET), ansi_normal(),
+                        ansi_highlight(), bus_message_type_to_string(m->header->type), ansi_normal(),
                         m->header->endian,
                         m->header->flags,
                         m->header->version,
@@ -93,15 +93,15 @@ int bus_message_dump(sd_bus_message *m, FILE *f, unsigned flags) {
                 fputs("\n", f);
 
                 if (m->sender)
-                        fprintf(f, "  Sender=%s%s%s", ansi_highlight(), m->sender, ansi_highlight_off());
+                        fprintf(f, "  Sender=%s%s%s", ansi_highlight(), m->sender, ansi_normal());
                 if (m->destination)
-                        fprintf(f, "  Destination=%s%s%s", ansi_highlight(), m->destination, ansi_highlight_off());
+                        fprintf(f, "  Destination=%s%s%s", ansi_highlight(), m->destination, ansi_normal());
                 if (m->path)
-                        fprintf(f, "  Path=%s%s%s", ansi_highlight(), m->path, ansi_highlight_off());
+                        fprintf(f, "  Path=%s%s%s", ansi_highlight(), m->path, ansi_normal());
                 if (m->interface)
-                        fprintf(f, "  Interface=%s%s%s", ansi_highlight(), m->interface, ansi_highlight_off());
+                        fprintf(f, "  Interface=%s%s%s", ansi_highlight(), m->interface, ansi_normal());
                 if (m->member)
-                        fprintf(f, "  Member=%s%s%s", ansi_highlight(), m->member, ansi_highlight_off());
+                        fprintf(f, "  Member=%s%s%s", ansi_highlight(), m->member, ansi_normal());
 
                 if (m->sender || m->destination || m->path || m->interface || m->member)
                         fputs("\n", f);
@@ -110,8 +110,8 @@ int bus_message_dump(sd_bus_message *m, FILE *f, unsigned flags) {
                         fprintf(f,
                                 "  ErrorName=%s%s%s"
                                 "  ErrorMessage=%s\"%s\"%s\n",
-                                ansi_highlight_red(), strna(m->error.name), ansi_highlight_off(),
-                                ansi_highlight_red(), strna(m->error.message), ansi_highlight_off());
+                                ansi_highlight_red(), strna(m->error.name), ansi_normal(),
+                                ansi_highlight_red(), strna(m->error.message), ansi_normal());
 
                 if (m->monotonic != 0)
                         fprintf(f, "  Monotonic="USEC_FMT, m->monotonic);
@@ -211,55 +211,55 @@ int bus_message_dump(sd_bus_message *m, FILE *f, unsigned flags) {
                 switch (type) {
 
                 case SD_BUS_TYPE_BYTE:
-                        fprintf(f, "%sBYTE %s%u%s;\n", prefix, ansi_highlight(), basic.u8, ansi_highlight_off());
+                        fprintf(f, "%sBYTE %s%u%s;\n", prefix, ansi_highlight(), basic.u8, ansi_normal());
                         break;
 
                 case SD_BUS_TYPE_BOOLEAN:
-                        fprintf(f, "%sBOOLEAN %s%s%s;\n", prefix, ansi_highlight(), true_false(basic.i), ansi_highlight_off());
+                        fprintf(f, "%sBOOLEAN %s%s%s;\n", prefix, ansi_highlight(), true_false(basic.i), ansi_normal());
                         break;
 
                 case SD_BUS_TYPE_INT16:
-                        fprintf(f, "%sINT16 %s%i%s;\n", prefix, ansi_highlight(), basic.s16, ansi_highlight_off());
+                        fprintf(f, "%sINT16 %s%i%s;\n", prefix, ansi_highlight(), basic.s16, ansi_normal());
                         break;
 
                 case SD_BUS_TYPE_UINT16:
-                        fprintf(f, "%sUINT16 %s%u%s;\n", prefix, ansi_highlight(), basic.u16, ansi_highlight_off());
+                        fprintf(f, "%sUINT16 %s%u%s;\n", prefix, ansi_highlight(), basic.u16, ansi_normal());
                         break;
 
                 case SD_BUS_TYPE_INT32:
-                        fprintf(f, "%sINT32 %s%i%s;\n", prefix, ansi_highlight(), basic.s32, ansi_highlight_off());
+                        fprintf(f, "%sINT32 %s%i%s;\n", prefix, ansi_highlight(), basic.s32, ansi_normal());
                         break;
 
                 case SD_BUS_TYPE_UINT32:
-                        fprintf(f, "%sUINT32 %s%u%s;\n", prefix, ansi_highlight(), basic.u32, ansi_highlight_off());
+                        fprintf(f, "%sUINT32 %s%u%s;\n", prefix, ansi_highlight(), basic.u32, ansi_normal());
                         break;
 
                 case SD_BUS_TYPE_INT64:
-                        fprintf(f, "%sINT64 %s%"PRIi64"%s;\n", prefix, ansi_highlight(), basic.s64, ansi_highlight_off());
+                        fprintf(f, "%sINT64 %s%"PRIi64"%s;\n", prefix, ansi_highlight(), basic.s64, ansi_normal());
                         break;
 
                 case SD_BUS_TYPE_UINT64:
-                        fprintf(f, "%sUINT64 %s%"PRIu64"%s;\n", prefix, ansi_highlight(), basic.u64, ansi_highlight_off());
+                        fprintf(f, "%sUINT64 %s%"PRIu64"%s;\n", prefix, ansi_highlight(), basic.u64, ansi_normal());
                         break;
 
                 case SD_BUS_TYPE_DOUBLE:
-                        fprintf(f, "%sDOUBLE %s%g%s;\n", prefix, ansi_highlight(), basic.d64, ansi_highlight_off());
+                        fprintf(f, "%sDOUBLE %s%g%s;\n", prefix, ansi_highlight(), basic.d64, ansi_normal());
                         break;
 
                 case SD_BUS_TYPE_STRING:
-                        fprintf(f, "%sSTRING \"%s%s%s\";\n", prefix, ansi_highlight(), basic.string, ansi_highlight_off());
+                        fprintf(f, "%sSTRING \"%s%s%s\";\n", prefix, ansi_highlight(), basic.string, ansi_normal());
                         break;
 
                 case SD_BUS_TYPE_OBJECT_PATH:
-                        fprintf(f, "%sOBJECT_PATH \"%s%s%s\";\n", prefix, ansi_highlight(), basic.string, ansi_highlight_off());
+                        fprintf(f, "%sOBJECT_PATH \"%s%s%s\";\n", prefix, ansi_highlight(), basic.string, ansi_normal());
                         break;
 
                 case SD_BUS_TYPE_SIGNATURE:
-                        fprintf(f, "%sSIGNATURE \"%s%s%s\";\n", prefix, ansi_highlight(), basic.string, ansi_highlight_off());
+                        fprintf(f, "%sSIGNATURE \"%s%s%s\";\n", prefix, ansi_highlight(), basic.string, ansi_normal());
                         break;
 
                 case SD_BUS_TYPE_UNIX_FD:
-                        fprintf(f, "%sUNIX_FD %s%i%s;\n", prefix, ansi_highlight(), basic.i, ansi_highlight_off());
+                        fprintf(f, "%sUNIX_FD %s%i%s;\n", prefix, ansi_highlight(), basic.i, ansi_normal());
                         break;
 
                 default:
@@ -327,7 +327,7 @@ static void dump_capabilities(
         fputs("\n", f);
 
         if (!terse)
-                fputs(ansi_highlight_off(), f);
+                fputs(ansi_normal(), f);
 }
 
 int bus_creds_dump(sd_bus_creds *c, FILE *f, bool terse) {
@@ -352,7 +352,7 @@ int bus_creds_dump(sd_bus_creds *c, FILE *f, bool terse) {
                 prefix = "";
                 color = ansi_highlight();
 
-                off = ansi_highlight_off();
+                off = ansi_normal();
                 suffix = strjoina(off, "\n");
         }
 
index 9a6d338231c7b2408fef0996e823db0606587acf..09eba51d1c3ae7be416ea5a1a988faa34ff48e41 100644 (file)
@@ -449,7 +449,7 @@ static int tree(sd_bus *bus, char **argv) {
                         if (not_first)
                                 printf("\n");
 
-                        printf("Service %s%s%s:\n", ansi_highlight(), *i, ansi_highlight_off());
+                        printf("Service %s%s%s:\n", ansi_highlight(), *i, ansi_normal());
 
                         q = tree_one(bus, *i, NULL, true);
                         if (q < 0 && r >= 0)
@@ -466,7 +466,7 @@ static int tree(sd_bus *bus, char **argv) {
 
                         if (argv[2]) {
                                 pager_open_if_enabled();
-                                printf("Service %s%s%s:\n", ansi_highlight(), *i, ansi_highlight_off());
+                                printf("Service %s%s%s:\n", ansi_highlight(), *i, ansi_normal());
                         }
 
                         q = tree_one(bus, *i, NULL, !!argv[2]);
@@ -1052,7 +1052,7 @@ static int introspect(sd_bus *bus, char **argv) {
                        is_interface ? ansi_highlight() : "",
                        is_interface ? "" : ".",
                        - !is_interface + (int) name_width, strdash(streq_ptr(m->type, "interface") ? m->interface : m->name),
-                       is_interface ? ansi_highlight_off() : "",
+                       is_interface ? ansi_normal() : "",
                        (int) type_width, strdash(m->type),
                        (int) signature_width, strdash(m->signature),
                        (int) result_width, rv,
@@ -1196,15 +1196,15 @@ static int status(sd_bus *bus, char *argv[]) {
 
                 r = sd_bus_get_address(bus, &address);
                 if (r >= 0)
-                        printf("BusAddress=%s%s%s\n", ansi_highlight(), address, ansi_highlight_off());
+                        printf("BusAddress=%s%s%s\n", ansi_highlight(), address, ansi_normal());
 
                 r = sd_bus_get_scope(bus, &scope);
                 if (r >= 0)
-                        printf("BusScope=%s%s%s\n", ansi_highlight(), scope, ansi_highlight_off());
+                        printf("BusScope=%s%s%s\n", ansi_highlight(), scope, ansi_normal());
 
                 r = sd_bus_get_bus_id(bus, &bus_id);
                 if (r >= 0)
-                        printf("BusID=%s" SD_ID128_FORMAT_STR "%s\n", ansi_highlight(), SD_ID128_FORMAT_VAL(bus_id), ansi_highlight_off());
+                        printf("BusID=%s" SD_ID128_FORMAT_STR "%s\n", ansi_highlight(), SD_ID128_FORMAT_VAL(bus_id), ansi_normal());
 
                 r = sd_bus_get_owner_creds(
                                 bus,
index ab113efb2872b2eb91d7d1885e5b6ca1eba240cf..d276fbe9560fc646e6191575ec07a4a0585f3693 100644 (file)
@@ -327,7 +327,7 @@ static int list_images(int argc, char *argv[], void *userdata) {
                 printf("%-*s %-*s %s%-3s%s %-*s %-*s %-*s\n",
                        (int) max_name, images[j].name,
                        (int) max_type, images[j].type,
-                       images[j].read_only ? ansi_highlight_red() : "", yes_no(images[j].read_only), images[j].read_only ? ansi_highlight_off() : "",
+                       images[j].read_only ? ansi_highlight_red() : "", yes_no(images[j].read_only), images[j].read_only ? ansi_normal() : "",
                        (int) max_size, strna(format_bytes(size_buf, sizeof(size_buf), images[j].size)),
                        (int) max_crtime, strna(format_timestamp(crtime_buf, sizeof(crtime_buf), images[j].crtime)),
                        (int) max_mtime, strna(format_timestamp(mtime_buf, sizeof(mtime_buf), images[j].mtime)));
@@ -793,7 +793,7 @@ static void print_image_status_info(sd_bus *bus, ImageStatusInfo *i) {
         printf("\t      RO: %s%s%s\n",
                i->read_only ? ansi_highlight_red() : "",
                i->read_only ? "read-only" : "writable",
-               i->read_only ? ansi_highlight_off() : "");
+               i->read_only ? ansi_normal() : "");
 
         s1 = format_timestamp_relative(ts_relative, sizeof(ts_relative), i->crtime);
         s2 = format_timestamp(ts_absolute, sizeof(ts_absolute), i->crtime);
index 786579def07f523269d6489cd4b24070a05bae70..75572b63886227c92e7b031622e1c67c17ca7bbf 100644 (file)
@@ -166,10 +166,10 @@ static void operational_state_to_color(const char *state, const char **on, const
 
         if (streq_ptr(state, "routable")) {
                 *on = ansi_highlight_green();
-                *off = ansi_highlight_off();
+                *off = ansi_normal();
         } else if (streq_ptr(state, "degraded")) {
                 *on = ansi_highlight_yellow();
-                *off = ansi_highlight_off();
+                *off = ansi_normal();
         } else
                 *on = *off = "";
 }
@@ -180,13 +180,13 @@ static void setup_state_to_color(const char *state, const char **on, const char
 
         if (streq_ptr(state, "configured")) {
                 *on = ansi_highlight_green();
-                *off = ansi_highlight_off();
+                *off = ansi_normal();
         } else if (streq_ptr(state, "configuring")) {
                 *on = ansi_highlight_yellow();
-                *off = ansi_highlight_off();
+                *off = ansi_normal();
         } else if (streq_ptr(state, "failed") || streq_ptr(state, "linger")) {
                 *on = ansi_highlight_red();
-                *off = ansi_highlight_off();
+                *off = ansi_normal();
         } else
                 *on = *off = "";
 }
index f5cff6fc5666d01aaacc5a210deb997b0dc34c55..b02cdf9a170225d0468f9e6b5c26a55bc5b4b646 100644 (file)
@@ -97,10 +97,10 @@ int ask_password_tty(
                         goto finish;
                 }
 
-                loop_write(ttyfd, ANSI_HIGHLIGHT_ON, sizeof(ANSI_HIGHLIGHT_ON)-1, false);
+                loop_write(ttyfd, ANSI_HIGHLIGHT, sizeof(ANSI_HIGHLIGHT)-1, false);
                 loop_write(ttyfd, message, strlen(message), false);
                 loop_write(ttyfd, " ", 1, false);
-                loop_write(ttyfd, ANSI_HIGHLIGHT_OFF, sizeof(ANSI_HIGHLIGHT_OFF)-1, false);
+                loop_write(ttyfd, ANSI_NORMAL, sizeof(ANSI_NORMAL)-1, false);
 
                 new_termios = old_termios;
                 new_termios.c_lflag &= ~(ICANON|ECHO);
index 7790c1a3c80c7f3b659150e338c52bf33d215c9e..dbc07aa7ad93b2896e8b78771e857ff3b32ab295 100644 (file)
@@ -117,11 +117,11 @@ static bool print_multiline(FILE *f, unsigned prefix, unsigned n_columns, Output
 
         if (flags & OUTPUT_COLOR) {
                 if (priority <= LOG_ERR) {
-                        color_on = ANSI_HIGHLIGHT_RED_ON;
-                        color_off = ANSI_HIGHLIGHT_OFF;
+                        color_on = ANSI_HIGHLIGHT_RED;
+                        color_off = ANSI_NORMAL;
                 } else if (priority <= LOG_NOTICE) {
-                        color_on = ANSI_HIGHLIGHT_ON;
-                        color_off = ANSI_HIGHLIGHT_OFF;
+                        color_on = ANSI_HIGHLIGHT;
+                        color_off = ANSI_NORMAL;
                 }
         }
 
@@ -455,8 +455,8 @@ static int output_verbose(
                 fieldlen = c - (const char*) data;
 
                 if (flags & OUTPUT_COLOR && startswith(data, "MESSAGE=")) {
-                        on = ANSI_HIGHLIGHT_ON;
-                        off = ANSI_HIGHLIGHT_OFF;
+                        on = ANSI_HIGHLIGHT;
+                        off = ANSI_NORMAL;
                 }
 
                 if (flags & OUTPUT_SHOW_ALL ||
index e20fc1bbbb978874aa8990eebe83a8ad4bd71669..0fbdec011a2ed20138a7af63ac3534d53276d4b4 100644 (file)
@@ -431,11 +431,11 @@ static int output_units_list(const UnitInfo *unit_infos, unsigned c) {
                 if (STR_IN_SET(u->load_state, "error", "not-found", "masked") && !arg_plain) {
                         on_loaded = ansi_highlight_red();
                         on_circle = ansi_highlight_yellow();
-                        off_loaded = off_circle = ansi_highlight_off();
+                        off_loaded = off_circle = ansi_normal();
                         circle = true;
                 } else if (streq(u->active_state, "failed") && !arg_plain) {
                         on_circle = on_active = ansi_highlight_red();
-                        off_circle = off_active = ansi_highlight_off();
+                        off_circle = off_active = ansi_normal();
                         circle = true;
                 }
 
@@ -482,10 +482,10 @@ static int output_units_list(const UnitInfo *unit_infos, unsigned c) {
                              "SUB    = The low-level unit activation state, values depend on unit type.");
                         puts(job_count ? "JOB    = Pending job for the unit.\n" : "");
                         on = ansi_highlight();
-                        off = ansi_highlight_off();
+                        off = ansi_normal();
                 } else {
                         on = ansi_highlight_red();
-                        off = ansi_highlight_off();
+                        off = ansi_normal();
                 }
 
                 if (arg_all)
@@ -836,12 +836,12 @@ static int output_sockets_list(struct socket_info *socket_infos, unsigned cs) {
                 }
 
                 on = ansi_highlight();
-                off = ansi_highlight_off();
+                off = ansi_normal();
                 if (!arg_no_legend)
                         printf("\n");
         } else {
                 on = ansi_highlight_red();
-                off = ansi_highlight_off();
+                off = ansi_normal();
         }
 
         if (!arg_no_legend) {
@@ -1118,12 +1118,12 @@ static int output_timers_list(struct timer_info *timer_infos, unsigned n) {
                 }
 
                 on = ansi_highlight();
-                off = ansi_highlight_off();
+                off = ansi_normal();
                 if (!arg_no_legend)
                         printf("\n");
         } else {
                 on = ansi_highlight_red();
-                off = ansi_highlight_off();
+                off = ansi_normal();
         }
 
         if (!arg_no_legend) {
@@ -1306,10 +1306,10 @@ static void output_unit_file_list(const UnitFileList *units, unsigned c) {
                            UNIT_FILE_DISABLED,
                            UNIT_FILE_INVALID)) {
                         on  = ansi_highlight_red();
-                        off = ansi_highlight_off();
+                        off = ansi_normal();
                 } else if (u->state == UNIT_FILE_ENABLED) {
                         on  = ansi_highlight_green();
-                        off = ansi_highlight_off();
+                        off = ansi_normal();
                 } else
                         on = off = "";
 
@@ -1618,7 +1618,7 @@ static int list_dependencies_one(
 
                         state = check_one_unit(bus, *c, "activating\0active\0reloading\0", true);
                         on = state > 0 ? ansi_highlight_green() : ansi_highlight_red();
-                        printf("%s%s%s ", on, draw_special_char(DRAW_BLACK_CIRCLE), ansi_highlight_off());
+                        printf("%s%s%s ", on, draw_special_char(DRAW_BLACK_CIRCLE), ansi_normal());
                 }
 
                 r = list_dependencies_print(*c, level, branches, c[1] == NULL);
@@ -1837,17 +1837,17 @@ static void output_machines_list(struct machine_info *machine_infos, unsigned n)
 
                 if (streq_ptr(m->state, "degraded")) {
                         on_state = ansi_highlight_red();
-                        off_state = ansi_highlight_off();
+                        off_state = ansi_normal();
                         circle = true;
                 } else if (!streq_ptr(m->state, "running")) {
                         on_state = ansi_highlight_yellow();
-                        off_state = ansi_highlight_off();
+                        off_state = ansi_normal();
                         circle = true;
                 }
 
                 if (m->n_failed_units > 0) {
                         on_failed = ansi_highlight_red();
-                        off_failed = ansi_highlight_off();
+                        off_failed = ansi_normal();
                 } else
                         on_failed = off_failed = "";
 
@@ -2020,7 +2020,7 @@ static void output_jobs_list(const struct job_info* jobs, unsigned n, bool skipp
         if (n == 0) {
                 if (!arg_no_legend) {
                         on = ansi_highlight_green();
-                        off = ansi_highlight_off();
+                        off = ansi_normal();
 
                         printf("%sNo jobs %s.%s\n", on, skipped ? "listed" : "running", off);
                 }
@@ -2061,7 +2061,7 @@ static void output_jobs_list(const struct job_info* jobs, unsigned n, bool skipp
 
                 if (streq(j->state, "running")) {
                         on = ansi_highlight();
-                        off = ansi_highlight_off();
+                        off = ansi_normal();
                 } else
                         on = off = "";
 
@@ -2075,7 +2075,7 @@ static void output_jobs_list(const struct job_info* jobs, unsigned n, bool skipp
 
         if (!arg_no_legend) {
                 on = ansi_highlight();
-                off = ansi_highlight_off();
+                off = ansi_normal();
 
                 printf("\n%s%u jobs listed%s.\n", on, n, off);
         }
@@ -2221,7 +2221,7 @@ static int need_daemon_reload(sd_bus *bus, const char *unit) {
 static void warn_unit_file_changed(const char *name) {
         log_warning("%sWarning:%s %s changed on disk. Run 'systemctl%s daemon-reload' to reload units.",
                     ansi_highlight_red(),
-                    ansi_highlight_off(),
+                    ansi_normal(),
                     name,
                     arg_scope == UNIT_FILE_SYSTEM ? "" : " --user");
 }
@@ -3355,10 +3355,10 @@ static void print_status_info(
 
         if (streq_ptr(i->active_state, "failed")) {
                 active_on = ansi_highlight_red();
-                active_off = ansi_highlight_off();
+                active_off = ansi_normal();
         } else if (streq_ptr(i->active_state, "active") || streq_ptr(i->active_state, "reloading")) {
                 active_on = ansi_highlight_green();
-                active_off = ansi_highlight_off();
+                active_off = ansi_normal();
         } else
                 active_on = active_off = "";
 
@@ -3374,7 +3374,7 @@ static void print_status_info(
 
         if (streq_ptr(i->load_state, "error")) {
                 on = ansi_highlight_red();
-                off = ansi_highlight_off();
+                off = ansi_normal();
         } else
                 on = off = "";
 
@@ -3455,7 +3455,7 @@ static void print_status_info(
                 s2 = format_timestamp(since2, sizeof(since2), i->condition_timestamp);
 
                 printf("Condition: start %scondition failed%s at %s%s%s\n",
-                       ansi_highlight_yellow(), ansi_highlight_off(),
+                       ansi_highlight_yellow(), ansi_normal(),
                        s2, s1 ? "; " : "", s1 ? s1 : "");
                 if (i->failed_condition_trigger)
                         printf("           none of the trigger conditions were met\n");
@@ -3471,7 +3471,7 @@ static void print_status_info(
                 s2 = format_timestamp(since2, sizeof(since2), i->assert_timestamp);
 
                 printf("   Assert: start %sassertion failed%s at %s%s%s\n",
-                       ansi_highlight_red(), ansi_highlight_off(),
+                       ansi_highlight_red(), ansi_normal(),
                        s2, s1 ? "; " : "", s1 ? s1 : "");
                 if (i->failed_assert_trigger)
                         printf("           none of the trigger assertions were met\n");
@@ -3512,7 +3512,7 @@ static void print_status_info(
                 good = is_clean_exit_lsb(p->code, p->status, NULL);
                 if (!good) {
                         on = ansi_highlight_red();
-                        off = ansi_highlight_off();
+                        off = ansi_normal();
                 } else
                         on = off = "";
 
@@ -4513,10 +4513,10 @@ static int show_system_status(sd_bus *bus) {
 
         if (streq_ptr(mi.state, "degraded")) {
                 on = ansi_highlight_red();
-                off = ansi_highlight_off();
+                off = ansi_normal();
         } else if (!streq_ptr(mi.state, "running")) {
                 on = ansi_highlight_yellow();
-                off = ansi_highlight_off();
+                off = ansi_normal();
         } else
                 on = off = "";
 
@@ -4688,7 +4688,7 @@ static int cat_file(const char *filename, bool newline) {
                newline ? "\n" : "",
                ansi_highlight_blue(),
                filename,
-               ansi_highlight_off());
+               ansi_normal());
         fflush(stdout);
 
         return copy_bytes(fd, STDOUT_FILENO, (uint64_t) -1, false);
index 358454842af40e5913fde2652db721e12e50a57f..6cec8768b115dcba6c1879e594b4e8245ecee767 100644 (file)
@@ -33,13 +33,13 @@ int main(int argc, char *argv[]) {
         assert_se(streq(p, "        Foobar        bar        waldo        "));
         free(p);
 
-        assert_se(p = strdup(ANSI_HIGHLIGHT_ON "Hello" ANSI_HIGHLIGHT_OFF ANSI_HIGHLIGHT_RED_ON " world!" ANSI_HIGHLIGHT_OFF));
+        assert_se(p = strdup(ANSI_HIGHLIGHT "Hello" ANSI_NORMAL ANSI_HIGHLIGHT_RED " world!" ANSI_NORMAL));
         assert_se(strip_tab_ansi(&p, NULL));
         fprintf(stdout, "<%s>\n", p);
         assert_se(streq(p, "Hello world!"));
         free(p);
 
-        assert_se(p = strdup("\x1B[\x1B[\t\x1B[" ANSI_HIGHLIGHT_ON "\x1B[" "Hello" ANSI_HIGHLIGHT_OFF ANSI_HIGHLIGHT_RED_ON " world!" ANSI_HIGHLIGHT_OFF));
+        assert_se(p = strdup("\x1B[\x1B[\t\x1B[" ANSI_HIGHLIGHT "\x1B[" "Hello" ANSI_NORMAL ANSI_HIGHLIGHT_RED " world!" ANSI_NORMAL));
         assert_se(strip_tab_ansi(&p, NULL));
         assert_se(streq(p, "\x1B[\x1B[        \x1B[\x1B[Hello world!"));
         free(p);
index 1c3f03c803b3c19106d3e9552c5a8ed3d72b5af9..12a7ed6718b7a53157bed7dbdd44ce011a880cb7 100644 (file)
@@ -153,13 +153,13 @@ static void print_status_info(const StatusInfo *i) {
                yes_no(i->rtc_local));
 
         if (i->rtc_local)
-                fputs("\n" ANSI_HIGHLIGHT_ON
+                fputs("\n" ANSI_HIGHLIGHT
                       "Warning: The system is configured to read the RTC time in the local time zone.\n"
                       "         This mode can not be fully supported. It will create various problems\n"
                       "         with time zone changes and daylight saving time adjustments. The RTC\n"
                       "         time is never updated, it relies on external facilities to maintain it.\n"
                       "         If at all possible, use RTC in UTC by calling\n"
-                      "         'timedatectl set-local-rtc 0'" ANSI_HIGHLIGHT_OFF ".\n", stdout);
+                      "         'timedatectl set-local-rtc 0'." ANSI_NORMAL "\n", stdout);
 }
 
 static int show_status(sd_bus *bus, char **args, unsigned n) {