JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
Fix for multibyte characters in techo.
authornoname <noname@inventati.org>
Fri, 25 Apr 2014 14:28:00 +0000 (18:28 +0400)
committerRoberto E. Vargas Caballero <k0ga@shike2.com>
Fri, 25 Apr 2014 22:03:09 +0000 (00:03 +0200)
Works for both signed and unsigned char.

st.c

diff --git a/st.c b/st.c
index 297eb3f..cacbe20 100644 (file)
--- a/st.c
+++ b/st.c
@@ -2298,7 +2298,7 @@ techo(char *buf, int len) {
        for(; len > 0; buf++, len--) {
                char c = *buf;
 
-               if(c < 0x20 || c == 0177) { /* control code */
+               if(BETWEEN(c, 0x00, 0x1f) || c == 0x7f) { /* control code */
                        if(c != '\n' && c != '\r' && c != '\t') {
                                c ^= '\x40';
                                tputc("^", 1);