---- regexec.c.orig Sun Feb 16 09:29:10 2003
-+++ regexec.c Sat May 3 14:21:16 2003
-@@ -137,6 +137,8 @@
+--- regexec.c.bsdnew 2009-11-11 11:29:04.000000000 -0800
++++ regexec.c 2009-11-11 12:21:46.000000000 -0800
+@@ -39,6 +39,8 @@ static char sccsid[] = "@(#)regexec.c 8.
+ #include <sys/cdefs.h>
+ __FBSDID("$FreeBSD: src/lib/libc/regex/regexec.c,v 1.8 2007/06/11 03:05:54 delphij Exp $");
+
++#include "xlocale_private.h"
++
+ /*
+ * the outer shell of regexec()
+ *
+@@ -62,12 +64,12 @@ __FBSDID("$FreeBSD: src/lib/libc/regex/r
+ static int nope __unused = 0; /* for use in asserts; shuts lint up */
+
+ static __inline size_t
+-xmbrtowc(wint_t *wi, const char *s, size_t n, mbstate_t *mbs, wint_t dummy)
++xmbrtowc(wint_t *wi, const char *s, size_t n, mbstate_t *mbs, wint_t dummy, locale_t loc)
+ {
+ size_t nr;
+ wchar_t wc;
+
+- nr = mbrtowc(&wc, s, n, mbs);
++ nr = mbrtowc_l(&wc, s, n, mbs, loc);
+ if (wi != NULL)
+ *wi = wc;
+ if (nr == 0)
+@@ -86,7 +88,8 @@ xmbrtowc_dummy(wint_t *wi,
+ const char *s,
+ size_t n __unused,
+ mbstate_t *mbs __unused,
+- wint_t dummy __unused)
++ wint_t dummy __unused,
++ locale_t loc __unused)
+ {
+
+ if (wi != NULL)
+@@ -176,6 +179,8 @@ xmbrtowc_dummy(wint_t *wi,
/* function names */
#define LNAMES /* flag */
+#define __FBSDID(x)
#include "engine.c"
- /*
+ /* multibyte character & large states version */
+@@ -224,7 +229,8 @@ regexec(const regex_t * __restrict preg,
+ return(REG_BADPAT);
+ eflags = GOODFLAGS(eflags);
+
+- if (MB_CUR_MAX > 1)
++ g->loc = __current_locale();
++ if (MB_CUR_MAX_L(g->loc) > 1)
+ return(mmatcher(g, (char *)string, nmatch, pmatch, eflags));
+ else if (g->nstates <= CHAR_BIT*sizeof(states1) && !(eflags®_LARGE))
+ return(smatcher(g, (char *)string, nmatch, pmatch, eflags));