summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto E. Vargas Caballero2014-06-07 13:23:45 +0200
committerRoberto E. Vargas Caballero2014-06-07 13:23:45 +0200
commit93661042a2a0cf6f3655360f5c52215c684a4211 (patch)
tree435efebd540d53f9dfaf7acae968d2ab4766d1f6
parent18a05fdf4326ac1c7165de8cad0895b5c44fac83 (diff)
downloadst-93661042a2a0cf6f3655360f5c52215c684a4211.tar.gz
st-93661042a2a0cf6f3655360f5c52215c684a4211.tar.xz
st-93661042a2a0cf6f3655360f5c52215c684a4211.zip
Simplify tdeftrans
-rw-r--r--st.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/st.c b/st.c
index fde4d2d..b148401 100644
--- a/st.c
+++ b/st.c
@@ -2315,19 +2315,14 @@ 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];
+ term.trantbl[term.icharset] = vcs[p - cs];
}
void