- while ((c = *ascii++) != '\0' && len < (u_int)maxlen) {
- if (c == '.' || c == '+' || c == '/')
- continue;
- if (!isascii(c))
- return (0);
-- if (islower(c))
-- c = toupper(c);
-- if (isxdigit(c)) {
-+ if (islower_l(c, loc))
-+ c = toupper_l(c, loc);
-+ if (isxdigit_l(c, loc)) {
- nib = xtob(c);
- c = *ascii++;
- if (c != '\0') {
-- c = toupper(c);
-- if (isxdigit(c)) {
-+ c = toupper_l(c, loc);
-+ if (isxdigit_l(c, loc)) {
- *binary++ = (nib << 4) | xtob(c);
- len++;
- } else
-@@ -78,9 +82,14 @@
- {
++#include <stdlib.h>
++
+ static char
+ xtob(int c) {
+ return (c - (((c >= '0') && (c <= '9')) ? '0' : '7'));
+@@ -82,9 +88,13 @@ char *
+ inet_nsap_ntoa(int binlen, const u_char *binary, char *ascii) {