1 --- vswprintf.c.orig    2009-11-30 16:15:30.000000000 -0800
 
   2 +++ vswprintf.c 2009-12-03 15:21:59.000000000 -0800
 
   3 @@ -33,6 +33,8 @@ __FBSDID("FreeBSD: src/lib/libc/stdio/va
 
   5  __FBSDID("$FreeBSD: src/lib/libc/stdio/vswprintf.c,v 1.7 2008/04/17 22:17:54 jhb Exp $");
 
   7 +#include "xlocale_private.h"
 
  12 @@ -40,8 +42,8 @@ __FBSDID("$FreeBSD: src/lib/libc/stdio/v
 
  16 -vswprintf(wchar_t * __restrict s, size_t n, const wchar_t * __restrict fmt,
 
  18 +vswprintf_l(wchar_t * __restrict s, size_t n, locale_t loc,
 
  19 +    const wchar_t * __restrict fmt, __va_list ap)
 
  21         static const mbstate_t initial;
 
  23 @@ -49,7 +51,11 @@ vswprintf(wchar_t * __restrict s, size_t
 
  27 +       struct __sFILEX ext;
 
  31 +       NORMALIZE_LOCALE(loc);
 
  35 @@ -65,7 +71,7 @@ vswprintf(wchar_t * __restrict s, size_t
 
  36         f._bf._size = f._w = 127;               /* Leave room for the NUL */
 
  38         memset(&f._mbstate, 0, sizeof(mbstate_t));
 
  39 -       ret = __vfwprintf(&f, fmt, ap);
 
  40 +       ret = __vfwprintf(&f, loc, fmt, ap);
 
  44 @@ -79,7 +85,7 @@ vswprintf(wchar_t * __restrict s, size_t
 
  45          * fputwc() did in __vfwprintf().
 
  48 -       nwc = mbsrtowcs(s, (const char **)&mbp, n, &mbs);
 
  49 +       nwc = mbsrtowcs_l(s, (const char **)&mbp, n, &mbs, loc);
 
  51         if (nwc == (size_t)-1) {
 
  53 @@ -93,3 +99,10 @@ vswprintf(wchar_t * __restrict s, size_t
 
  59 +vswprintf(wchar_t * __restrict s, size_t n,
 
  60 +    const wchar_t * __restrict fmt, __va_list ap)
 
  62 +       return vswprintf_l(s, n, __current_locale(), fmt, ap);