1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-03-08 20:58:20 +03:00

locale-util: prefix special glyph enum values with SPECIAL_GLYPH_

This has been irritating me for quite a while: let's prefix these enum
values with a common prefix, like we do for almost all other enums.

No change in behaviour, just some renaming.
This commit is contained in:
Lennart Poettering 2018-12-13 22:11:32 +01:00 committed by Zbigniew Jędrzejewski-Szmek
parent fd0ec39d38
commit 9a6f746fb6
20 changed files with 152 additions and 152 deletions

View File

@ -1385,13 +1385,13 @@ static int assess(const struct security_info *info, Table *overview_table, Analy
const char *color;
SpecialGlyph smiley;
} badness_table[] = {
{ 100, "DANGEROUS", ANSI_HIGHLIGHT_RED, DEPRESSED_SMILEY },
{ 90, "UNSAFE", ANSI_HIGHLIGHT_RED, UNHAPPY_SMILEY },
{ 75, "EXPOSED", ANSI_HIGHLIGHT_YELLOW, SLIGHTLY_UNHAPPY_SMILEY },
{ 50, "MEDIUM", NULL, NEUTRAL_SMILEY },
{ 10, "OK", ANSI_HIGHLIGHT_GREEN, SLIGHTLY_HAPPY_SMILEY },
{ 1, "SAFE", ANSI_HIGHLIGHT_GREEN, HAPPY_SMILEY },
{ 0, "PERFECT", ANSI_HIGHLIGHT_GREEN, ECSTATIC_SMILEY },
{ 100, "DANGEROUS", ANSI_HIGHLIGHT_RED, SPECIAL_GLYPH_DEPRESSED_SMILEY },
{ 90, "UNSAFE", ANSI_HIGHLIGHT_RED, SPECIAL_GLYPH_UNHAPPY_SMILEY },
{ 75, "EXPOSED", ANSI_HIGHLIGHT_YELLOW, SPECIAL_GLYPH_SLIGHTLY_UNHAPPY_SMILEY },
{ 50, "MEDIUM", NULL, SPECIAL_GLYPH_NEUTRAL_SMILEY },
{ 10, "OK", ANSI_HIGHLIGHT_GREEN, SPECIAL_GLYPH_SLIGHTLY_HAPPY_SMILEY },
{ 1, "SAFE", ANSI_HIGHLIGHT_GREEN, SPECIAL_GLYPH_HAPPY_SMILEY },
{ 0, "PERFECT", ANSI_HIGHLIGHT_GREEN, SPECIAL_GLYPH_ECSTATIC_SMILEY },
};
uint64_t badness_sum = 0, weight_sum = 0, exposure;
@ -1448,15 +1448,15 @@ static int assess(const struct security_info *info, Table *overview_table, Analy
description = a->description_na;
color = NULL;
} else if (badness == a->range) {
checkmark = special_glyph(CROSS_MARK);
checkmark = special_glyph(SPECIAL_GLYPH_CROSS_MARK);
description = a->description_bad;
color = ansi_highlight_red();
} else if (badness == 0) {
checkmark = special_glyph(CHECK_MARK);
checkmark = special_glyph(SPECIAL_GLYPH_CHECK_MARK);
description = a->description_good;
color = ansi_highlight_green();
} else {
checkmark = special_glyph(CROSS_MARK);
checkmark = special_glyph(SPECIAL_GLYPH_CROSS_MARK);
description = NULL;
color = ansi_highlight_red();
}
@ -1557,7 +1557,7 @@ static int assess(const struct security_info *info, Table *overview_table, Analy
name = info->id;
printf("\n%s %sOverall exposure level for %s%s: %s%" PRIu64 ".%" PRIu64 " %s%s %s\n",
special_glyph(ARROW),
special_glyph(SPECIAL_GLYPH_ARROW),
ansi_highlight(),
name,
ansi_normal(),

View File

@ -823,9 +823,9 @@ static int list_dependencies_print(const char *name, unsigned level, unsigned br
char ts[FORMAT_TIMESPAN_MAX], ts2[FORMAT_TIMESPAN_MAX];
for (i = level; i != 0; i--)
printf("%s", special_glyph(branches & (1 << (i-1)) ? TREE_VERTICAL : TREE_SPACE));
printf("%s", special_glyph(branches & (1 << (i-1)) ? SPECIAL_GLYPH_TREE_VERTICAL : SPECIAL_GLYPH_TREE_SPACE));
printf("%s", special_glyph(last ? TREE_RIGHT : TREE_BRANCH));
printf("%s", special_glyph(last ? SPECIAL_GLYPH_TREE_RIGHT : SPECIAL_GLYPH_TREE_BRANCH));
if (times) {
if (times->time > 0)
@ -1659,7 +1659,7 @@ static int dump_timespan(int argc, char *argv[], void *userdata) {
return log_error_errno(r, "Failed to parse time span '%s': %m", *input_timespan);
printf("Original: %s\n", *input_timespan);
printf(" %ss: %" PRIu64 "\n", special_glyph(MU), output_usecs);
printf(" %ss: %" PRIu64 "\n", special_glyph(SPECIAL_GLYPH_MU), output_usecs);
printf(" Human: %s\n", format_timespan(ft_buf, sizeof(ft_buf), output_usecs, usec_magnitude));
if (input_timespan[1])

View File

@ -686,7 +686,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 %s %s during canonicalization of %s.",
n1, special_glyph(ARROW), n2, path);
n1, special_glyph(SPECIAL_GLYPH_ARROW), n2, path);
}
static int log_autofs_mount_point(int fd, const char *path, unsigned flags) {

View File

@ -378,50 +378,50 @@ const char *special_glyph(SpecialGlyph code) {
static const char* const draw_table[2][_SPECIAL_GLYPH_MAX] = {
/* ASCII fallback */
[false] = {
[TREE_VERTICAL] = "| ",
[TREE_BRANCH] = "|-",
[TREE_RIGHT] = "`-",
[TREE_SPACE] = " ",
[TRIANGULAR_BULLET] = ">",
[BLACK_CIRCLE] = "*",
[BULLET] = "*",
[ARROW] = "->",
[MDASH] = "-",
[ELLIPSIS] = "...",
[MU] = "u",
[CHECK_MARK] = "+",
[CROSS_MARK] = "-",
[ECSTATIC_SMILEY] = ":-]",
[HAPPY_SMILEY] = ":-}",
[SLIGHTLY_HAPPY_SMILEY] = ":-)",
[NEUTRAL_SMILEY] = ":-|",
[SLIGHTLY_UNHAPPY_SMILEY] = ":-(",
[UNHAPPY_SMILEY] = ":-{",
[DEPRESSED_SMILEY] = ":-[",
[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_BULLET] = "*",
[SPECIAL_GLYPH_ARROW] = "->",
[SPECIAL_GLYPH_MDASH] = "-",
[SPECIAL_GLYPH_ELLIPSIS] = "...",
[SPECIAL_GLYPH_MU] = "u",
[SPECIAL_GLYPH_CHECK_MARK] = "+",
[SPECIAL_GLYPH_CROSS_MARK] = "-",
[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] = ":-[",
},
/* UTF-8 */
[true] = {
[TREE_VERTICAL] = "\342\224\202 ", /* │ */
[TREE_BRANCH] = "\342\224\234\342\224\200", /* ├─ */
[TREE_RIGHT] = "\342\224\224\342\224\200", /* └─ */
[TREE_SPACE] = " ", /* */
[TRIANGULAR_BULLET] = "\342\200\243", /* ‣ */
[BLACK_CIRCLE] = "\342\227\217", /* ● */
[BULLET] = "\342\200\242", /* • */
[ARROW] = "\342\206\222", /* → */
[MDASH] = "\342\200\223", /* */
[ELLIPSIS] = "\342\200\246", /* … */
[MU] = "\316\274", /* μ */
[CHECK_MARK] = "\342\234\223", /* ✓ */
[CROSS_MARK] = "\342\234\227", /* ✗ */
[ECSTATIC_SMILEY] = "\360\237\230\207", /* 😇 */
[HAPPY_SMILEY] = "\360\237\230\200", /* 😀 */
[SLIGHTLY_HAPPY_SMILEY] = "\360\237\231\202", /* 🙂 */
[NEUTRAL_SMILEY] = "\360\237\230\220", /* 😐 */
[SLIGHTLY_UNHAPPY_SMILEY] = "\360\237\231\201", /* 🙁 */
[UNHAPPY_SMILEY] = "\360\237\230\250", /* 😨️️ */
[DEPRESSED_SMILEY] = "\360\237\244\242", /* 🤢 */
[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] = " ", /* */
[SPECIAL_GLYPH_TRIANGULAR_BULLET] = "\342\200\243", /* ‣ */
[SPECIAL_GLYPH_BLACK_CIRCLE] = "\342\227\217", /* ● */
[SPECIAL_GLYPH_BULLET] = "\342\200\242", /* • */
[SPECIAL_GLYPH_ARROW] = "\342\206\222", /* → */
[SPECIAL_GLYPH_MDASH] = "\342\200\223", /* */
[SPECIAL_GLYPH_ELLIPSIS] = "\342\200\246", /* … */
[SPECIAL_GLYPH_MU] = "\316\274", /* μ */
[SPECIAL_GLYPH_CHECK_MARK] = "\342\234\223", /* ✓ */
[SPECIAL_GLYPH_CROSS_MARK] = "\342\234\227", /* ✗ */
[SPECIAL_GLYPH_ECSTATIC_SMILEY] = "\360\237\230\207", /* 😇 */
[SPECIAL_GLYPH_HAPPY_SMILEY] = "\360\237\230\200", /* 😀 */
[SPECIAL_GLYPH_SLIGHTLY_HAPPY_SMILEY] = "\360\237\231\202", /* 🙂 */
[SPECIAL_GLYPH_NEUTRAL_SMILEY] = "\360\237\230\220", /* 😐 */
[SPECIAL_GLYPH_SLIGHTLY_UNHAPPY_SMILEY] = "\360\237\231\201", /* 🙁 */
[SPECIAL_GLYPH_UNHAPPY_SMILEY] = "\360\237\230\250", /* 😨️️ */
[SPECIAL_GLYPH_DEPRESSED_SMILEY] = "\360\237\244\242", /* 🤢 */
},
};

View File

@ -39,27 +39,27 @@ void init_gettext(void);
bool is_locale_utf8(void);
typedef enum {
TREE_VERTICAL,
TREE_BRANCH,
TREE_RIGHT,
TREE_SPACE,
TRIANGULAR_BULLET,
BLACK_CIRCLE,
BULLET,
ARROW,
MDASH,
ELLIPSIS,
MU,
CHECK_MARK,
CROSS_MARK,
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_BULLET,
SPECIAL_GLYPH_ARROW,
SPECIAL_GLYPH_MDASH,
SPECIAL_GLYPH_ELLIPSIS,
SPECIAL_GLYPH_MU,
SPECIAL_GLYPH_CHECK_MARK,
SPECIAL_GLYPH_CROSS_MARK,
_SPECIAL_GLYPH_FIRST_SMILEY,
ECSTATIC_SMILEY = _SPECIAL_GLYPH_FIRST_SMILEY,
HAPPY_SMILEY,
SLIGHTLY_HAPPY_SMILEY,
NEUTRAL_SMILEY,
SLIGHTLY_UNHAPPY_SMILEY,
UNHAPPY_SMILEY,
DEPRESSED_SMILEY,
SPECIAL_GLYPH_ECSTATIC_SMILEY = _SPECIAL_GLYPH_FIRST_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_MAX
} SpecialGlyph;

View File

@ -163,9 +163,9 @@ static int enumerate_binaries(const char *esp_path, const char *path, const char
if (r < 0)
return r;
if (r > 0)
printf(" File: %s/%s/%s (%s%s%s)\n", special_glyph(TREE_RIGHT), path, de->d_name, ansi_highlight(), v, ansi_normal());
printf(" File: %s/%s/%s (%s%s%s)\n", special_glyph(SPECIAL_GLYPH_TREE_RIGHT), path, de->d_name, ansi_highlight(), v, ansi_normal());
else
printf(" File: %s/%s/%s\n", special_glyph(TREE_RIGHT), path, de->d_name);
printf(" File: %s/%s/%s\n", special_glyph(SPECIAL_GLYPH_TREE_RIGHT), path, de->d_name);
c++;
}
@ -225,7 +225,7 @@ static int print_efi_option(uint16_t id, bool in_order) {
printf(" ID: 0x%04X\n", id);
printf(" Status: %sactive%s\n", active ? "" : "in", in_order ? ", boot-order" : "");
printf(" Partition: /dev/disk/by-partuuid/%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x\n", SD_ID128_FORMAT_VAL(partition));
printf(" File: %s%s\n", special_glyph(TREE_RIGHT), path);
printf(" File: %s%s\n", special_glyph(SPECIAL_GLYPH_TREE_RIGHT), path);
printf("\n");
return 0;
@ -1020,9 +1020,9 @@ static int verb_status(int argc, char *argv[], void *userdata) {
printf(" ");
if (FLAGS_SET(loader_features, flags[i].flag))
printf("%s%s%s %s\n", ansi_highlight_green(), special_glyph(CHECK_MARK), ansi_normal(), flags[i].name);
printf("%s%s%s %s\n", ansi_highlight_green(), special_glyph(SPECIAL_GLYPH_CHECK_MARK), ansi_normal(), flags[i].name);
else
printf("%s%s%s %s\n", ansi_highlight_red(), special_glyph(CROSS_MARK), ansi_normal(), flags[i].name);
printf("%s%s%s %s\n", ansi_highlight_red(), special_glyph(SPECIAL_GLYPH_CROSS_MARK), ansi_normal(), flags[i].name);
}
if (stub)
@ -1032,7 +1032,7 @@ static int verb_status(int argc, char *argv[], void *userdata) {
SD_ID128_FORMAT_VAL(loader_part_uuid));
else
printf(" ESP: n/a\n");
printf(" File: %s%s\n", special_glyph(TREE_RIGHT), strna(loader_path));
printf(" File: %s%s\n", special_glyph(SPECIAL_GLYPH_TREE_RIGHT), strna(loader_path));
printf("\n");
} else
printf("System:\n Not booted with EFI\n\n");

View File

@ -329,8 +329,8 @@ static void print_subtree(const char *prefix, const char *path, char **l) {
l++;
}
vertical = strjoina(prefix, special_glyph(TREE_VERTICAL));
space = strjoina(prefix, special_glyph(TREE_SPACE));
vertical = strjoina(prefix, special_glyph(SPECIAL_GLYPH_TREE_VERTICAL));
space = strjoina(prefix, special_glyph(SPECIAL_GLYPH_TREE_SPACE));
for (;;) {
bool has_more = false;
@ -351,7 +351,7 @@ static void print_subtree(const char *prefix, const char *path, char **l) {
n++;
}
printf("%s%s%s\n", prefix, special_glyph(has_more ? TREE_BRANCH : TREE_RIGHT), *l);
printf("%s%s%s\n", prefix, special_glyph(has_more ? SPECIAL_GLYPH_TREE_BRANCH : SPECIAL_GLYPH_TREE_RIGHT), *l);
print_subtree(has_more ? vertical : space, *l, l);
l = n;

View File

@ -90,7 +90,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(ARROW), bottom);
top, special_glyph(SPECIAL_GLYPH_ARROW), bottom);
return 1;
}
@ -100,7 +100,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(ARROW), bottom);
top, special_glyph(SPECIAL_GLYPH_ARROW), bottom);
return 1;
}
@ -110,7 +110,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(ARROW), bottom);
top, special_glyph(SPECIAL_GLYPH_ARROW), bottom);
return 1;
}
@ -120,7 +120,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(ARROW), bottom);
top, special_glyph(SPECIAL_GLYPH_ARROW), bottom);
return 1;
}
@ -130,7 +130,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(ARROW), bottom);
top, special_glyph(SPECIAL_GLYPH_ARROW), bottom);
return 1;
}
@ -235,7 +235,7 @@ static int enumerate_dir_d(
return -ENOMEM;
d = p + strlen(toppath) + 1;
log_debug("Adding at top: %s %s %s", d, special_glyph(ARROW), p);
log_debug("Adding at top: %s %s %s", d, special_glyph(SPECIAL_GLYPH_ARROW), p);
k = ordered_hashmap_put(top, d, p);
if (k >= 0) {
p = strdup(p);
@ -247,7 +247,7 @@ static int enumerate_dir_d(
return k;
}
log_debug("Adding at bottom: %s %s %s", d, special_glyph(ARROW), p);
log_debug("Adding at bottom: %s %s %s", d, special_glyph(SPECIAL_GLYPH_ARROW), p);
free(ordered_hashmap_remove(bottom, d));
k = ordered_hashmap_put(bottom, d, p);
if (k < 0) {
@ -271,7 +271,7 @@ static int enumerate_dir_d(
return -ENOMEM;
log_debug("Adding to drops: %s %s %s %s %s",
unit, special_glyph(ARROW), basename(p), special_glyph(ARROW), p);
unit, special_glyph(SPECIAL_GLYPH_ARROW), basename(p), special_glyph(SPECIAL_GLYPH_ARROW), p);
k = ordered_hashmap_put(h, basename(p), p);
if (k < 0) {
free(p);
@ -351,7 +351,7 @@ static int enumerate_dir(
if (!p)
return -ENOMEM;
log_debug("Adding at top: %s %s %s", basename(p), special_glyph(ARROW), p);
log_debug("Adding at top: %s %s %s", basename(p), special_glyph(SPECIAL_GLYPH_ARROW), p);
r = ordered_hashmap_put(top, basename(p), p);
if (r >= 0) {
p = strdup(p);
@ -360,7 +360,7 @@ static int enumerate_dir(
} else if (r != -EEXIST)
return r;
log_debug("Adding at bottom: %s %s %s", basename(p), special_glyph(ARROW), p);
log_debug("Adding at bottom: %s %s %s", basename(p), special_glyph(SPECIAL_GLYPH_ARROW), p);
free(ordered_hashmap_remove(bottom, basename(p)));
r = ordered_hashmap_put(bottom, basename(p), p);
if (r < 0)

View File

@ -162,7 +162,7 @@ static int prompt_loop(const char *text, char **l, bool (*is_valid)(const char *
_cleanup_free_ char *p = NULL;
unsigned u;
r = ask_string(&p, "%s %s (empty to skip): ", special_glyph(TRIANGULAR_BULLET), text);
r = ask_string(&p, "%s %s (empty to skip): ", special_glyph(SPECIAL_GLYPH_TRIANGULAR_BULLET), text);
if (r < 0)
return log_error_errno(r, "Failed to query user: %m");
@ -451,7 +451,7 @@ static int prompt_hostname(void) {
for (;;) {
_cleanup_free_ char *h = NULL;
r = ask_string(&h, "%s Please enter hostname for new system (empty to skip): ", special_glyph(TRIANGULAR_BULLET));
r = ask_string(&h, "%s Please enter hostname for new system (empty to skip): ", special_glyph(SPECIAL_GLYPH_TRIANGULAR_BULLET));
if (r < 0)
return log_error_errno(r, "Failed to query hostname: %m");
@ -538,8 +538,8 @@ static int prompt_root_password(void) {
print_welcome();
putchar('\n');
msg1 = strjoina(special_glyph(TRIANGULAR_BULLET), " Please enter a new root password (empty to skip): ");
msg2 = strjoina(special_glyph(TRIANGULAR_BULLET), " Please enter new root password again: ");
msg1 = strjoina(special_glyph(SPECIAL_GLYPH_TRIANGULAR_BULLET), " Please enter a new root password (empty to skip): ");
msg2 = strjoina(special_glyph(SPECIAL_GLYPH_TRIANGULAR_BULLET), " Please enter new root password again: ");
for (;;) {
_cleanup_strv_free_erase_ char **a = NULL, **b = NULL;

View File

@ -60,7 +60,7 @@ int bus_message_dump(sd_bus_message *m, FILE *f, unsigned flags) {
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() : "",
special_glyph(TRIANGULAR_BULLET),
special_glyph(SPECIAL_GLYPH_TRIANGULAR_BULLET),
ansi_normal(),
ansi_highlight(),

View File

@ -90,7 +90,7 @@ static int show_sysfs_one(
if (!k)
return -ENOMEM;
printf("%s%s%s\n", prefix, special_glyph(lookahead < n_dev ? TREE_BRANCH : TREE_RIGHT), k);
printf("%s%s%s\n", prefix, special_glyph(lookahead < n_dev ? SPECIAL_GLYPH_TREE_BRANCH : SPECIAL_GLYPH_TREE_RIGHT), k);
if (asprintf(&l,
"%s%s:%s%s%s%s",
@ -104,12 +104,12 @@ static int show_sysfs_one(
if (!k)
return -ENOMEM;
printf("%s%s%s\n", prefix, lookahead < n_dev ? special_glyph(TREE_VERTICAL) : " ", k);
printf("%s%s%s\n", prefix, lookahead < n_dev ? special_glyph(SPECIAL_GLYPH_TREE_VERTICAL) : " ", k);
if (++(*i_dev) < n_dev) {
_cleanup_free_ char *p = NULL;
p = strappend(prefix, lookahead < n_dev ? special_glyph(TREE_VERTICAL) : " ");
p = strappend(prefix, lookahead < n_dev ? special_glyph(SPECIAL_GLYPH_TREE_VERTICAL) : " ");
if (!p)
return -ENOMEM;
@ -160,7 +160,7 @@ int show_sysfs(const char *seat, const char *prefix, unsigned n_columns, OutputF
if (dev_list && n_dev > 0)
show_sysfs_one(seat, dev_list, &i, n_dev, "/", prefix, n_columns, flags);
else
printf("%s%s%s\n", prefix, special_glyph(TREE_RIGHT), "(none)");
printf("%s%s%s\n", prefix, special_glyph(SPECIAL_GLYPH_TREE_RIGHT), "(none)");
return 0;
}

View File

@ -237,7 +237,7 @@ static int call_get_addresses(sd_bus *bus, const char *name, int ifi, const char
if (truncate) {
if (!strextend(&addresses, special_glyph(ELLIPSIS), NULL))
if (!strextend(&addresses, special_glyph(SPECIAL_GLYPH_ELLIPSIS), NULL))
return -ENOMEM;
}

View File

@ -781,7 +781,7 @@ static int link_status_one(
(void) sd_network_link_get_carrier_bound_to(info->ifindex, &carrier_bound_to);
(void) sd_network_link_get_carrier_bound_by(info->ifindex, &carrier_bound_by);
printf("%s%s%s %i: %s\n", on_color_operational, special_glyph(BLACK_CIRCLE), off_color_operational, info->ifindex, info->name);
printf("%s%s%s %i: %s\n", on_color_operational, special_glyph(SPECIAL_GLYPH_BLACK_CIRCLE), off_color_operational, info->ifindex, info->name);
printf(" Link File: %s\n"
" Network File: %s\n"
@ -849,7 +849,7 @@ static int system_status(sd_netlink *rtnl, sd_hwdb *hwdb) {
operational_state_to_color(operational_state, &on_color_operational, &off_color_operational);
printf("%s%s%s State: %s%s%s\n",
on_color_operational, special_glyph(BLACK_CIRCLE), off_color_operational,
on_color_operational, special_glyph(SPECIAL_GLYPH_BLACK_CIRCLE), off_color_operational,
on_color_operational, strna(operational_state), off_color_operational);
(void) dump_addresses(rtnl, " Address: ", 0);

View File

@ -786,14 +786,14 @@ static int install_profile_dropin(
r = copy_file_atomic(from, dropin, 0644, 0, COPY_REFLINK);
if (r < 0)
return log_debug_errno(r, "Failed to copy %s %s %s: %m", from, special_glyph(ARROW), dropin);
return log_debug_errno(r, "Failed to copy %s %s %s: %m", from, special_glyph(SPECIAL_GLYPH_ARROW), 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(ARROW), dropin);
return log_debug_errno(errno, "Failed to link %s %s %s: %m", from, special_glyph(SPECIAL_GLYPH_ARROW), dropin);
(void) portable_changes_add(changes, n_changes, PORTABLE_SYMLINK, dropin, from);
}
@ -959,7 +959,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(ARROW), sl);
return log_debug_errno(errno, "Failed to link %s %s %s: %m", image_path, special_glyph(SPECIAL_GLYPH_ARROW), sl);
(void) portable_changes_add(changes, n_changes, PORTABLE_SYMLINK, sl, image_path);
return 0;

View File

@ -365,12 +365,12 @@ static int print_changes(sd_bus_message *m) {
break;
if (streq(type, "symlink"))
log_info("Created symlink %s %s %s.", path, special_glyph(ARROW), source);
log_info("Created symlink %s %s %s.", path, special_glyph(SPECIAL_GLYPH_ARROW), source);
else if (streq(type, "copy")) {
if (isempty(source))
log_info("Copied %s.", path);
else
log_info("Copied %s %s %s.", source, special_glyph(ARROW), path);
log_info("Copied %s %s %s.", source, special_glyph(SPECIAL_GLYPH_ARROW), path);
} else if (streq(type, "unlink"))
log_info("Removed %s.", path);
else if (streq(type, "write"))

View File

@ -2305,7 +2305,7 @@ static int dump_processes(
}
more = i+1 < n || cg->children;
special = special_glyph(more ? TREE_BRANCH : TREE_RIGHT);
special = special_glyph(more ? SPECIAL_GLYPH_TREE_BRANCH : SPECIAL_GLYPH_TREE_RIGHT);
fprintf(stdout, "%s%s%*"PID_PRI" %s\n",
prefix,
@ -2342,14 +2342,14 @@ static int dump_processes(
name++;
more = i+1 < n;
special = special_glyph(more ? TREE_BRANCH : TREE_RIGHT);
special = special_glyph(more ? SPECIAL_GLYPH_TREE_BRANCH : SPECIAL_GLYPH_TREE_RIGHT);
fputs(prefix, stdout);
fputs(special, stdout);
fputs(name, stdout);
fputc('\n', stdout);
special = special_glyph(more ? TREE_VERTICAL : TREE_SPACE);
special = special_glyph(more ? SPECIAL_GLYPH_TREE_VERTICAL : SPECIAL_GLYPH_TREE_SPACE);
pp = strappend(prefix, special);
if (!pp)
@ -2433,7 +2433,7 @@ static int dump_extra_processes(
fprintf(stdout, "%s%s %*" PID_PRI " %s\n",
prefix,
special_glyph(TRIANGULAR_BULLET),
special_glyph(SPECIAL_GLYPH_TRIANGULAR_BULLET),
width, pids[k],
name);
}

View File

@ -63,9 +63,9 @@ static void show_pid_array(
(void) get_process_cmdline(pids[i], n_columns, true, &t);
if (extra)
printf("%s%s ", prefix, special_glyph(TRIANGULAR_BULLET));
printf("%s%s ", prefix, special_glyph(SPECIAL_GLYPH_TRIANGULAR_BULLET));
else
printf("%s%s", prefix, special_glyph(((more || i < n_pids-1) ? TREE_BRANCH : TREE_RIGHT)));
printf("%s%s", prefix, special_glyph(((more || i < n_pids-1) ? SPECIAL_GLYPH_TREE_BRANCH : SPECIAL_GLYPH_TREE_RIGHT)));
printf("%*"PID_PRI" %s\n", pid_width, pids[i], strna(t));
}
@ -159,10 +159,10 @@ int show_cgroup_by_path(
}
if (last) {
printf("%s%s%s\n", prefix, special_glyph(TREE_BRANCH), cg_unescape(basename(last)));
printf("%s%s%s\n", prefix, special_glyph(SPECIAL_GLYPH_TREE_BRANCH), cg_unescape(basename(last)));
if (!p1) {
p1 = strappend(prefix, special_glyph(TREE_VERTICAL));
p1 = strappend(prefix, special_glyph(SPECIAL_GLYPH_TREE_VERTICAL));
if (!p1)
return -ENOMEM;
}
@ -181,7 +181,7 @@ int show_cgroup_by_path(
show_cgroup_one_by_path(path, prefix, n_columns, !!last, flags);
if (last) {
printf("%s%s%s\n", prefix, special_glyph(TREE_RIGHT), cg_unescape(basename(last)));
printf("%s%s%s\n", prefix, special_glyph(SPECIAL_GLYPH_TREE_RIGHT), cg_unescape(basename(last)));
if (!p2) {
p2 = strappend(prefix, " ");

View File

@ -346,7 +346,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(ARROW),
special_glyph(SPECIAL_GLYPH_ARROW),
changes[i].source);
break;
case UNIT_FILE_UNLINK:

View File

@ -523,7 +523,7 @@ static int output_units_list(const UnitInfo *unit_infos, unsigned c) {
}
if (circle_len > 0)
printf("%s%s%s ", on_circle, circle ? special_glyph(BLACK_CIRCLE) : " ", off_circle);
printf("%s%s%s ", on_circle, circle ? special_glyph(SPECIAL_GLYPH_BLACK_CIRCLE) : " ", off_circle);
printf("%s%s%-*s%s %s%-*s%s %s%-*s %-*s%s %-*s",
on_underline,
@ -1578,7 +1578,7 @@ static int list_dependencies_print(const char *name, int level, unsigned branche
printf("%s...\n",max_len % 2 ? "" : " ");
return 0;
}
printf("%s", special_glyph(branches & (1 << i) ? TREE_VERTICAL : TREE_SPACE));
printf("%s", special_glyph(branches & (1 << i) ? SPECIAL_GLYPH_TREE_VERTICAL : SPECIAL_GLYPH_TREE_SPACE));
}
len += 2;
@ -1587,7 +1587,7 @@ static int list_dependencies_print(const char *name, int level, unsigned branche
return 0;
}
printf("%s", special_glyph(last ? TREE_RIGHT : TREE_BRANCH));
printf("%s", special_glyph(last ? SPECIAL_GLYPH_TREE_RIGHT : SPECIAL_GLYPH_TREE_BRANCH));
}
if (arg_full) {
@ -1746,7 +1746,7 @@ static int list_dependencies_one(
break;
}
printf("%s%s%s ", on, special_glyph(BLACK_CIRCLE), ansi_normal());
printf("%s%s%s ", on, special_glyph(SPECIAL_GLYPH_BLACK_CIRCLE), ansi_normal());
}
r = list_dependencies_print(*c, level, branches, c[1] == NULL);
@ -1992,7 +1992,7 @@ static void output_machines_list(struct machine_info *machine_infos, unsigned n)
on_failed = off_failed = "";
if (circle_len > 0)
printf("%s%s%s ", on_state, circle ? special_glyph(BLACK_CIRCLE) : " ", off_state);
printf("%s%s%s ", on_state, circle ? special_glyph(SPECIAL_GLYPH_BLACK_CIRCLE) : " ", off_state);
if (m->is_host)
printf("%-*s (host) %s%-*s%s %s%*" PRIu32 "%s %*" PRIu32 "\n",
@ -4057,7 +4057,7 @@ static void print_status_info(
} else
active_on = active_off = "";
printf("%s%s%s %s", active_on, special_glyph(BLACK_CIRCLE), active_off, strna(i->id));
printf("%s%s%s %s", active_on, special_glyph(SPECIAL_GLYPH_BLACK_CIRCLE), active_off, strna(i->id));
if (i->description && !streq_ptr(i->id, i->description))
printf(" - %s", i->description);
@ -4120,7 +4120,7 @@ static void print_status_info(
printf("%s\n"
" %s", dir,
special_glyph(TREE_RIGHT));
special_glyph(SPECIAL_GLYPH_TREE_RIGHT));
}
last = ! (*(dropin + 1) && startswith(*(dropin + 1), dir));
@ -4199,7 +4199,7 @@ static void print_status_info(
LIST_FOREACH(conditions, c, i->conditions)
if (c->tristate < 0)
printf(" %s %s=%s%s%s was not met\n",
--n ? special_glyph(TREE_BRANCH) : special_glyph(TREE_RIGHT),
--n ? special_glyph(SPECIAL_GLYPH_TREE_BRANCH) : special_glyph(SPECIAL_GLYPH_TREE_RIGHT),
c->name,
c->trigger ? "|" : "",
c->negate ? "!" : "",
@ -5284,7 +5284,7 @@ static int show_system_status(sd_bus *bus) {
off = ansi_normal();
}
printf("%s%s%s %s\n", on, special_glyph(BLACK_CIRCLE), off, arg_host ? arg_host : hn);
printf("%s%s%s %s\n", on, special_glyph(SPECIAL_GLYPH_BLACK_CIRCLE), off, arg_host ? arg_host : hn);
printf(" State: %s%s%s\n",
on, strna(mi.state), off);
@ -6389,7 +6389,7 @@ static int enable_unit(int argc, char *argv[], void *userdata) {
" D-Bus, udev, scripted systemctl call, ...).\n"
"%1$s In case of template units, the unit is meant to be enabled with some\n"
" instance name specified.",
special_glyph(BULLET));
special_glyph(SPECIAL_GLYPH_BULLET));
if (arg_now && STR_IN_SET(argv[0], "enable", "disable", "mask")) {
sd_bus *bus;

View File

@ -65,32 +65,32 @@ static void test_keymaps(void) {
#define dump_glyph(x) log_info(STRINGIFY(x) ": %s", special_glyph(x))
static void dump_special_glyphs(void) {
assert_cc(DEPRESSED_SMILEY + 1 == _SPECIAL_GLYPH_MAX);
assert_cc(SPECIAL_GLYPH_DEPRESSED_SMILEY + 1 == _SPECIAL_GLYPH_MAX);
log_info("/* %s */", __func__);
log_info("is_locale_utf8: %s", yes_no(is_locale_utf8()));
dump_glyph(TREE_VERTICAL);
dump_glyph(TREE_BRANCH);
dump_glyph(TREE_RIGHT);
dump_glyph(TREE_SPACE);
dump_glyph(TRIANGULAR_BULLET);
dump_glyph(BLACK_CIRCLE);
dump_glyph(BULLET);
dump_glyph(ARROW);
dump_glyph(MDASH);
dump_glyph(ELLIPSIS);
dump_glyph(MU);
dump_glyph(CHECK_MARK);
dump_glyph(CROSS_MARK);
dump_glyph(ECSTATIC_SMILEY);
dump_glyph(HAPPY_SMILEY);
dump_glyph(SLIGHTLY_HAPPY_SMILEY);
dump_glyph(NEUTRAL_SMILEY);
dump_glyph(SLIGHTLY_UNHAPPY_SMILEY);
dump_glyph(UNHAPPY_SMILEY);
dump_glyph(DEPRESSED_SMILEY);
dump_glyph(SPECIAL_GLYPH_TREE_VERTICAL);
dump_glyph(SPECIAL_GLYPH_TREE_BRANCH);
dump_glyph(SPECIAL_GLYPH_TREE_RIGHT);
dump_glyph(SPECIAL_GLYPH_TREE_SPACE);
dump_glyph(SPECIAL_GLYPH_TRIANGULAR_BULLET);
dump_glyph(SPECIAL_GLYPH_BLACK_CIRCLE);
dump_glyph(SPECIAL_GLYPH_BULLET);
dump_glyph(SPECIAL_GLYPH_ARROW);
dump_glyph(SPECIAL_GLYPH_MDASH);
dump_glyph(SPECIAL_GLYPH_ELLIPSIS);
dump_glyph(SPECIAL_GLYPH_MU);
dump_glyph(SPECIAL_GLYPH_CHECK_MARK);
dump_glyph(SPECIAL_GLYPH_CROSS_MARK);
dump_glyph(SPECIAL_GLYPH_ECSTATIC_SMILEY);
dump_glyph(SPECIAL_GLYPH_HAPPY_SMILEY);
dump_glyph(SPECIAL_GLYPH_SLIGHTLY_HAPPY_SMILEY);
dump_glyph(SPECIAL_GLYPH_NEUTRAL_SMILEY);
dump_glyph(SPECIAL_GLYPH_SLIGHTLY_UNHAPPY_SMILEY);
dump_glyph(SPECIAL_GLYPH_UNHAPPY_SMILEY);
dump_glyph(SPECIAL_GLYPH_DEPRESSED_SMILEY);
}
int main(int argc, char *argv[]) {