From f9d8ddb73c6297de4702cde6382db6378786d420 Mon Sep 17 00:00:00 2001 From: Hiltjo Posthuma Date: Fri, 2 Oct 2015 17:31:04 +0200 Subject: sfeed: fix escape of backslash, simplify --- sfeed.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/sfeed.c b/sfeed.c index 993f2b2..76f4147 100644 --- a/sfeed.c +++ b/sfeed.c @@ -378,22 +378,22 @@ string_print_encoded(String *s) return; /* skip leading whitespace */ - for (p = s->data; *p && isspace((int)*p); p++) + for (p = s->data; *p && ISSPACE((int)*p); p++) ; /* seek offset of trailing whitespace */ - for (e = p + strlen(p); e > p && isspace((int)*(e - 1)); e--) + for (e = p + strlen(p); e > p && ISSPACE((int)*(e - 1)); e--) ; for (; *p && p != e; p++) { - if (isspace((int)*p) && *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 if (!iscntrl((int)*p)) { /* ignore control chars */ - putchar(*p); + switch (*p) { + case '\n': fputs("\\n", stdout); break; + case '\\': fputs("\\\\", stdout); break; + case '\t': fputs("\\t", stdout); break; + default: + /* ignore control chars */ + if (!ISCONTROL((int)*p)) + putchar(*p); + break; } } } -- cgit v1.2.3