summaryrefslogtreecommitdiff
path: root/src/login
diff options
context:
space:
mode:
authorMichal Schmidt <mschmidt@redhat.com>2012-11-02 17:35:30 +0100
committerMichal Schmidt <mschmidt@redhat.com>2012-11-02 17:39:52 +0100
commitc339d9775d1df19fdbbafc57486f7cd51af6b7fb (patch)
treee0689a930c57e861641308340165d9f7431ab24e /src/login
parent0901758558506273c0b7553dc3cae587f2b94290 (diff)
util : fallback to plain ASCII drawing if locale is not UTF-8
When printing cgroup and sysfs hierarchies, avoid using UTF-8 box drawing characters if the locale is not UTF-8. https://bugzilla.redhat.com/show_bug.cgi?id=871153
Diffstat (limited to 'src/login')
-rw-r--r--src/login/sysfs-show.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/login/sysfs-show.c b/src/login/sysfs-show.c
index bc1bbccff7..172c75d82b 100644
--- a/src/login/sysfs-show.c
+++ b/src/login/sysfs-show.c
@@ -105,7 +105,8 @@ static int show_sysfs_one(
}
k = ellipsize(sysfs, n_columns, 20);
- printf("%s%s %s\n", prefix, lookahead ? "\342\224\234" : "\342\224\224", k ? k : sysfs);
+ printf("%s%s %s\n", prefix, draw_special_char(lookahead ? DRAW_BOX_VERT_AND_RIGHT : DRAW_BOX_UP_AND_RIGHT),
+ k ? k : sysfs);
free(k);
if (asprintf(&l,
@@ -117,7 +118,8 @@ static int show_sysfs_one(
}
k = ellipsize(l, n_columns, 70);
- printf("%s%s %s\n", prefix, lookahead ? "\342\224\202" : " ", k ? k : l);
+ printf("%s%s %s\n", prefix, lookahead ? draw_special_char(DRAW_BOX_VERT) : " ",
+ k ? k : l);
free(k);
free(l);
@@ -125,7 +127,7 @@ static int show_sysfs_one(
if (*item) {
char *p;
- p = strappend(prefix, lookahead ? "\342\224\202 " : " ");
+ p = strjoin(prefix, lookahead ? draw_special_char(DRAW_BOX_VERT) : " ", " ", NULL);
show_sysfs_one(udev, seat, item, sysfs, p ? p : prefix, n_columns - 2);
free(p);
}