static const char* const draw_table[2][_GLYPH_MAX] = {
/* ASCII fallback */
[false] = {
+ [GLYPH_SPACE] = " ",
[GLYPH_TREE_VERTICAL] = "| ",
[GLYPH_TREE_BRANCH] = "|-",
[GLYPH_TREE_RIGHT] = "`-",
/* UTF-8 */
[true] = {
+ /* This exists to allow more consistent handling of optional whitespace */
+ [GLYPH_SPACE] = " ",
+
/* The following are multiple glyphs in both ASCII and in UNICODE */
[GLYPH_TREE_VERTICAL] = u8"│ ",
[GLYPH_TREE_BRANCH] = u8"├─",
#include "macro.h"
typedef enum Glyph {
+ GLYPH_SPACE,
GLYPH_TREE_VERTICAL,
GLYPH_TREE_BRANCH,
GLYPH_TREE_RIGHT,
return glyph_full(code, false);
}
+static inline const char* optional_glyph(Glyph code) {
+ return emoji_enabled() ? glyph(code) : "";
+}
+
static inline const char* glyph_check_mark(bool b) {
return b ? glyph(GLYPH_CHECK_MARK) : glyph(GLYPH_CROSS_MARK);
}
"%s%s/proc/ is not mounted. This is not a supported mode of operation. Please fix\n"
"your invocation environment to mount /proc/ and /sys/ properly. Proceeding anyway.\n"
"Your mileage may vary.",
- emoji_enabled() ? glyph(GLYPH_WARNING_SIGN) : "",
- emoji_enabled() ? " " : "");
+ optional_glyph(GLYPH_WARNING_SIGN),
+ optional_glyph(GLYPH_SPACE));
if (arg_action != ACTION_SYSTEMCTL && running_in_chroot() > 0) {
if (!arg_quiet)