summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHiltjo Posthuma <hiltjo@codemadness.org>2014-04-08 15:27:35 +0200
committerHiltjo Posthuma <hiltjo@codemadness.org>2014-04-08 15:27:35 +0200
commitb01d69a4f88e6c2f76cd990a3061a36b55c0d46b (patch)
treec56f3e7b685b3253c02ba8429f6f556f21d3e434
parent4959de9c170b3d2d8dee622d50d0fae70ec5b463 (diff)
sfeed: ignore \r
Signed-off-by: Hiltjo Posthuma <hiltjo@codemadness.org>
-rw-r--r--sfeed.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/sfeed.c b/sfeed.c
index bc4f171..6db5cff 100644
--- a/sfeed.c
+++ b/sfeed.c
@@ -365,12 +365,15 @@ string_print(String *s) {
/* skip leading whitespace */
for(p = s->data; *p && isspace((int)*p); p++);
for(; *p; p++) {
- switch(*p) {
- case '\n': fputs("\\n", stdout); break;
- case '\\': fputs("\\\\", stdout); break;
- case '\t': fputs("\\t", stdout); break;
- default: putchar(*p); break;
- }
+ if(ISWSNOSPACE(*p)) {
+ 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
+ putchar(*p);
}
#if 0
for(i = 0; *p; p++) {