]>
Commit | Line | Data |
---|---|---|
3d9156a7 A |
1 | --- vis.c.orig 2004-11-25 11:38:02.000000000 -0800 |
2 | +++ vis.c 2005-02-24 16:58:00.000000000 -0800 | |
3 | @@ -37,6 +37,8 @@ | |
4 | #include <sys/cdefs.h> | |
5 | __FBSDID("$FreeBSD: src/lib/libc/gen/vis.c,v 1.13 2003/10/30 12:41:50 phk Exp $"); | |
6 | ||
7 | +#include "xlocale_private.h" | |
8 | + | |
9 | #include <sys/types.h> | |
10 | #include <limits.h> | |
11 | #include <ctype.h> | |
12 | @@ -54,18 +56,20 @@ | |
13 | int c, nextc; | |
14 | int flag; | |
15 | { | |
16 | + locale_t loc = __current_locale(); | |
17 | + | |
18 | c = (unsigned char)c; | |
19 | ||
20 | if (flag & VIS_HTTPSTYLE) { | |
21 | /* Described in RFC 1808 */ | |
22 | - if (!(isalnum(c) /* alpha-numeric */ | |
23 | + if (!(isalnum_l(c, loc) /* alpha-numeric */ | |
24 | /* safe */ | |
25 | || c == '$' || c == '-' || c == '_' || c == '.' || c == '+' | |
26 | /* extra */ | |
27 | || c == '!' || c == '*' || c == '\'' || c == '(' | |
28 | || c == ')' || c == ',')) { | |
29 | *dst++ = '%'; | |
30 | - snprintf(dst, 4, (c < 16 ? "0%X" : "%X"), c); | |
31 | + snprintf_l(dst, 4, loc, (c < 16 ? "0%X" : "%X"), c); | |
32 | dst += 2; | |
33 | goto done; | |
34 | } | |
35 | @@ -74,7 +78,7 @@ | |
36 | if ((flag & VIS_GLOB) && | |
37 | (c == '*' || c == '?' || c == '[' || c == '#')) | |
38 | ; | |
39 | - else if (isgraph(c) || | |
40 | + else if (isgraph_l(c, loc) || | |
41 | ((flag & VIS_SP) == 0 && c == ' ') || | |
42 | ((flag & VIS_TAB) == 0 && c == '\t') || | |
43 | ((flag & VIS_NL) == 0 && c == '\n') || | |
44 | @@ -130,7 +134,7 @@ | |
45 | goto done; | |
46 | } | |
47 | } | |
48 | - if (((c & 0177) == ' ') || isgraph(c) || (flag & VIS_OCTAL)) { | |
49 | + if (((c & 0177) == ' ') || isgraph_l(c, loc) || (flag & VIS_OCTAL)) { | |
50 | *dst++ = '\\'; | |
51 | *dst++ = ((u_char)c >> 6 & 07) + '0'; | |
52 | *dst++ = ((u_char)c >> 3 & 07) + '0'; | |
53 | @@ -143,7 +147,7 @@ | |
54 | c &= 0177; | |
55 | *dst++ = 'M'; | |
56 | } | |
57 | - if (iscntrl(c)) { | |
58 | + if (iscntrl_l(c, loc)) { | |
59 | *dst++ = '^'; | |
60 | if (c == 0177) | |
61 | *dst++ = '?'; |