/* * This is do_hvis, for HTTP style (RFC 1808) */ static wchar_t * do_hvis(wchar_t *dst, wint_t c, int flags, wint_t nextc, const wchar_t *extra) { if (iswalnum(c) /* safe */ || c == L'$' || c == L'-' || c == L'_' || c == L'.' || c == L'+' /* extra */ || c == L'!' || c == L'*' || c == L'\'' || c == L'(' || c == L')' || c == L',') dst = do_svis(dst, c, flags, nextc, extra); else { *dst++ = L'%'; *dst++ = xtoa(((unsigned int)c >> 4) & 0xf); *dst++ = xtoa((unsigned int)c & 0xf); } return dst; }
/* * This is do_hvis, for HTTP style (RFC 1808) */ static char * do_hvis(char *dst, int c, int flag, int nextc, const char *extra) { if ((isascii(c) && isalnum(c)) /* safe */ || c == '$' || c == '-' || c == '_' || c == '.' || c == '+' /* extra */ || c == '!' || c == '*' || c == '\'' || c == '(' || c == ')' || c == ',') { dst = do_svis(dst, c, flag, nextc, extra); } else { *dst++ = '%'; *dst++ = xtoa(((unsigned int)c >> 4) & 0xf); *dst++ = xtoa((unsigned int)c & 0xf); } return dst; }
/* Space at the end of the line */ ((isspace(c) && (nextc == '\r' || nextc == '\n')) || /* Out of range */ (!isspace(c) && (c < 33 || (c > 60 && c < 62) || c > 126)) || /* Specific char to be escaped */ strchr("#$@[\\]^`{|}~", c) != NULL)) { if (dlen) { if (*dlen < 3) return NULL; *dlen -= 3; } *dst++ = '='; *dst++ = XTOA(((unsigned int)c >> 4) & 0xf); *dst++ = XTOA((unsigned int)c & 0xf); } else { dst = do_svis(dst, dlen, c, flag, nextc, extra); } return dst; } /* * This is do_vis, the central code of vis. * dst: Pointer to the destination buffer * c: Character to encode * flag: Flag word * nextc: The character following 'c' * extra: Pointer to the list of extra characters to be * backslash-protected. */ static char * do_svis(char *dst, size_t *dlen, int c, int flag, int nextc, const char *extra)