X-Git-Url: https://git.danieliu.xyz/?a=blobdiff_plain;f=st.c;h=3681776d6184f85a0f66f8db0db23fc1f0ba9a5f;hb=587b4435924bab598a904531dc8d01656d1e519a;hp=13226d8709372553395513d876a42a86fed8af05;hpb=5159d55c631cd1179bd2f872859d4540668745b9;p=st.git diff --git a/st.c b/st.c index 13226d8..3681776 100644 --- 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