about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2012-03-25 00:21:20 -0400
committerRich Felker <dalias@aerifal.cx>2012-03-25 00:21:20 -0400
commitbff650df9f1f6a0da80d8894535a41b0a2cca320 (patch)
treeada4f3bb329c20582a895774feaa54919293e7c1 /src
parentdf82f8f2dcbf35ba0e91b8d529491178d896b3b5 (diff)
downloadmusl-bff650df9f1f6a0da80d8894535a41b0a2cca320.tar.gz
musl-bff650df9f1f6a0da80d8894535a41b0a2cca320.tar.xz
musl-bff650df9f1f6a0da80d8894535a41b0a2cca320.zip
add strfmon_l variant (still mostly incomplete)
Diffstat (limited to 'src')
-rw-r--r--src/locale/strfmon.c30
1 files changed, 27 insertions, 3 deletions
diff --git a/src/locale/strfmon.c b/src/locale/strfmon.c
index 66bee482..81dfe38f 100644
--- a/src/locale/strfmon.c
+++ b/src/locale/strfmon.c
@@ -3,16 +3,15 @@
 #include <stdarg.h>
 #include <monetary.h>
 #include <errno.h>
+#include <stdarg.h>
 
-ssize_t strfmon(char *s, size_t n, const char *fmt, ...)
+static ssize_t vstrfmon_l(char *s, size_t n, locale_t loc, const char *fmt, va_list ap)
 {
 	size_t l;
 	double x;
 	int fill, nogrp, negpar, nosym, left, intl;
 	int lp, rp, w, fw;
 	char *s0=s;
-	va_list ap;
-	va_start(ap, fmt);
 	for (; n && *fmt; ) {
 		if (*fmt != '%') {
 		literal:
@@ -75,3 +74,28 @@ ssize_t strfmon(char *s, size_t n, const char *fmt, ...)
 	}
 	return s-s0;
 }
+
+ssize_t strfmon_l(char *s, size_t n, locale_t loc, const char *fmt, ...)
+{
+	va_list ap;
+	ssize_t ret;
+
+	va_start(ap, fmt);
+	ret = vstrfmon_l(s, n, loc, fmt, ap);
+	va_end(ap);
+
+	return ret;
+}
+
+
+ssize_t strfmon(char *s, size_t n, const char *fmt, ...)
+{
+	va_list ap;
+	ssize_t ret;
+
+	va_start(ap, fmt);
+	ret = vstrfmon_l(s, n, 0, fmt, ap);
+	va_end(ap);
+
+	return ret;
+}