From 67ac7fd74816fa1d7314c2678b8788cef0f0c867 Mon Sep 17 00:00:00 2001 From: Ed Schouten Date: Sun, 4 Jan 2009 00:20:18 +0000 Subject: [PATCH] Print control characters, even though they are normally not visible. With cons25, there are printable characters below 0x1B. This is not the case with ASCII, UTF-8, etc. but in this case we just have to. Also don't set LC_CTYPE to UTF-8 when libteken is compiled without UTF-8 in the demo-application. --- sys/dev/syscons/teken/teken.c | 6 +++++- sys/dev/syscons/teken/teken_demo.c | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/sys/dev/syscons/teken/teken.c b/sys/dev/syscons/teken/teken.c index acf35f7635e7..b3c8bd42592d 100644 --- a/sys/dev/syscons/teken/teken.c +++ b/sys/dev/syscons/teken/teken.c @@ -53,10 +53,14 @@ static FILE *df; #include "teken_wcwidth.h" #else /* !TEKEN_UTF8 */ static inline int -teken_wcwidth(teken_char_t c) +teken_wcwidth(teken_char_t c __unused) { +#ifdef TEKEN_CONS25 + return (1); +#else /* !TEKEN_CONS25 */ return (c <= 0x1B) ? -1 : 1; +#endif /* TEKEN_CONS25 */ } #endif /* TEKEN_UTF8 */ diff --git a/sys/dev/syscons/teken/teken_demo.c b/sys/dev/syscons/teken/teken_demo.c index 74b4321ae7e8..acea4f7f099e 100644 --- a/sys/dev/syscons/teken/teken_demo.c +++ b/sys/dev/syscons/teken/teken_demo.c @@ -280,7 +280,9 @@ main(int argc __unused, char *argv[] __unused) exit(1); case 0: setenv("TERM", "cons25", 1); +#ifdef TEKEN_UTF8 setenv("LC_CTYPE", "UTF-8", 0); +#endif /* TEKEN_UTF8 */ execlp("zsh", "-zsh", NULL); execlp("bash", "-bash", NULL); execlp("sh", "-sh", NULL);