sfeed

simple feed reader - forked from git.codemadness.org/sfeed
git clone git://src.gearsix.net/sfeed
Log | Files | Refs | Atom | README | LICENSE

commit f9d8ddb73c6297de4702cde6382db6378786d420
parent ba23401be93d75733d3824d145dd6ca54fa76fa8
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Fri,  2 Oct 2015 17:31:04 +0200

sfeed: fix escape of backslash, simplify

Diffstat:
Msfeed.c | 22+++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)

diff --git 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; } } }