diff options
author | Roberto E. Vargas Caballero <k0ga@shike2.com> | 2014-06-07 13:23:45 +0200 |
---|---|---|
committer | Roberto E. Vargas Caballero <k0ga@shike2.com> | 2014-06-07 13:23:45 +0200 |
commit | 93661042a2a0cf6f3655360f5c52215c684a4211 (patch) | |
tree | 435efebd540d53f9dfaf7acae968d2ab4766d1f6 | |
parent | 18a05fdf4326ac1c7165de8cad0895b5c44fac83 (diff) | |
download | st-93661042a2a0cf6f3655360f5c52215c684a4211.tar.gz st-93661042a2a0cf6f3655360f5c52215c684a4211.zip |
Simplify tdeftrans
-rw-r--r-- | st.c | 15 |
1 files changed, 5 insertions, 10 deletions
@@ -2315,19 +2315,14 @@ techo(char *buf, int len) { | |||
2315 | 2315 | ||
2316 | void | 2316 | void |
2317 | tdeftran(char ascii) { | 2317 | tdeftran(char ascii) { |
2318 | char c, (*bp)[2]; | 2318 | static char cs[] = "0B"; |
2319 | static char tbl[][2] = { | 2319 | static int vcs[] = {CS_GRAPHIC0, CS_USA}; |
2320 | {'0', CS_GRAPHIC0}, {'B', CS_USA}, | 2320 | char *p; |
2321 | {0, 0} | ||
2322 | }; | ||
2323 | |||
2324 | for (bp = &tbl[0]; (c = (*bp)[0]) && c != ascii; ++bp) | ||
2325 | /* nothing */; | ||
2326 | 2321 | ||
2327 | if (c == 0) | 2322 | if((p = strchr(cs, ascii)) == NULL) |
2328 | fprintf(stderr, "esc unhandled charset: ESC ( %c\n", ascii); | 2323 | fprintf(stderr, "esc unhandled charset: ESC ( %c\n", ascii); |
2329 | else | 2324 | else |
2330 | term.trantbl[term.icharset] = (*bp)[1]; | 2325 | term.trantbl[term.icharset] = vcs[p - cs]; |
2331 | } | 2326 | } |
2332 | 2327 | ||
2333 | void | 2328 | void |