X-Git-Url: https://git.saurik.com/apple/libc.git/blobdiff_plain/1f2f436a38f7ae2d39a943ad2898d8fed4ed2e58..15de9d6b4ab2de27ae24b13b7b6c4d55fffe4aef:/gen/FreeBSD/vis.c?ds=inline diff --git a/gen/FreeBSD/vis.c b/gen/FreeBSD/vis.c index 94d1b22..3a4b67c 100644 --- a/gen/FreeBSD/vis.c +++ b/gen/FreeBSD/vis.c @@ -33,6 +33,8 @@ static char sccsid[] = "@(#)vis.c 8.1 (Berkeley) 7/19/93"; #include __FBSDID("$FreeBSD: src/lib/libc/gen/vis.c,v 1.14 2007/01/09 00:27:56 imp Exp $"); +#include "xlocale_private.h" + #include #include #include @@ -50,18 +52,20 @@ vis(dst, c, flag, nextc) int c, nextc; int flag; { + locale_t loc = __current_locale(); + c = (unsigned char)c; if (flag & VIS_HTTPSTYLE) { /* Described in RFC 1808 */ - if (!(isalnum(c) /* alpha-numeric */ + if (!(isalnum_l(c, loc) /* 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); + snprintf_l(dst, 4, loc, (c < 16 ? "0%X" : "%X"), c); dst += 2; goto done; } @@ -70,7 +74,7 @@ vis(dst, c, flag, nextc) if ((flag & VIS_GLOB) && (c == '*' || c == '?' || c == '[' || c == '#')) ; - else if (isgraph(c) || + else if (isgraph_l(c, loc) || ((flag & VIS_SP) == 0 && c == ' ') || ((flag & VIS_TAB) == 0 && c == '\t') || ((flag & VIS_NL) == 0 && c == '\n') || @@ -126,7 +130,7 @@ vis(dst, c, flag, nextc) goto done; } } - if (((c & 0177) == ' ') || isgraph(c) || (flag & VIS_OCTAL)) { + if (((c & 0177) == ' ') || isgraph_l(c, loc) || (flag & VIS_OCTAL)) { *dst++ = '\\'; *dst++ = ((u_char)c >> 6 & 07) + '0'; *dst++ = ((u_char)c >> 3 & 07) + '0'; @@ -139,7 +143,7 @@ vis(dst, c, flag, nextc) c &= 0177; *dst++ = 'M'; } - if (iscntrl(c)) { + if (iscntrl_l(c, loc)) { *dst++ = '^'; if (c == 0177) *dst++ = '?';