summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2022-02-16 14:53:34 +0100
committerLennart Poettering <lennart@poettering.net>2022-02-16 22:40:06 +0100
commitfc03e80c6b19521ecf4f3af06865b2054e685f9a (patch)
tree4129825bb6d05f3a67c85a215f186136e4c21f3d
parent3414394e0b978501a4b0dd9c4582a60ffce238e9 (diff)
downloadsystemd-fc03e80c6b19521ecf4f3af06865b2054e685f9a.tar.gz
glyph-util: add new glyphs for up/down arrows
-rw-r--r--src/analyze/analyze-security.c2
-rw-r--r--src/basic/chase-symlinks.c2
-rw-r--r--src/basic/glyph-util.c10
-rw-r--r--src/basic/glyph-util.h5
-rw-r--r--src/delta/delta.c20
-rw-r--r--src/partition/repart.c4
-rw-r--r--src/portable/portable.c6
-rw-r--r--src/portable/portablectl.c4
-rw-r--r--src/shared/cgroup-show.c2
-rw-r--r--src/shared/install.c2
-rw-r--r--src/test/test-locale-util.c5
11 files changed, 37 insertions, 25 deletions
diff --git a/src/analyze/analyze-security.c b/src/analyze/analyze-security.c
index 2691dc2c86..3ee7644a89 100644
--- a/src/analyze/analyze-security.c
+++ b/src/analyze/analyze-security.c
@@ -1902,7 +1902,7 @@ static int assess(const SecurityInfo *info,
name = info->id;
printf("\n%s %sOverall exposure level for %s%s: %s%" PRIu64 ".%" PRIu64 " %s%s %s\n",
- special_glyph(SPECIAL_GLYPH_ARROW),
+ special_glyph(SPECIAL_GLYPH_ARROW_RIGHT),
ansi_highlight(),
name,
ansi_normal(),
diff --git a/src/basic/chase-symlinks.c b/src/basic/chase-symlinks.c
index 344e7e1bb7..61f8b3351b 100644
--- a/src/basic/chase-symlinks.c
+++ b/src/basic/chase-symlinks.c
@@ -41,7 +41,7 @@ static int log_unsafe_transition(int a, int b, const char *path, unsigned flags)
return log_warning_errno(SYNTHETIC_ERRNO(ENOLINK),
"Detected unsafe path transition %s (owned by %s) %s %s (owned by %s) during canonicalization of %s.",
- strna(n1), strna(user_a), special_glyph(SPECIAL_GLYPH_ARROW), strna(n2), strna(user_b), path);
+ strna(n1), strna(user_a), special_glyph(SPECIAL_GLYPH_ARROW_RIGHT), strna(n2), strna(user_b), path);
}
static int log_autofs_mount_point(int fd, const char *path, unsigned flags) {
diff --git a/src/basic/glyph-util.c b/src/basic/glyph-util.c
index 8810738fc3..4583b7412c 100644
--- a/src/basic/glyph-util.c
+++ b/src/basic/glyph-util.c
@@ -39,6 +39,7 @@ const char *special_glyph(SpecialGlyph code) {
[SPECIAL_GLYPH_TREE_BRANCH] = "|-",
[SPECIAL_GLYPH_TREE_RIGHT] = "`-",
[SPECIAL_GLYPH_TREE_SPACE] = " ",
+ [SPECIAL_GLYPH_TREE_TOP] = ",-",
[SPECIAL_GLYPH_TRIANGULAR_BULLET] = ">",
[SPECIAL_GLYPH_BLACK_CIRCLE] = "*",
[SPECIAL_GLYPH_WHITE_CIRCLE] = "*",
@@ -51,7 +52,9 @@ const char *special_glyph(SpecialGlyph code) {
[SPECIAL_GLYPH_LIGHT_SHADE] = "-",
[SPECIAL_GLYPH_DARK_SHADE] = "X",
[SPECIAL_GLYPH_SIGMA] = "S",
- [SPECIAL_GLYPH_ARROW] = "->",
+ [SPECIAL_GLYPH_ARROW_RIGHT] = "->",
+ [SPECIAL_GLYPH_ARROW_UP] = "^",
+ [SPECIAL_GLYPH_ARROW_DOWN] = "v",
[SPECIAL_GLYPH_ELLIPSIS] = "...",
[SPECIAL_GLYPH_EXTERNAL_LINK] = "[LNK]",
[SPECIAL_GLYPH_ECSTATIC_SMILEY] = ":-]",
@@ -75,6 +78,7 @@ const char *special_glyph(SpecialGlyph code) {
[SPECIAL_GLYPH_TREE_BRANCH] = "\342\224\234\342\224\200", /* ├─ */
[SPECIAL_GLYPH_TREE_RIGHT] = "\342\224\224\342\224\200", /* └─ */
[SPECIAL_GLYPH_TREE_SPACE] = " ", /* */
+ [SPECIAL_GLYPH_TREE_TOP] = "\u250C\342\224\200", /* ┌─ */
/* Single glyphs in both cases */
[SPECIAL_GLYPH_TRIANGULAR_BULLET] = "\342\200\243", /* ‣ */
@@ -89,9 +93,11 @@ const char *special_glyph(SpecialGlyph code) {
[SPECIAL_GLYPH_LIGHT_SHADE] = "\342\226\221", /* ░ */
[SPECIAL_GLYPH_DARK_SHADE] = "\342\226\223", /* ▒ */
[SPECIAL_GLYPH_SIGMA] = "\316\243", /* Σ */
+ [SPECIAL_GLYPH_ARROW_UP] = "\u2191", /* ↑ (actually called: UPWARDS ARROW) */
+ [SPECIAL_GLYPH_ARROW_DOWN] = "\u2193", /* ↓ (actually called: DOWNWARDS ARROW) */
/* Single glyph in Unicode, two in ASCII */
- [SPECIAL_GLYPH_ARROW] = "\342\206\222", /* → (actually called: RIGHTWARDS ARROW) */
+ [SPECIAL_GLYPH_ARROW_RIGHT] = "\342\206\222", /* → (actually called: RIGHTWARDS ARROW) */
/* Single glyph in Unicode, three in ASCII */
[SPECIAL_GLYPH_ELLIPSIS] = "\342\200\246", /* … (actually called: HORIZONTAL ELLIPSIS) */
diff --git a/src/basic/glyph-util.h b/src/basic/glyph-util.h
index ddee210041..7e0a73842a 100644
--- a/src/basic/glyph-util.h
+++ b/src/basic/glyph-util.h
@@ -11,6 +11,7 @@ typedef enum SpecialGlyph {
SPECIAL_GLYPH_TREE_BRANCH,
SPECIAL_GLYPH_TREE_RIGHT,
SPECIAL_GLYPH_TREE_SPACE,
+ SPECIAL_GLYPH_TREE_TOP,
SPECIAL_GLYPH_TRIANGULAR_BULLET,
SPECIAL_GLYPH_BLACK_CIRCLE,
SPECIAL_GLYPH_WHITE_CIRCLE,
@@ -20,7 +21,9 @@ typedef enum SpecialGlyph {
SPECIAL_GLYPH_MU,
SPECIAL_GLYPH_CHECK_MARK,
SPECIAL_GLYPH_CROSS_MARK,
- SPECIAL_GLYPH_ARROW,
+ SPECIAL_GLYPH_ARROW_RIGHT,
+ SPECIAL_GLYPH_ARROW_UP,
+ SPECIAL_GLYPH_ARROW_DOWN,
SPECIAL_GLYPH_ELLIPSIS,
SPECIAL_GLYPH_LIGHT_SHADE,
SPECIAL_GLYPH_DARK_SHADE,
diff --git a/src/delta/delta.c b/src/delta/delta.c
index 3f1b206e6c..e14ad36d03 100644
--- a/src/delta/delta.c
+++ b/src/delta/delta.c
@@ -91,7 +91,7 @@ static int notify_override_masked(const char *top, const char *bottom) {
printf("%s%s%s %s %s %s\n",
ansi_highlight_red(), "[MASKED]", ansi_normal(),
- top, special_glyph(SPECIAL_GLYPH_ARROW), bottom);
+ top, special_glyph(SPECIAL_GLYPH_ARROW_RIGHT), bottom);
return 1;
}
@@ -101,7 +101,7 @@ static int notify_override_equivalent(const char *top, const char *bottom) {
printf("%s%s%s %s %s %s\n",
ansi_highlight_green(), "[EQUIVALENT]", ansi_normal(),
- top, special_glyph(SPECIAL_GLYPH_ARROW), bottom);
+ top, special_glyph(SPECIAL_GLYPH_ARROW_RIGHT), bottom);
return 1;
}
@@ -111,7 +111,7 @@ static int notify_override_redirected(const char *top, const char *bottom) {
printf("%s%s%s %s %s %s\n",
ansi_highlight(), "[REDIRECTED]", ansi_normal(),
- top, special_glyph(SPECIAL_GLYPH_ARROW), bottom);
+ top, special_glyph(SPECIAL_GLYPH_ARROW_RIGHT), bottom);
return 1;
}
@@ -121,7 +121,7 @@ static int notify_override_overridden(const char *top, const char *bottom) {
printf("%s%s%s %s %s %s\n",
ansi_highlight(), "[OVERRIDDEN]", ansi_normal(),
- top, special_glyph(SPECIAL_GLYPH_ARROW), bottom);
+ top, special_glyph(SPECIAL_GLYPH_ARROW_RIGHT), bottom);
return 1;
}
@@ -131,7 +131,7 @@ static int notify_override_extended(const char *top, const char *bottom) {
printf("%s%s%s %s %s %s\n",
ansi_highlight(), "[EXTENDED]", ansi_normal(),
- top, special_glyph(SPECIAL_GLYPH_ARROW), bottom);
+ top, special_glyph(SPECIAL_GLYPH_ARROW_RIGHT), bottom);
return 1;
}
@@ -236,7 +236,7 @@ static int enumerate_dir_d(
return -ENOMEM;
d = p + strlen(toppath) + 1;
- log_debug("Adding at top: %s %s %s", d, special_glyph(SPECIAL_GLYPH_ARROW), p);
+ log_debug("Adding at top: %s %s %s", d, special_glyph(SPECIAL_GLYPH_ARROW_RIGHT), p);
k = ordered_hashmap_put(top, d, p);
if (k >= 0) {
p = strdup(p);
@@ -248,7 +248,7 @@ static int enumerate_dir_d(
return k;
}
- log_debug("Adding at bottom: %s %s %s", d, special_glyph(SPECIAL_GLYPH_ARROW), p);
+ log_debug("Adding at bottom: %s %s %s", d, special_glyph(SPECIAL_GLYPH_ARROW_RIGHT), p);
free(ordered_hashmap_remove(bottom, d));
k = ordered_hashmap_put(bottom, d, p);
if (k < 0) {
@@ -272,7 +272,7 @@ static int enumerate_dir_d(
return -ENOMEM;
log_debug("Adding to drops: %s %s %s %s %s",
- unit, special_glyph(SPECIAL_GLYPH_ARROW), basename(p), special_glyph(SPECIAL_GLYPH_ARROW), p);
+ unit, special_glyph(SPECIAL_GLYPH_ARROW_RIGHT), basename(p), special_glyph(SPECIAL_GLYPH_ARROW_RIGHT), p);
k = ordered_hashmap_put(h, basename(p), p);
if (k < 0) {
free(p);
@@ -349,7 +349,7 @@ static int enumerate_dir(
if (!p)
return -ENOMEM;
- log_debug("Adding at top: %s %s %s", basename(p), special_glyph(SPECIAL_GLYPH_ARROW), p);
+ log_debug("Adding at top: %s %s %s", basename(p), special_glyph(SPECIAL_GLYPH_ARROW_RIGHT), p);
r = ordered_hashmap_put(top, basename(p), p);
if (r >= 0) {
p = strdup(p);
@@ -358,7 +358,7 @@ static int enumerate_dir(
} else if (r != -EEXIST)
return r;
- log_debug("Adding at bottom: %s %s %s", basename(p), special_glyph(SPECIAL_GLYPH_ARROW), p);
+ log_debug("Adding at bottom: %s %s %s", basename(p), special_glyph(SPECIAL_GLYPH_ARROW_RIGHT), p);
free(ordered_hashmap_remove(bottom, basename(p)));
r = ordered_hashmap_put(bottom, basename(p), p);
if (r < 0)
diff --git a/src/partition/repart.c b/src/partition/repart.c
index abdf947dbf..91645202fc 100644
--- a/src/partition/repart.c
+++ b/src/partition/repart.c
@@ -1969,9 +1969,9 @@ static int format_size_change(uint64_t from, uint64_t to, char **ret) {
if (from == to || to == UINT64_MAX)
t = strdup(FORMAT_BYTES(from));
else
- t = strjoin(FORMAT_BYTES(from), " ", special_glyph(SPECIAL_GLYPH_ARROW), " ", FORMAT_BYTES(to));
+ t = strjoin(FORMAT_BYTES(from), " ", special_glyph(SPECIAL_GLYPH_ARROW_RIGHT), " ", FORMAT_BYTES(to));
} else if (to != UINT64_MAX)
- t = strjoin(special_glyph(SPECIAL_GLYPH_ARROW), " ", FORMAT_BYTES(to));
+ t = strjoin(special_glyph(SPECIAL_GLYPH_ARROW_RIGHT), " ", FORMAT_BYTES(to));
else {
*ret = NULL;
return 0;
diff --git a/src/portable/portable.c b/src/portable/portable.c
index d91ce7bc71..a54e091185 100644
--- a/src/portable/portable.c
+++ b/src/portable/portable.c
@@ -1052,14 +1052,14 @@ static int install_profile_dropin(
r = copy_file_atomic(from, dropin, 0644, 0, 0, COPY_REFLINK);
if (r < 0)
- return log_debug_errno(r, "Failed to copy %s %s %s: %m", from, special_glyph(SPECIAL_GLYPH_ARROW), dropin);
+ return log_debug_errno(r, "Failed to copy %s %s %s: %m", from, special_glyph(SPECIAL_GLYPH_ARROW_RIGHT), dropin);
(void) portable_changes_add(changes, n_changes, PORTABLE_COPY, dropin, from);
} else {
if (symlink(from, dropin) < 0)
- return log_debug_errno(errno, "Failed to link %s %s %s: %m", from, special_glyph(SPECIAL_GLYPH_ARROW), dropin);
+ return log_debug_errno(errno, "Failed to link %s %s %s: %m", from, special_glyph(SPECIAL_GLYPH_ARROW_RIGHT), dropin);
(void) portable_changes_add(changes, n_changes, PORTABLE_SYMLINK, dropin, from);
}
@@ -1229,7 +1229,7 @@ static int install_image_symlink(
(void) mkdir_parents(sl, 0755);
if (symlink(image_path, sl) < 0)
- return log_debug_errno(errno, "Failed to link %s %s %s: %m", image_path, special_glyph(SPECIAL_GLYPH_ARROW), sl);
+ return log_debug_errno(errno, "Failed to link %s %s %s: %m", image_path, special_glyph(SPECIAL_GLYPH_ARROW_RIGHT), sl);
(void) portable_changes_add(changes, n_changes, PORTABLE_SYMLINK, sl, image_path);
return 0;
diff --git a/src/portable/portablectl.c b/src/portable/portablectl.c
index eee26d0033..bc7a4ddc21 100644
--- a/src/portable/portablectl.c
+++ b/src/portable/portablectl.c
@@ -502,12 +502,12 @@ static int print_changes(sd_bus_message *m) {
break;
if (streq(type, "symlink"))
- log_info("Created symlink %s %s %s.", path, special_glyph(SPECIAL_GLYPH_ARROW), source);
+ log_info("Created symlink %s %s %s.", path, special_glyph(SPECIAL_GLYPH_ARROW_RIGHT), source);
else if (streq(type, "copy")) {
if (isempty(source))
log_info("Copied %s.", path);
else
- log_info("Copied %s %s %s.", source, special_glyph(SPECIAL_GLYPH_ARROW), path);
+ log_info("Copied %s %s %s.", source, special_glyph(SPECIAL_GLYPH_ARROW_RIGHT), path);
} else if (streq(type, "unlink"))
log_info("Removed %s.", path);
else if (streq(type, "write"))
diff --git a/src/shared/cgroup-show.c b/src/shared/cgroup-show.c
index 48dd4d8001..f18420c1b6 100644
--- a/src/shared/cgroup-show.c
+++ b/src/shared/cgroup-show.c
@@ -228,7 +228,7 @@ static int show_cgroup_name(
printf("%s%s%s %s%s%s: %s\n",
prefix,
glyph == SPECIAL_GLYPH_TREE_BRANCH ? special_glyph(SPECIAL_GLYPH_TREE_VERTICAL) : " ",
- special_glyph(SPECIAL_GLYPH_ARROW),
+ special_glyph(SPECIAL_GLYPH_ARROW_RIGHT),
ansi_blue(), x, ansi_normal(),
y);
}
diff --git a/src/shared/install.c b/src/shared/install.c
index 8f1af755fa..d0b3b68b4e 100644
--- a/src/shared/install.c
+++ b/src/shared/install.c
@@ -336,7 +336,7 @@ void unit_file_dump_changes(int r, const char *verb, const UnitFileChange *chang
if (!quiet)
log_info("Created symlink %s %s %s.",
changes[i].path,
- special_glyph(SPECIAL_GLYPH_ARROW),
+ special_glyph(SPECIAL_GLYPH_ARROW_RIGHT),
changes[i].source);
break;
case UNIT_FILE_UNLINK:
diff --git a/src/test/test-locale-util.c b/src/test/test-locale-util.c
index 55f86f7c2f..9bbc5917a1 100644
--- a/src/test/test-locale-util.c
+++ b/src/test/test-locale-util.c
@@ -93,13 +93,16 @@ TEST(dump_special_glyphs) {
dump_glyph(SPECIAL_GLYPH_TREE_BRANCH);
dump_glyph(SPECIAL_GLYPH_TREE_RIGHT);
dump_glyph(SPECIAL_GLYPH_TREE_SPACE);
+ dump_glyph(SPECIAL_GLYPH_TREE_TOP);
dump_glyph(SPECIAL_GLYPH_TRIANGULAR_BULLET);
dump_glyph(SPECIAL_GLYPH_BLACK_CIRCLE);
dump_glyph(SPECIAL_GLYPH_WHITE_CIRCLE);
dump_glyph(SPECIAL_GLYPH_MULTIPLICATION_SIGN);
dump_glyph(SPECIAL_GLYPH_CIRCLE_ARROW);
dump_glyph(SPECIAL_GLYPH_BULLET);
- dump_glyph(SPECIAL_GLYPH_ARROW);
+ dump_glyph(SPECIAL_GLYPH_ARROW_RIGHT);
+ dump_glyph(SPECIAL_GLYPH_ARROW_UP);
+ dump_glyph(SPECIAL_GLYPH_ARROW_DOWN);
dump_glyph(SPECIAL_GLYPH_ELLIPSIS);
dump_glyph(SPECIAL_GLYPH_MU);
dump_glyph(SPECIAL_GLYPH_CHECK_MARK);