From 1f43692f55a59ca64a40d1fdb79589d7bb091952 Mon Sep 17 00:00:00 2001 From: dan Date: Sat, 1 Jul 2000 17:49:34 +0000 Subject: Style fixes. --- lib/libc/gen/vis.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'lib/libc') diff --git a/lib/libc/gen/vis.c b/lib/libc/gen/vis.c index cc3501d..7f10aa5 100644 --- a/lib/libc/gen/vis.c +++ b/lib/libc/gen/vis.c @@ -56,17 +56,18 @@ vis(dst, c, flag, nextc) c = (unsigned char)c; if (flag & VIS_HTTPSTYLE) { - if (!((c >= '0' && c <= '9') || (c >= 'A' && c <= 'Z') - || (c >= 'a' && c <= 'z') || c == '$' || c == '-' - || c == '_' || c == '\'' || c == '+' || c == '!' || - c == '(' || c == ')' || c == ',' || c == '"' || - c == ';' || c == '/' || c == '?' || c == ':' || - c == '@' || c == '&' || c == '=' || c == '+')) { - *dst++ = '%'; - snprintf(dst, 4, (c < 16 ? "0%X" : "%X"), c); - dst += 2; - goto done; - } + /* Described in RFC 1808 */ + if (!(isalnum(c) /* alpha-numeric */ + /* safe */ + || c == '$' || c == '-' || c == '_' || c == '.' || c == '+' + /* extra */ + || c == '!' || c == '*' || c == '\'' || c == '(' + || c == ')' || c == ',')) { + *dst++ = '%'; + snprintf(dst, 4, (c < 16 ? "0%X" : "%X"), c); + dst += 2; + goto done; + } } if (isgraph(c) || -- cgit v1.1