]>
Commit | Line | Data |
---|---|---|
3d9156a7 A |
1 | --- inet_net_pton.c.orig 2004-11-25 11:38:29.000000000 -0800 |
2 | +++ inet_net_pton.c 2005-02-24 16:53:40.000000000 -0800 | |
3 | @@ -21,6 +21,8 @@ | |
4 | #include <sys/cdefs.h> | |
5 | __FBSDID("$FreeBSD: src/lib/libc/net/inet_net_pton.c,v 1.9 2003/09/15 23:38:06 fenner Exp $"); | |
6 | ||
7 | +#include "xlocale_private.h" | |
8 | + | |
9 | #include <sys/types.h> | |
10 | #include <sys/socket.h> | |
11 | #include <netinet/in.h> | |
12 | @@ -97,19 +99,20 @@ | |
13 | digits[] = "0123456789"; | |
14 | int n, ch, tmp, dirty, bits; | |
15 | const u_char *odst = dst; | |
16 | + locale_t loc = __current_locale(); | |
17 | ||
18 | ch = *src++; | |
19 | if (ch == '0' && (src[0] == 'x' || src[0] == 'X') | |
20 | - && isascii(src[1]) && isxdigit(src[1])) { | |
21 | + && isascii(src[1]) && isxdigit_l(src[1], loc)) { | |
22 | /* Hexadecimal: Eat nybble string. */ | |
23 | if (size <= 0) | |
24 | goto emsgsize; | |
25 | *dst = 0, dirty = 0; | |
26 | src++; /* skip x or X. */ | |
27 | while ((ch = *src++) != '\0' && | |
28 | - isascii(ch) && isxdigit(ch)) { | |
29 | - if (isupper(ch)) | |
30 | - ch = tolower(ch); | |
31 | + isascii(ch) && isxdigit_l(ch, loc)) { | |
32 | + if (isupper_l(ch, loc)) | |
33 | + ch = tolower_l(ch, loc); | |
34 | n = strchr(xdigits, ch) - xdigits; | |
35 | assert(n >= 0 && n <= 15); | |
36 | *dst |= n; | |
37 | @@ -122,7 +125,7 @@ | |
38 | } | |
39 | if (dirty) | |
40 | size--; | |
41 | - } else if (isascii(ch) && isdigit(ch)) { | |
42 | + } else if (isascii(ch) && isdigit_l(ch, loc)) { | |
43 | /* Decimal: eat dotted digit string. */ | |
44 | for (;;) { | |
45 | tmp = 0; | |
46 | @@ -134,7 +137,7 @@ | |
47 | if (tmp > 255) | |
48 | goto enoent; | |
49 | } while ((ch = *src++) != '\0' && | |
50 | - isascii(ch) && isdigit(ch)); | |
51 | + isascii(ch) && isdigit_l(ch, loc)); | |
52 | if (size-- <= 0) | |
53 | goto emsgsize; | |
54 | *dst++ = (u_char) tmp; | |
55 | @@ -143,14 +146,14 @@ | |
56 | if (ch != '.') | |
57 | goto enoent; | |
58 | ch = *src++; | |
59 | - if (!isascii(ch) || !isdigit(ch)) | |
60 | + if (!isascii(ch) || !isdigit_l(ch, loc)) | |
61 | goto enoent; | |
62 | } | |
63 | } else | |
64 | goto enoent; | |
65 | ||
66 | bits = -1; | |
67 | - if (ch == '/' && isascii(src[0]) && isdigit(src[0]) && dst > odst) { | |
68 | + if (ch == '/' && isascii(src[0]) && isdigit_l(src[0], loc) && dst > odst) { | |
69 | /* CIDR width specifier. Nothing can follow it. */ | |
70 | ch = *src++; /* Skip over the /. */ | |
71 | bits = 0; | |
72 | @@ -159,7 +162,7 @@ | |
73 | assert(n >= 0 && n <= 9); | |
74 | bits *= 10; | |
75 | bits += n; | |
76 | - } while ((ch = *src++) != '\0' && isascii(ch) && isdigit(ch)); | |
77 | + } while ((ch = *src++) != '\0' && isascii(ch) && isdigit_l(ch, loc)); | |
78 | if (ch != '\0') | |
79 | goto enoent; | |
80 | if (bits > 32) |