diff options
author | Hiltjo Posthuma <hiltjo@codemadness.org> | 2015-06-21 00:20:28 +0200 |
---|---|---|
committer | Hiltjo Posthuma <hiltjo@codemadness.org> | 2015-06-21 00:20:28 +0200 |
commit | 3a72c90c2f7348f3e989a8cbe557a99c6de0e026 (patch) | |
tree | 2d5ffc0b5c96955bdedc4a0406838063f17e95b5 | |
parent | 51bc3d210ac7af51373b59dad44faf8ceefb6a8f (diff) |
string_print: dont print control chars
-rw-r--r-- | sfeed.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -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); } } |