diff options
-rw-r--r-- | src/basic/locale-util.h | 4 | ||||
-rw-r--r-- | src/basic/terminal-util.h | 4 | ||||
-rw-r--r-- | src/boot/bootctl.c | 4 |
3 files changed, 10 insertions, 2 deletions
diff --git a/src/basic/locale-util.h b/src/basic/locale-util.h index bebdf97aa8..558c5a898b 100644 --- a/src/basic/locale-util.h +++ b/src/basic/locale-util.h @@ -90,3 +90,7 @@ void locale_variables_free(char* l[_VARIABLE_LC_MAX]); static inline void locale_variables_freep(char*(*l)[_VARIABLE_LC_MAX]) { locale_variables_free(*l); } + +static inline const char *special_glyph_check_mark(bool b) { + return b ? special_glyph(SPECIAL_GLYPH_CHECK_MARK) : special_glyph(SPECIAL_GLYPH_CROSS_MARK); +} diff --git a/src/basic/terminal-util.h b/src/basic/terminal-util.h index 27e7f8db22..d327627b20 100644 --- a/src/basic/terminal-util.h +++ b/src/basic/terminal-util.h @@ -253,5 +253,9 @@ int vt_release(int fd, bool restore_vt); void get_log_colors(int priority, const char **on, const char **off, const char **highlight); +static inline const char* ansi_highlight_green_red(bool b) { + return b ? ansi_highlight_green() : ansi_highlight_red(); +} + /* This assumes there is a 'tty' group */ #define TTY_MODE 0620 diff --git a/src/boot/bootctl.c b/src/boot/bootctl.c index cccd834cc8..9964dda1fc 100644 --- a/src/boot/bootctl.c +++ b/src/boot/bootctl.c @@ -1153,8 +1153,8 @@ static void read_loader_efi_var(const char *name, char **var) { static void print_yes_no_line(bool first, bool good, const char *name) { printf("%s%s%s%s %s\n", first ? " Features: " : " ", - good ? ansi_highlight_green() : ansi_highlight_red(), - good ? special_glyph(SPECIAL_GLYPH_CHECK_MARK) : special_glyph(SPECIAL_GLYPH_CROSS_MARK), + ansi_highlight_green_red(good), + special_glyph_check_mark(good), ansi_normal(), name); } |