]> git.saurik.com Git - apple/libc.git/blob - gen/FreeBSD/vis.c.patch
Libc-763.11.tar.gz
[apple/libc.git] / gen / FreeBSD / vis.c.patch
1 --- vis.c.orig 2009-11-07 14:51:38.000000000 -0800
2 +++ vis.c 2009-11-07 14:51:40.000000000 -0800
3 @@ -33,6 +33,8 @@ static char sccsid[] = "@(#)vis.c 8.1 (B
4 #include <sys/cdefs.h>
5 __FBSDID("$FreeBSD: src/lib/libc/gen/vis.c,v 1.14 2007/01/09 00:27:56 imp Exp $");
6
7 +#include "xlocale_private.h"
8 +
9 #include <sys/types.h>
10 #include <limits.h>
11 #include <ctype.h>
12 @@ -50,18 +52,20 @@ vis(dst, c, flag, nextc)
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 @@ -70,7 +74,7 @@ vis(dst, c, flag, nextc)
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 @@ -126,7 +130,7 @@ vis(dst, c, flag, nextc)
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 @@ -139,7 +143,7 @@ vis(dst, c, flag, nextc)
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++ = '?';