summaryrefslogtreecommitdiffstats
path: root/lib/libc/stdio/vsprintf.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc/stdio/vsprintf.c')
-rw-r--r--lib/libc/stdio/vsprintf.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/lib/libc/stdio/vsprintf.c b/lib/libc/stdio/vsprintf.c
index 3890af7..04f2df3 100644
--- a/lib/libc/stdio/vsprintf.c
+++ b/lib/libc/stdio/vsprintf.c
@@ -5,6 +5,11 @@
* This code is derived from software contributed to Berkeley by
* Chris Torek.
*
+ * Copyright (c) 2011 The FreeBSD Foundation
+ * All rights reserved.
+ * Portions of this software were developed by David Chisnall
+ * under sponsorship from the FreeBSD Foundation.
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -39,17 +44,25 @@ __FBSDID("$FreeBSD$");
#include <stdio.h>
#include <limits.h>
#include "local.h"
+#include "xlocale_private.h"
int
-vsprintf(char * __restrict str, const char * __restrict fmt, __va_list ap)
+vsprintf_l(char * __restrict str, locale_t locale,
+ const char * __restrict fmt, __va_list ap)
{
int ret;
FILE f = FAKE_FILE;
+ FIX_LOCALE(locale);
f._flags = __SWR | __SSTR;
f._bf._base = f._p = (unsigned char *)str;
f._bf._size = f._w = INT_MAX;
- ret = __vfprintf(&f, fmt, ap);
+ ret = __vfprintf(&f, locale, fmt, ap);
*f._p = 0;
return (ret);
}
+int
+vsprintf(char * __restrict str, const char * __restrict fmt, __va_list ap)
+{
+ return vsprintf_l(str, __get_locale(), fmt, ap);
+}
OpenPOWER on IntegriCloud