summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/basic/fs-util.c2
-rw-r--r--src/basic/glyph-util.c129
-rw-r--r--src/basic/glyph-util.h56
-rw-r--r--src/basic/locale-util.c123
-rw-r--r--src/basic/locale-util.h51
-rw-r--r--src/basic/meson.build2
-rw-r--r--src/basic/unit-def.h2
-rw-r--r--src/boot/bootctl.c2
-rw-r--r--src/busctl/busctl.c2
-rw-r--r--src/cryptenroll/cryptenroll-recovery.c2
-rw-r--r--src/delta/delta.c2
-rw-r--r--src/firstboot/firstboot.c1
-rw-r--r--src/home/homectl-recovery-key.c2
-rw-r--r--src/home/homectl.c1
-rw-r--r--src/libsystemd/sd-bus/bus-dump.c2
-rw-r--r--src/login/sysfs-show.c2
-rw-r--r--src/partition/repart.c2
-rw-r--r--src/shared/ask-password-api.c2
-rw-r--r--src/shared/bus-unit-procs.c2
-rw-r--r--src/shared/format-table.c2
-rw-r--r--src/shared/libfido2-util.c2
-rw-r--r--src/shared/logs-show.c1
-rw-r--r--src/test/test-locale-util.c1
23 files changed, 206 insertions, 187 deletions
diff --git a/src/basic/fs-util.c b/src/basic/fs-util.c
index 2412df197a..bf771f2e2f 100644
--- a/src/basic/fs-util.c
+++ b/src/basic/fs-util.c
@@ -12,7 +12,7 @@
#include "fd-util.h"
#include "fileio.h"
#include "fs-util.h"
-#include "locale-util.h"
+#include "glyph-util.h"
#include "log.h"
#include "macro.h"
#include "missing_fcntl.h"
diff --git a/src/basic/glyph-util.c b/src/basic/glyph-util.c
new file mode 100644
index 0000000000..8810738fc3
--- /dev/null
+++ b/src/basic/glyph-util.c
@@ -0,0 +1,129 @@
+/* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+#include "env-util.h"
+#include "glyph-util.h"
+#include "locale-util.h"
+#include "strv.h"
+
+bool emoji_enabled(void) {
+ static int cached_emoji_enabled = -1;
+
+ if (cached_emoji_enabled < 0) {
+ int val;
+
+ val = getenv_bool("SYSTEMD_EMOJI");
+ if (val < 0)
+ cached_emoji_enabled =
+ is_locale_utf8() &&
+ !STRPTR_IN_SET(getenv("TERM"), "dumb", "linux");
+ else
+ cached_emoji_enabled = val;
+ }
+
+ return cached_emoji_enabled;
+}
+
+const char *special_glyph(SpecialGlyph code) {
+
+ /* A list of a number of interesting unicode glyphs we can use to decorate our output. It's probably wise to be
+ * conservative here, and primarily stick to the glyphs defined in the eurlatgr font, so that display still
+ * works reasonably well on the Linux console. For details see:
+ *
+ * http://git.altlinux.org/people/legion/packages/kbd.git?p=kbd.git;a=blob;f=data/consolefonts/README.eurlatgr
+ */
+
+ static const char* const draw_table[2][_SPECIAL_GLYPH_MAX] = {
+ /* ASCII fallback */
+ [false] = {
+ [SPECIAL_GLYPH_TREE_VERTICAL] = "| ",
+ [SPECIAL_GLYPH_TREE_BRANCH] = "|-",
+ [SPECIAL_GLYPH_TREE_RIGHT] = "`-",
+ [SPECIAL_GLYPH_TREE_SPACE] = " ",
+ [SPECIAL_GLYPH_TRIANGULAR_BULLET] = ">",
+ [SPECIAL_GLYPH_BLACK_CIRCLE] = "*",
+ [SPECIAL_GLYPH_WHITE_CIRCLE] = "*",
+ [SPECIAL_GLYPH_MULTIPLICATION_SIGN] = "x",
+ [SPECIAL_GLYPH_CIRCLE_ARROW] = "*",
+ [SPECIAL_GLYPH_BULLET] = "*",
+ [SPECIAL_GLYPH_MU] = "u",
+ [SPECIAL_GLYPH_CHECK_MARK] = "+",
+ [SPECIAL_GLYPH_CROSS_MARK] = "-",
+ [SPECIAL_GLYPH_LIGHT_SHADE] = "-",
+ [SPECIAL_GLYPH_DARK_SHADE] = "X",
+ [SPECIAL_GLYPH_SIGMA] = "S",
+ [SPECIAL_GLYPH_ARROW] = "->",
+ [SPECIAL_GLYPH_ELLIPSIS] = "...",
+ [SPECIAL_GLYPH_EXTERNAL_LINK] = "[LNK]",
+ [SPECIAL_GLYPH_ECSTATIC_SMILEY] = ":-]",
+ [SPECIAL_GLYPH_HAPPY_SMILEY] = ":-}",
+ [SPECIAL_GLYPH_SLIGHTLY_HAPPY_SMILEY] = ":-)",
+ [SPECIAL_GLYPH_NEUTRAL_SMILEY] = ":-|",
+ [SPECIAL_GLYPH_SLIGHTLY_UNHAPPY_SMILEY] = ":-(",
+ [SPECIAL_GLYPH_UNHAPPY_SMILEY] = ":-{",
+ [SPECIAL_GLYPH_DEPRESSED_SMILEY] = ":-[",
+ [SPECIAL_GLYPH_LOCK_AND_KEY] = "o-,",
+ [SPECIAL_GLYPH_TOUCH] = "O=", /* Yeah, not very convincing, can you do it better? */
+ [SPECIAL_GLYPH_RECYCLING] = "~",
+ [SPECIAL_GLYPH_DOWNLOAD] = "\\",
+ [SPECIAL_GLYPH_SPARKLES] = "*",
+ },
+
+ /* UTF-8 */
+ [true] = {
+ /* The following are multiple glyphs in both ASCII and in UNICODE */
+ [SPECIAL_GLYPH_TREE_VERTICAL] = "\342\224\202 ", /* │ */
+ [SPECIAL_GLYPH_TREE_BRANCH] = "\342\224\234\342\224\200", /* ├─ */
+ [SPECIAL_GLYPH_TREE_RIGHT] = "\342\224\224\342\224\200", /* └─ */
+ [SPECIAL_GLYPH_TREE_SPACE] = " ", /* */
+
+ /* Single glyphs in both cases */
+ [SPECIAL_GLYPH_TRIANGULAR_BULLET] = "\342\200\243", /* ‣ */
+ [SPECIAL_GLYPH_BLACK_CIRCLE] = "\342\227\217", /* ● */
+ [SPECIAL_GLYPH_WHITE_CIRCLE] = "\u25CB", /* ○ */
+ [SPECIAL_GLYPH_MULTIPLICATION_SIGN] = "\u00D7", /* × */
+ [SPECIAL_GLYPH_CIRCLE_ARROW] = "\u21BB", /* ↻ */
+ [SPECIAL_GLYPH_BULLET] = "\342\200\242", /* • */
+ [SPECIAL_GLYPH_MU] = "\316\274", /* μ (actually called: GREEK SMALL LETTER MU) */
+ [SPECIAL_GLYPH_CHECK_MARK] = "\342\234\223", /* ✓ */
+ [SPECIAL_GLYPH_CROSS_MARK] = "\342\234\227", /* ✗ (actually called: BALLOT X) */
+ [SPECIAL_GLYPH_LIGHT_SHADE] = "\342\226\221", /* ░ */
+ [SPECIAL_GLYPH_DARK_SHADE] = "\342\226\223", /* ▒ */
+ [SPECIAL_GLYPH_SIGMA] = "\316\243", /* Σ */
+
+ /* Single glyph in Unicode, two in ASCII */
+ [SPECIAL_GLYPH_ARROW] = "\342\206\222", /* → (actually called: RIGHTWARDS ARROW) */
+
+ /* Single glyph in Unicode, three in ASCII */
+ [SPECIAL_GLYPH_ELLIPSIS] = "\342\200\246", /* … (actually called: HORIZONTAL ELLIPSIS) */
+
+ /* Three glyphs in Unicode, five in ASCII */
+ [SPECIAL_GLYPH_EXTERNAL_LINK] = "[\360\237\241\225]", /* 🡕 (actually called: NORTH EAST SANS-SERIF ARROW, enclosed in []) */
+
+ /* These smileys are a single glyph in Unicode, and three in ASCII */
+ [SPECIAL_GLYPH_ECSTATIC_SMILEY] = "\360\237\230\207", /* 😇 (actually called: SMILING FACE WITH HALO) */
+ [SPECIAL_GLYPH_HAPPY_SMILEY] = "\360\237\230\200", /* 😀 (actually called: GRINNING FACE) */
+ [SPECIAL_GLYPH_SLIGHTLY_HAPPY_SMILEY] = "\360\237\231\202", /* 🙂 (actually called: SLIGHTLY SMILING FACE) */
+ [SPECIAL_GLYPH_NEUTRAL_SMILEY] = "\360\237\230\220", /* 😐 (actually called: NEUTRAL FACE) */
+ [SPECIAL_GLYPH_SLIGHTLY_UNHAPPY_SMILEY] = "\360\237\231\201", /* 🙁 (actually called: SLIGHTLY FROWNING FACE) */
+ [SPECIAL_GLYPH_UNHAPPY_SMILEY] = "\360\237\230\250", /* 😨 (actually called: FEARFUL FACE) */
+ [SPECIAL_GLYPH_DEPRESSED_SMILEY] = "\360\237\244\242", /* 🤢 (actually called: NAUSEATED FACE) */
+
+ /* This emoji is a single character cell glyph in Unicode, and three in ASCII */
+ [SPECIAL_GLYPH_LOCK_AND_KEY] = "\360\237\224\220", /* 🔐 (actually called: CLOSED LOCK WITH KEY) */
+
+ /* This emoji is a single character cell glyph in Unicode, and two in ASCII */
+ [SPECIAL_GLYPH_TOUCH] = "\360\237\221\206", /* 👆 (actually called: BACKHAND INDEX POINTING UP) */
+
+ /* These three emojis are single character cell glyphs in Unicode and also in ASCII. */
+ [SPECIAL_GLYPH_RECYCLING] = "\u267B\uFE0F ", /* ♻️ (actually called: UNIVERSAL RECYCLNG SYMBOL) */
+ [SPECIAL_GLYPH_DOWNLOAD] = "\u2935\uFE0F ", /* ⤵️ (actually called: RIGHT ARROW CURVING DOWN) */
+ [SPECIAL_GLYPH_SPARKLES] = "\u2728", /* ✨ */
+ },
+ };
+
+ if (code < 0)
+ return NULL;
+
+ assert(code < _SPECIAL_GLYPH_MAX);
+ return draw_table[code >= _SPECIAL_GLYPH_FIRST_EMOJI ? emoji_enabled() : is_locale_utf8()][code];
+}
diff --git a/src/basic/glyph-util.h b/src/basic/glyph-util.h
new file mode 100644
index 0000000000..ddee210041
--- /dev/null
+++ b/src/basic/glyph-util.h
@@ -0,0 +1,56 @@
+/* SPDX-License-Identifier: LGPL-2.1-or-later */
+#pragma once
+
+#include <errno.h>
+#include <stdbool.h>
+
+#include "macro.h"
+
+typedef enum SpecialGlyph {
+ SPECIAL_GLYPH_TREE_VERTICAL,
+ SPECIAL_GLYPH_TREE_BRANCH,
+ SPECIAL_GLYPH_TREE_RIGHT,
+ SPECIAL_GLYPH_TREE_SPACE,
+ SPECIAL_GLYPH_TRIANGULAR_BULLET,
+ SPECIAL_GLYPH_BLACK_CIRCLE,
+ SPECIAL_GLYPH_WHITE_CIRCLE,
+ SPECIAL_GLYPH_MULTIPLICATION_SIGN,
+ SPECIAL_GLYPH_CIRCLE_ARROW,
+ SPECIAL_GLYPH_BULLET,
+ SPECIAL_GLYPH_MU,
+ SPECIAL_GLYPH_CHECK_MARK,
+ SPECIAL_GLYPH_CROSS_MARK,
+ SPECIAL_GLYPH_ARROW,
+ SPECIAL_GLYPH_ELLIPSIS,
+ SPECIAL_GLYPH_LIGHT_SHADE,
+ SPECIAL_GLYPH_DARK_SHADE,
+ SPECIAL_GLYPH_SIGMA,
+ SPECIAL_GLYPH_EXTERNAL_LINK,
+ _SPECIAL_GLYPH_FIRST_EMOJI,
+ SPECIAL_GLYPH_ECSTATIC_SMILEY = _SPECIAL_GLYPH_FIRST_EMOJI,
+ SPECIAL_GLYPH_HAPPY_SMILEY,
+ SPECIAL_GLYPH_SLIGHTLY_HAPPY_SMILEY,
+ SPECIAL_GLYPH_NEUTRAL_SMILEY,
+ SPECIAL_GLYPH_SLIGHTLY_UNHAPPY_SMILEY,
+ SPECIAL_GLYPH_UNHAPPY_SMILEY,
+ SPECIAL_GLYPH_DEPRESSED_SMILEY,
+ SPECIAL_GLYPH_LOCK_AND_KEY,
+ SPECIAL_GLYPH_TOUCH,
+ SPECIAL_GLYPH_RECYCLING,
+ SPECIAL_GLYPH_DOWNLOAD,
+ SPECIAL_GLYPH_SPARKLES,
+ _SPECIAL_GLYPH_MAX,
+ _SPECIAL_GLYPH_INVALID = -EINVAL,
+} SpecialGlyph;
+
+const char *special_glyph(SpecialGlyph code) _const_;
+
+bool emoji_enabled(void);
+
+static inline const char *special_glyph_check_mark(bool b) {
+ return b ? special_glyph(SPECIAL_GLYPH_CHECK_MARK) : special_glyph(SPECIAL_GLYPH_CROSS_MARK);
+}
+
+static inline const char *special_glyph_check_mark_space(bool b) {
+ return b ? special_glyph(SPECIAL_GLYPH_CHECK_MARK) : " ";
+}
diff --git a/src/basic/locale-util.c b/src/basic/locale-util.c
index 007e3a091e..b6f9a760a4 100644
--- a/src/basic/locale-util.c
+++ b/src/basic/locale-util.c
@@ -317,129 +317,6 @@ out:
return (bool) cached_answer;
}
-bool emoji_enabled(void) {
- static int cached_emoji_enabled = -1;
-
- if (cached_emoji_enabled < 0) {
- int val;
-
- val = getenv_bool("SYSTEMD_EMOJI");
- if (val < 0)
- cached_emoji_enabled =
- is_locale_utf8() &&
- !STRPTR_IN_SET(getenv("TERM"), "dumb", "linux");
- else
- cached_emoji_enabled = val;
- }
-
- return cached_emoji_enabled;
-}
-
-const char *special_glyph(SpecialGlyph code) {
-
- /* A list of a number of interesting unicode glyphs we can use to decorate our output. It's probably wise to be
- * conservative here, and primarily stick to the glyphs defined in the eurlatgr font, so that display still
- * works reasonably well on the Linux console. For details see:
- *
- * http://git.altlinux.org/people/legion/packages/kbd.git?p=kbd.git;a=blob;f=data/consolefonts/README.eurlatgr
- */
-
- static const char* const draw_table[2][_SPECIAL_GLYPH_MAX] = {
- /* ASCII fallback */
- [false] = {
- [SPECIAL_GLYPH_TREE_VERTICAL] = "| ",
- [SPECIAL_GLYPH_TREE_BRANCH] = "|-",
- [SPECIAL_GLYPH_TREE_RIGHT] = "`-",
- [SPECIAL_GLYPH_TREE_SPACE] = " ",
- [SPECIAL_GLYPH_TRIANGULAR_BULLET] = ">",
- [SPECIAL_GLYPH_BLACK_CIRCLE] = "*",
- [SPECIAL_GLYPH_WHITE_CIRCLE] = "*",
- [SPECIAL_GLYPH_MULTIPLICATION_SIGN] = "x",
- [SPECIAL_GLYPH_CIRCLE_ARROW] = "*",
- [SPECIAL_GLYPH_BULLET] = "*",
- [SPECIAL_GLYPH_MU] = "u",
- [SPECIAL_GLYPH_CHECK_MARK] = "+",
- [SPECIAL_GLYPH_CROSS_MARK] = "-",
- [SPECIAL_GLYPH_LIGHT_SHADE] = "-",
- [SPECIAL_GLYPH_DARK_SHADE] = "X",
- [SPECIAL_GLYPH_SIGMA] = "S",
- [SPECIAL_GLYPH_ARROW] = "->",
- [SPECIAL_GLYPH_ELLIPSIS] = "...",
- [SPECIAL_GLYPH_EXTERNAL_LINK] = "[LNK]",
- [SPECIAL_GLYPH_ECSTATIC_SMILEY] = ":-]",
- [SPECIAL_GLYPH_HAPPY_SMILEY] = ":-}",
- [SPECIAL_GLYPH_SLIGHTLY_HAPPY_SMILEY] = ":-)",
- [SPECIAL_GLYPH_NEUTRAL_SMILEY] = ":-|",
- [SPECIAL_GLYPH_SLIGHTLY_UNHAPPY_SMILEY] = ":-(",
- [SPECIAL_GLYPH_UNHAPPY_SMILEY] = ":-{",
- [SPECIAL_GLYPH_DEPRESSED_SMILEY] = ":-[",
- [SPECIAL_GLYPH_LOCK_AND_KEY] = "o-,",
- [SPECIAL_GLYPH_TOUCH] = "O=", /* Yeah, not very convincing, can you do it better? */
- [SPECIAL_GLYPH_RECYCLING] = "~",
- [SPECIAL_GLYPH_DOWNLOAD] = "\\",
- [SPECIAL_GLYPH_SPARKLES] = "*",
- },
-
- /* UTF-8 */
- [true] = {
- /* The following are multiple glyphs in both ASCII and in UNICODE */
- [SPECIAL_GLYPH_TREE_VERTICAL] = "\342\224\202 ", /* │ */
- [SPECIAL_GLYPH_TREE_BRANCH] = "\342\224\234\342\224\200", /* ├─ */
- [SPECIAL_GLYPH_TREE_RIGHT] = "\342\224\224\342\224\200", /* └─ */
- [SPECIAL_GLYPH_TREE_SPACE] = " ", /* */
-
- /* Single glyphs in both cases */
- [SPECIAL_GLYPH_TRIANGULAR_BULLET] = "\342\200\243", /* ‣ */
- [SPECIAL_GLYPH_BLACK_CIRCLE] = "\342\227\217", /* ● */
- [SPECIAL_GLYPH_WHITE_CIRCLE] = "\u25CB", /* ○ */
- [SPECIAL_GLYPH_MULTIPLICATION_SIGN] = "\u00D7", /* × */
- [SPECIAL_GLYPH_CIRCLE_ARROW] = "\u21BB", /* ↻ */
- [SPECIAL_GLYPH_BULLET] = "\342\200\242", /* • */
- [SPECIAL_GLYPH_MU] = "\316\274", /* μ (actually called: GREEK SMALL LETTER MU) */
- [SPECIAL_GLYPH_CHECK_MARK] = "\342\234\223", /* ✓ */
- [SPECIAL_GLYPH_CROSS_MARK] = "\342\234\227", /* ✗ (actually called: BALLOT X) */
- [SPECIAL_GLYPH_LIGHT_SHADE] = "\342\226\221", /* ░ */
- [SPECIAL_GLYPH_DARK_SHADE] = "\342\226\223", /* ▒ */
- [SPECIAL_GLYPH_SIGMA] = "\316\243", /* Σ */
-
- /* Single glyph in Unicode, two in ASCII */
- [SPECIAL_GLYPH_ARROW] = "\342\206\222", /* → (actually called: RIGHTWARDS ARROW) */
-
- /* Single glyph in Unicode, three in ASCII */
- [SPECIAL_GLYPH_ELLIPSIS] = "\342\200\246", /* … (actually called: HORIZONTAL ELLIPSIS) */
-
- /* Three glyphs in Unicode, five in ASCII */
- [SPECIAL_GLYPH_EXTERNAL_LINK] = "[\360\237\241\225]", /* 🡕 (actually called: NORTH EAST SANS-SERIF ARROW, enclosed in []) */
-
- /* These smileys are a single glyph in Unicode, and three in ASCII */
- [SPECIAL_GLYPH_ECSTATIC_SMILEY] = "\360\237\230\207", /* 😇 (actually called: SMILING FACE WITH HALO) */
- [SPECIAL_GLYPH_HAPPY_SMILEY] = "\360\237\230\200", /* 😀 (actually called: GRINNING FACE) */
- [SPECIAL_GLYPH_SLIGHTLY_HAPPY_SMILEY] = "\360\237\231\202", /* 🙂 (actually called: SLIGHTLY SMILING FACE) */
- [SPECIAL_GLYPH_NEUTRAL_SMILEY] = "\360\237\230\220", /* 😐 (actually called: NEUTRAL FACE) */
- [SPECIAL_GLYPH_SLIGHTLY_UNHAPPY_SMILEY] = "\360\237\231\201", /* 🙁 (actually called: SLIGHTLY FROWNING FACE) */
- [SPECIAL_GLYPH_UNHAPPY_SMILEY] = "\360\237\230\250", /* 😨 (actually called: FEARFUL FACE) */
- [SPECIAL_GLYPH_DEPRESSED_SMILEY] = "\360\237\244\242", /* 🤢 (actually called: NAUSEATED FACE) */
-
- /* This emoji is a single character cell glyph in Unicode, and three in ASCII */
- [SPECIAL_GLYPH_LOCK_AND_KEY] = "\360\237\224\220", /* 🔐 (actually called: CLOSED LOCK WITH KEY) */
-
- /* This emoji is a single character cell glyph in Unicode, and two in ASCII */
- [SPECIAL_GLYPH_TOUCH] = "\360\237\221\206", /* 👆 (actually called: BACKHAND INDEX POINTING UP) */
-
- /* These three emojis are single character cell glyphs in Unicode and also in ASCII. */
- [SPECIAL_GLYPH_RECYCLING] = "\u267B\uFE0F ", /* ♻️ (actually called: UNIVERSAL RECYCLNG SYMBOL) */
- [SPECIAL_GLYPH_DOWNLOAD] = "\u2935\uFE0F ", /* ⤵️ (actually called: RIGHT ARROW CURVING DOWN) */
- [SPECIAL_GLYPH_SPARKLES] = "\u2728", /* ✨ */
- },
- };
-
- if (code < 0)
- return NULL;
-
- assert(code < _SPECIAL_GLYPH_MAX);
- return draw_table[code >= _SPECIAL_GLYPH_FIRST_EMOJI ? emoji_enabled() : is_locale_utf8()][code];
-}
-
void locale_variables_free(char *l[_VARIABLE_LC_MAX]) {
if (!l)
return;
diff --git a/src/basic/locale-util.h b/src/basic/locale-util.h
index 3430eb6ee1..bab927146b 100644
--- a/src/basic/locale-util.h
+++ b/src/basic/locale-util.h
@@ -2,8 +2,8 @@
#pragma once
#include <libintl.h>
-#include <stdbool.h>
#include <locale.h>
+#include <stdbool.h>
#include "macro.h"
@@ -39,47 +39,6 @@ void init_gettext(void);
bool is_locale_utf8(void);
-typedef enum SpecialGlyph {
- SPECIAL_GLYPH_TREE_VERTICAL,
- SPECIAL_GLYPH_TREE_BRANCH,
- SPECIAL_GLYPH_TREE_RIGHT,
- SPECIAL_GLYPH_TREE_SPACE,
- SPECIAL_GLYPH_TRIANGULAR_BULLET,
- SPECIAL_GLYPH_BLACK_CIRCLE,
- SPECIAL_GLYPH_WHITE_CIRCLE,
- SPECIAL_GLYPH_MULTIPLICATION_SIGN,
- SPECIAL_GLYPH_CIRCLE_ARROW,
- SPECIAL_GLYPH_BULLET,
- SPECIAL_GLYPH_MU,
- SPECIAL_GLYPH_CHECK_MARK,
- SPECIAL_GLYPH_CROSS_MARK,
- SPECIAL_GLYPH_ARROW,
- SPECIAL_GLYPH_ELLIPSIS,
- SPECIAL_GLYPH_LIGHT_SHADE,
- SPECIAL_GLYPH_DARK_SHADE,
- SPECIAL_GLYPH_SIGMA,
- SPECIAL_GLYPH_EXTERNAL_LINK,
- _SPECIAL_GLYPH_FIRST_EMOJI,
- SPECIAL_GLYPH_ECSTATIC_SMILEY = _SPECIAL_GLYPH_FIRST_EMOJI,
- SPECIAL_GLYPH_HAPPY_SMILEY,
- SPECIAL_GLYPH_SLIGHTLY_HAPPY_SMILEY,
- SPECIAL_GLYPH_NEUTRAL_SMILEY,
- SPECIAL_GLYPH_SLIGHTLY_UNHAPPY_SMILEY,
- SPECIAL_GLYPH_UNHAPPY_SMILEY,
- SPECIAL_GLYPH_DEPRESSED_SMILEY,
- SPECIAL_GLYPH_LOCK_AND_KEY,
- SPECIAL_GLYPH_TOUCH,
- SPECIAL_GLYPH_RECYCLING,
- SPECIAL_GLYPH_DOWNLOAD,
- SPECIAL_GLYPH_SPARKLES,
- _SPECIAL_GLYPH_MAX,
- _SPECIAL_GLYPH_INVALID = -EINVAL,
-} SpecialGlyph;
-
-const char *special_glyph(SpecialGlyph code) _const_;
-
-bool emoji_enabled(void);
-
const char* locale_variable_to_string(LocaleVariable i) _const_;
LocaleVariable locale_variable_from_string(const char *s) _pure_;
@@ -94,11 +53,3 @@ 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);
-}
-
-static inline const char *special_glyph_check_mark_space(bool b) {
- return b ? special_glyph(SPECIAL_GLYPH_CHECK_MARK) : " ";
-}
diff --git a/src/basic/meson.build b/src/basic/meson.build
index 7b42ac428c..ac084ce60a 100644
--- a/src/basic/meson.build
+++ b/src/basic/meson.build
@@ -58,6 +58,8 @@ basic_sources = files('''
fs-util.h
glob-util.c
glob-util.h
+ glyph-util.c
+ glyph-util.h
gunicode.c
gunicode.h
hash-funcs.c
diff --git a/src/basic/unit-def.h b/src/basic/unit-def.h
index 08651efa57..f80e554d2b 100644
--- a/src/basic/unit-def.h
+++ b/src/basic/unit-def.h
@@ -4,7 +4,7 @@
#include <stdbool.h>
#include "errno-list.h"
-#include "locale-util.h"
+#include "glyph-util.h"
#include "macro.h"
/* The enum order is used to order unit jobs in the job queue
diff --git a/src/boot/bootctl.c b/src/boot/bootctl.c
index 91b36e91ba..bb3627ed6e 100644
--- a/src/boot/bootctl.c
+++ b/src/boot/bootctl.c
@@ -25,7 +25,7 @@
#include "fd-util.h"
#include "fileio.h"
#include "fs-util.h"
-#include "locale-util.h"
+#include "glyph-util.h"
#include "main-func.h"
#include "mkdir.h"
#include "pager.h"
diff --git a/src/busctl/busctl.c b/src/busctl/busctl.c
index fb91fb41b6..27210e9389 100644
--- a/src/busctl/busctl.c
+++ b/src/busctl/busctl.c
@@ -16,8 +16,8 @@
#include "fd-util.h"
#include "fileio.h"
#include "format-table.h"
+#include "glyph-util.h"
#include "json.h"
-#include "locale-util.h"
#include "log.h"
#include "main-func.h"
#include "pager.h"
diff --git a/src/cryptenroll/cryptenroll-recovery.c b/src/cryptenroll/cryptenroll-recovery.c
index 3204c463a5..3fed4bcdd2 100644
--- a/src/cryptenroll/cryptenroll-recovery.c
+++ b/src/cryptenroll/cryptenroll-recovery.c
@@ -1,8 +1,8 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "cryptenroll-recovery.h"
+#include "glyph-util.h"
#include "json.h"
-#include "locale-util.h"
#include "memory-util.h"
#include "qrcode-util.h"
#include "recovery-key.h"
diff --git a/src/delta/delta.c b/src/delta/delta.c
index 282168a584..51fe4b4bed 100644
--- a/src/delta/delta.c
+++ b/src/delta/delta.c
@@ -9,8 +9,8 @@
#include "dirent-util.h"
#include "fd-util.h"
#include "fs-util.h"
+#include "glyph-util.h"
#include "hashmap.h"
-#include "locale-util.h"
#include "log.h"
#include "main-func.h"
#include "nulstr-util.h"
diff --git a/src/firstboot/firstboot.c b/src/firstboot/firstboot.c
index 6fdba66f57..1727649ae1 100644
--- a/src/firstboot/firstboot.c
+++ b/src/firstboot/firstboot.c
@@ -16,6 +16,7 @@
#include "fd-util.h"
#include "fileio.h"
#include "fs-util.h"
+#include "glyph-util.h"
#include "hostname-util.h"
#include "kbd-util.h"
#include "libcrypt-util.h"
diff --git a/src/home/homectl-recovery-key.c b/src/home/homectl-recovery-key.c
index f1a180baca..da1899ae14 100644
--- a/src/home/homectl-recovery-key.c
+++ b/src/home/homectl-recovery-key.c
@@ -1,9 +1,9 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "errno-util.h"
+#include "glyph-util.h"
#include "homectl-recovery-key.h"
#include "libcrypt-util.h"
-#include "locale-util.h"
#include "memory-util.h"
#include "qrcode-util.h"
#include "random-util.h"
diff --git a/src/home/homectl.c b/src/home/homectl.c
index 227c499c9c..d5b699a242 100644
--- a/src/home/homectl.c
+++ b/src/home/homectl.c
@@ -14,6 +14,7 @@
#include "fd-util.h"
#include "fileio.h"
#include "format-table.h"
+#include "glyph-util.h"
#include "home-util.h"
#include "homectl-fido2.h"
#include "homectl-pkcs11.h"
diff --git a/src/libsystemd/sd-bus/bus-dump.c b/src/libsystemd/sd-bus/bus-dump.c
index d50cd1eedd..0a4b3cbf68 100644
--- a/src/libsystemd/sd-bus/bus-dump.c
+++ b/src/libsystemd/sd-bus/bus-dump.c
@@ -11,7 +11,7 @@
#include "capability-util.h"
#include "fileio.h"
#include "format-util.h"
-#include "locale-util.h"
+#include "glyph-util.h"
#include "macro.h"
#include "string-util.h"
#include "strv.h"
diff --git a/src/login/sysfs-show.c b/src/login/sysfs-show.c
index 5c3af06cac..d79f753c9a 100644
--- a/src/login/sysfs-show.c
+++ b/src/login/sysfs-show.c
@@ -6,7 +6,7 @@
#include "alloc-util.h"
#include "device-enumerator-private.h"
-#include "locale-util.h"
+#include "glyph-util.h"
#include "path-util.h"
#include "string-util.h"
#include "sysfs-show.h"
diff --git a/src/partition/repart.c b/src/partition/repart.c
index 3203b48d8c..5422d5e1e5 100644
--- a/src/partition/repart.c
+++ b/src/partition/repart.c
@@ -34,12 +34,12 @@
#include "format-table.h"
#include "format-util.h"
#include "fs-util.h"
+#include "glyph-util.h"
#include "gpt.h"
#include "hexdecoct.h"
#include "id128-util.h"
#include "json.h"
#include "list.h"
-#include "locale-util.h"
#include "loop-util.h"
#include "main-func.h"
#include "mkdir.h"
diff --git a/src/shared/ask-password-api.c b/src/shared/ask-password-api.c
index 8b840ac84c..a60ccee4d8 100644
--- a/src/shared/ask-password-api.c
+++ b/src/shared/ask-password-api.c
@@ -26,8 +26,8 @@
#include "fileio.h"
#include "format-util.h"
#include "fs-util.h"
+#include "glyph-util.h"
#include "io-util.h"
-#include "locale-util.h"
#include "log.h"
#include "macro.h"
#include "memory-util.h"
diff --git a/src/shared/bus-unit-procs.c b/src/shared/bus-unit-procs.c
index 6f4a71138c..3bdcba325f 100644
--- a/src/shared/bus-unit-procs.c
+++ b/src/shared/bus-unit-procs.c
@@ -1,9 +1,9 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "bus-unit-procs.h"
+#include "glyph-util.h"
#include "hashmap.h"
#include "list.h"
-#include "locale-util.h"
#include "macro.h"
#include "path-util.h"
#include "process-util.h"
diff --git a/src/shared/format-table.c b/src/shared/format-table.c
index e524aa095e..81a7949a7f 100644
--- a/src/shared/format-table.c
+++ b/src/shared/format-table.c
@@ -12,10 +12,10 @@
#include "format-table.h"
#include "format-util.h"
#include "fs-util.h"
+#include "glyph-util.h"
#include "gunicode.h"
#include "id128-util.h"
#include "in-addr-util.h"
-#include "locale-util.h"
#include "memory-util.h"
#include "pager.h"
#include "parse-util.h"
diff --git a/src/shared/libfido2-util.c b/src/shared/libfido2-util.c
index 6d18178b68..a3356c139a 100644
--- a/src/shared/libfido2-util.c
+++ b/src/shared/libfido2-util.c
@@ -7,7 +7,7 @@
#include "ask-password-api.h"
#include "dlfcn-util.h"
#include "format-table.h"
-#include "locale-util.h"
+#include "glyph-util.h"
#include "log.h"
#include "memory-util.h"
#include "random-util.h"
diff --git a/src/shared/logs-show.c b/src/shared/logs-show.c
index 82fd13db75..75fe4f34f7 100644
--- a/src/shared/logs-show.c
+++ b/src/shared/logs-show.c
@@ -15,6 +15,7 @@
#include "alloc-util.h"
#include "fd-util.h"
#include "format-util.h"
+#include "glyph-util.h"
#include "hashmap.h"
#include "hostname-util.h"
#include "id128-util.h"
diff --git a/src/test/test-locale-util.c b/src/test/test-locale-util.c
index e22481b1b6..17a8c2b985 100644
--- a/src/test/test-locale-util.c
+++ b/src/test/test-locale-util.c
@@ -1,5 +1,6 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
+#include "glyph-util.h"
#include "kbd-util.h"
#include "locale-util.h"
#include "macro.h"