(wrong string) élien Aptel

From: <hg_AT_suckless.org>
Date: Thu, 16 Feb 2012 01:07:13 +0100 (CET)

changeset: 237:f79eab7767e3
user: Aurélien Aptel <aurelien.aptel_AT_gmail.com>
date: Thu Feb 16 00:58:16 2012 +0100
files: st.c
description:
rewrite csidump().


diff -r becdbecc394c -r f79eab7767e3 st.c
--- a/st.c Thu Feb 16 00:33:11 2012 +0100
+++ b/st.c Thu Feb 16 00:58:16 2012 +0100
_AT_@ -1387,8 +1387,17 @@
 
 void
 csidump(void) {
- fwrite("\033[", 1, 2, stdout);
- fwrite(escseq.buf, 1, escseq.len, stdout);
+ int i;
+ fwrite("ESC[", 1, 4, stdout);
+ for(i = 0; i < escseq.len; i++) {
+ uint c = escseq.buf[i] & 0xff;
+ if(isprint(c)) putchar(c);
+ else if(c == '\n') printf("(\\n)");
+ else if(c == '\r') printf("(\\r)");
+ else if(c == 0x1b) printf("(\\e)");
+ else printf("(%02x)", c);
+ }
+ putchar('\n');
 }
 
 void
Received on Thu Feb 16 2012 - 01:07:13 CET

This archive was generated by hypermail 2.3.0 : Thu Feb 16 2012 - 01:12:09 CET