iMake strdump(), csidump(), print to stderr - st - Simple Terminal Err gopher.r-36.net 70 i Err gopher.r-36.net 70 1Log /scm/st//log.gph gopher.r-36.net 70 1Files /scm/st//files.gph gopher.r-36.net 70 1Refs /scm/st//refs.gph gopher.r-36.net 70 1README /scm/st//file/README.gph gopher.r-36.net 70 1LICENSE /scm/st//file/LICENSE.gph gopher.r-36.net 70 i--- Err gopher.r-36.net 70 1commit 902a392b905107c7b8a318c103837c54e47a068e /scm/st//commit/902a392b905107c7b8a318c103837c54e47a068e.gph gopher.r-36.net 70 1parent 8c99915608beee03eca3bae6ed92264a0da87e2f /scm/st//commit/8c99915608beee03eca3bae6ed92264a0da87e2f.gph gopher.r-36.net 70 hAuthor: pl@ninthfloor.org URL:mailto:pl@ninthfloor.org gopher.r-36.net 70 iDate: Fri, 11 Nov 2016 17:45:52 +0100 Err gopher.r-36.net 70 i Err gopher.r-36.net 70 iMake strdump(), csidump(), print to stderr Err gopher.r-36.net 70 i Err gopher.r-36.net 70 iThe two functions strdump(), csidump() are called to show errors and Err gopher.r-36.net 70 itheir output is introduced by a message printed to stderr. Thus, it it Err gopher.r-36.net 70 imore consistent to have them print to stderr. Err gopher.r-36.net 70 i Err gopher.r-36.net 70 iMoreover stderr is unbuffered (at least on Linux), making problems Err gopher.r-36.net 70 iimmediately visible. Err gopher.r-36.net 70 i Err gopher.r-36.net 70 iDiffstat: Err gopher.r-36.net 70 i st.c | 29 +++++++++++++++-------------- Err gopher.r-36.net 70 i Err gopher.r-36.net 70 i1 file changed, 15 insertions(+), 14 deletions(-) Err gopher.r-36.net 70 i--- Err gopher.r-36.net 70 1diff --git a/st.c b/st.c /scm/st//file/st.c.gph gopher.r-36.net 70 i@@ -2490,22 +2490,22 @@ csidump(void) Err gopher.r-36.net 70 i int i; Err gopher.r-36.net 70 i uint c; Err gopher.r-36.net 70 i Err gopher.r-36.net 70 i- printf("ESC["); Err gopher.r-36.net 70 i+ fprintf(stderr, "ESC["); Err gopher.r-36.net 70 i for (i = 0; i < csiescseq.len; i++) { Err gopher.r-36.net 70 i c = csiescseq.buf[i] & 0xff; Err gopher.r-36.net 70 i if (isprint(c)) { Err gopher.r-36.net 70 i- putchar(c); Err gopher.r-36.net 70 i+ putc(c, stderr); Err gopher.r-36.net 70 i } else if (c == '\n') { Err gopher.r-36.net 70 i- printf("(\\n)"); Err gopher.r-36.net 70 i+ fprintf(stderr, "(\\n)"); Err gopher.r-36.net 70 i } else if (c == '\r') { Err gopher.r-36.net 70 i- printf("(\\r)"); Err gopher.r-36.net 70 i+ fprintf(stderr, "(\\r)"); Err gopher.r-36.net 70 i } else if (c == 0x1b) { Err gopher.r-36.net 70 i- printf("(\\e)"); Err gopher.r-36.net 70 i+ fprintf(stderr, "(\\e)"); Err gopher.r-36.net 70 i } else { Err gopher.r-36.net 70 i- printf("(%02x)", c); Err gopher.r-36.net 70 i+ fprintf(stderr, "(%02x)", c); Err gopher.r-36.net 70 i } Err gopher.r-36.net 70 i } Err gopher.r-36.net 70 i- putchar('\n'); Err gopher.r-36.net 70 i+ putc('\n', stderr); Err gopher.r-36.net 70 i } Err gopher.r-36.net 70 i Err gopher.r-36.net 70 i void Err gopher.r-36.net 70 i@@ -2594,24 +2594,25 @@ strdump(void) Err gopher.r-36.net 70 i int i; Err gopher.r-36.net 70 i uint c; Err gopher.r-36.net 70 i Err gopher.r-36.net 70 i- printf("ESC%c", strescseq.type); Err gopher.r-36.net 70 i+ fprintf(stderr, "ESC%c", strescseq.type); Err gopher.r-36.net 70 i for (i = 0; i < strescseq.len; i++) { Err gopher.r-36.net 70 i c = strescseq.buf[i] & 0xff; Err gopher.r-36.net 70 i if (c == '\0') { Err gopher.r-36.net 70 i+ putc('\n', stderr); Err gopher.r-36.net 70 i return; Err gopher.r-36.net 70 i } else if (isprint(c)) { Err gopher.r-36.net 70 i- putchar(c); Err gopher.r-36.net 70 i+ putc(c, stderr); Err gopher.r-36.net 70 i } else if (c == '\n') { Err gopher.r-36.net 70 i- printf("(\\n)"); Err gopher.r-36.net 70 i+ fprintf(stderr, "(\\n)"); Err gopher.r-36.net 70 i } else if (c == '\r') { Err gopher.r-36.net 70 i- printf("(\\r)"); Err gopher.r-36.net 70 i+ fprintf(stderr, "(\\r)"); Err gopher.r-36.net 70 i } else if (c == 0x1b) { Err gopher.r-36.net 70 i- printf("(\\e)"); Err gopher.r-36.net 70 i+ fprintf(stderr, "(\\e)"); Err gopher.r-36.net 70 i } else { Err gopher.r-36.net 70 i- printf("(%02x)", c); Err gopher.r-36.net 70 i+ fprintf(stderr, "(%02x)", c); Err gopher.r-36.net 70 i } Err gopher.r-36.net 70 i } Err gopher.r-36.net 70 i- printf("ESC\\\n"); Err gopher.r-36.net 70 i+ fprintf(stderr, "ESC\\\n"); Err gopher.r-36.net 70 i } Err gopher.r-36.net 70 i Err gopher.r-36.net 70 i void Err gopher.r-36.net 70 .