summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sfeed.c4
-rw-r--r--sfeed_opml_import.c2
-rw-r--r--sfeed_web.c2
-rw-r--r--util.h3
4 files changed, 7 insertions, 4 deletions
diff --git a/sfeed.c b/sfeed.c
index 9b3fd8f..fc1249a 100644
--- a/sfeed.c
+++ b/sfeed.c
@@ -326,7 +326,7 @@ string_print_encoded(String *s)
case '\t': putchar('\\'); putchar('t'); break;
default:
/* ignore control chars */
- if (!iscntrl((unsigned char)*p))
+ if (!ISCNTRL((unsigned char)*p))
putchar(*p);
break;
}
@@ -343,7 +343,7 @@ printtrimmed(const char *s)
for (; *p && p != e; p++) {
if (isspace((unsigned char)*p))
putchar(' '); /* any whitespace to space */
- else if (!iscntrl((unsigned char)*p))
+ else if (!ISCNTRL((unsigned char)*p))
/* ignore other control chars */
putchar(*p);
}
diff --git a/sfeed_opml_import.c b/sfeed_opml_import.c
index 6c0bd0e..9a13e36 100644
--- a/sfeed_opml_import.c
+++ b/sfeed_opml_import.c
@@ -12,7 +12,7 @@ static void
printsafe(const char *s)
{
for (; *s; s++) {
- if (iscntrl((unsigned char)*s))
+ if (ISCNTRL((unsigned char)*s))
continue;
else if (*s == '\\')
fputs("\\\\", stdout);
diff --git a/sfeed_web.c b/sfeed_web.c
index 704afe8..dfff0a3 100644
--- a/sfeed_web.c
+++ b/sfeed_web.c
@@ -16,7 +16,7 @@ static void
printvalue(const char *s)
{
for (; *s; s++)
- if (!iscntrl((unsigned char)*s))
+ if (!ISCNTRL((unsigned char)*s))
putchar(*s);
}
diff --git a/util.h b/util.h
index 7923cdc..c68cef4 100644
--- a/util.h
+++ b/util.h
@@ -8,6 +8,9 @@
#define unveil(p1,p2) 0
#endif
+/* control-character in the ASCII range 0-127: compatible with UTF-8 */
+#define ISCNTRL(c) ((c) < ' ' || (c) == 0x7f)
+
#undef strcasestr
char *strcasestr(const char *, const char *);
#undef strlcat