summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHiltjo Posthuma <hiltjo@codemadness.org>2015-06-21 00:20:28 +0200
committerHiltjo Posthuma <hiltjo@codemadness.org>2015-06-21 00:20:28 +0200
commit3a72c90c2f7348f3e989a8cbe557a99c6de0e026 (patch)
tree2d5ffc0b5c96955bdedc4a0406838063f17e95b5
parent51bc3d210ac7af51373b59dad44faf8ceefb6a8f (diff)
string_print: dont print control chars
-rw-r--r--sfeed.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sfeed.c b/sfeed.c
index 07e49c9..dcc4ce5 100644
--- 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);
}
}