---- nsap_addr.c.orig 2003-05-20 15:22:14.000000000 -0700
-+++ nsap_addr.c 2005-02-24 16:48:08.000000000 -0800
-@@ -18,6 +18,8 @@
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/net/nsap_addr.c,v 1.9 2002/03/22 21:52:29 obrien Exp $");
+--- nsap_addr.c.orig 2008-09-01 21:04:36.000000000 -0700
++++ nsap_addr.c 2008-09-01 21:11:10.000000000 -0700
+@@ -17,6 +17,10 @@
-+#include "xlocale_private.h"
+ #if defined(LIBC_SCCS) && !defined(lint)
+ static const char rcsid[] = "$Id: nsap_addr.c,v 1.3.18.2 2005/07/28 07:38:08 marka Exp $";
++
++/* the algorithms only can deal with ASCII, so we optimize for it */
++#define USE_ASCII
+
- #include <sys/types.h>
- #include <sys/param.h>
- #include <sys/socket.h>
-@@ -26,6 +28,7 @@
- #include <arpa/nameser.h>
+ #endif /* LIBC_SCCS and not lint */
+ #include <sys/cdefs.h>
+ __FBSDID("$FreeBSD: src/lib/libc/inet/nsap_addr.c,v 1.3 2007/06/03 17:20:26 ume Exp $");
+@@ -33,10 +37,12 @@ __FBSDID("$FreeBSD: src/lib/libc/inet/ns
+
#include <ctype.h>
#include <resolv.h>
-+#include <stdlib.h>
+-#include <resolv_mt.h>
++//#include <resolv_mt.h>
- static char
- xtob(c)
-@@ -42,20 +45,21 @@
- {
- u_char c, nib;
- u_int len = 0;
-+ locale_t loc = __current_locale();
+ #include "port_after.h"
- 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) {
int nib;
int i;
-- static char tmpbuf[255*3];
-+ static char *tmpbuf = NULL;
+- char *tmpbuf = inet_nsap_ntoa_tmpbuf;
++ char *tmpbuf = NULL;
char *start;
+ if (tmpbuf == NULL) {
+ tmpbuf = malloc(255*3);
-+ if (tmpbuf == NULL)
-+ return NULL;
++ if (tmpbuf == NULL) return NULL;
+ }
if (ascii)
start = ascii;