commit 3a72c90c2f7348f3e989a8cbe557a99c6de0e026
parent 51bc3d210ac7af51373b59dad44faf8ceefb6a8f
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Sun, 21 Jun 2015 00:20:28 +0200
string_print: dont print control chars
Diffstat:
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/sfeed.c b/sfeed.c
@@ -328,14 +328,15 @@ string_print(String *s)
e = trimend(p);
for(; *p && p != e; p++) {
- if(ISWSNOSPACE(*p)) {
+ /* isspace(c) && c != ' '. */
+ if(((unsigned)*p - '\t') < 5) {
switch(*p) {
case '\n': fputs("\\n", stdout); break;
case '\\': fputs("\\\\", stdout); break;
case '\t': fputs("\\t", stdout); break;
default: break; /* ignore other whitespace chars */
}
- } else {
+ } else if(!iscntrl((int)*p)) { /* ignore control chars */
putchar(*p);
}
}