JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
FAQ: update typo and escape code for smkx
[st.git] / st.c
diff --git a/st.c b/st.c
index 13226d8..3681776 100644 (file)
--- a/st.c
+++ b/st.c
@@ -180,7 +180,6 @@ typedef unsigned short ushort;
 
 typedef XftDraw *Draw;
 typedef XftColor Color;
-typedef Colormap Colormap;
 
 typedef struct {
        char c[UTF_SIZ]; /* character code */
@@ -2316,19 +2315,15 @@ techo(char *buf, int len) {
 
 void
 tdeftran(char ascii) {
-       char c, (*bp)[2];
-       static char tbl[][2] = {
-               {'0', CS_GRAPHIC0}, {'B', CS_USA},
-               {0, 0}
-       };
-
-       for (bp = &tbl[0]; (c = (*bp)[0]) && c != ascii; ++bp)
-               /* nothing */;
+       static char cs[] = "0B";
+       static int vcs[] = {CS_GRAPHIC0, CS_USA};
+       char *p;
 
-       if (c == 0)
+       if((p = strchr(cs, ascii)) == NULL) {
                fprintf(stderr, "esc unhandled charset: ESC ( %c\n", ascii);
-       else
-               term.trantbl[term.icharset] = (*bp)[1];
+       } else {
+               term.trantbl[term.icharset] = vcs[p - cs];
+       }
 }
 
 void