diff options
author | Aurélien Aptel <aurelien.aptel@gmail.com> | 2012-02-16 00:58:16 +0100 |
---|---|---|
committer | Aurélien Aptel <aurelien.aptel@gmail.com> | 2012-02-16 00:58:16 +0100 |
commit | 6cd5c3dab7e47553bc14a8a7cf76708f708b508e (patch) | |
tree | c9347b466db504908a1a5e89a50d6071abf94d54 | |
parent | 8ebab415921d534461b0fb8bce8fa1442afaba42 (diff) | |
download | st-patched-6cd5c3dab7e47553bc14a8a7cf76708f708b508e.tar.bz2 st-patched-6cd5c3dab7e47553bc14a8a7cf76708f708b508e.tar.xz st-patched-6cd5c3dab7e47553bc14a8a7cf76708f708b508e.zip |
rewrite csidump().
-rw-r--r-- | st.c | 13 |
1 files changed, 11 insertions, 2 deletions
@@ -1387,8 +1387,17 @@ csihandle(void) { | |||
1387 | 1387 | ||
1388 | void | 1388 | void |
1389 | csidump(void) { | 1389 | csidump(void) { |
1390 | fwrite("\033[", 1, 2, stdout); | 1390 | int i; |
1391 | fwrite(escseq.buf, 1, escseq.len, stdout); | 1391 | fwrite("ESC[", 1, 4, stdout); |
1392 | for(i = 0; i < escseq.len; i++) { | ||
1393 | uint c = escseq.buf[i] & 0xff; | ||
1394 | if(isprint(c)) putchar(c); | ||
1395 | else if(c == '\n') printf("(\\n)"); | ||
1396 | else if(c == '\r') printf("(\\r)"); | ||
1397 | else if(c == 0x1b) printf("(\\e)"); | ||
1398 | else printf("(%02x)", c); | ||
1399 | } | ||
1400 | putchar('\n'); | ||
1392 | } | 1401 | } |
1393 | 1402 | ||
1394 | void | 1403 | void |