]> git.saurik.com Git - apple/libc.git/blame - stdio/FreeBSD/sscanf.c.patch
Libc-594.9.5.tar.gz
[apple/libc.git] / stdio / FreeBSD / sscanf.c.patch
CommitLineData
3d9156a7
A
1--- sscanf.c.orig 2003-05-20 15:22:44.000000000 -0700
2+++ sscanf.c 2005-02-23 16:42:49.000000000 -0800
3@@ -40,6 +40,8 @@
4 #include <sys/cdefs.h>
5 __FBSDID("$FreeBSD: src/lib/libc/stdio/sscanf.c,v 1.11 2002/10/12 16:13:41 mike Exp $");
6
7+#include "xlocale_private.h"
8+
9 #include <stdio.h>
10 #include <string.h>
11 #include <stdarg.h>
12@@ -76,7 +78,31 @@
13 f._extra = &extra;
14 INITEXTRA(&f);
15 va_start(ap, fmt);
16- ret = __svfscanf(&f, fmt, ap);
17+ ret = __svfscanf_l(&f, __current_locale(), fmt, ap);
18+ va_end(ap);
19+ return (ret);
20+}
21+
22+int
23+sscanf_l(const char * __restrict str, locale_t loc, char const * __restrict fmt, ...)
24+{
25+ int ret;
26+ va_list ap;
27+ struct __sFILEX extra;
28+ FILE f;
29+
30+ NORMALIZE_LOCALE(loc);
31+ f._file = -1;
32+ f._flags = __SRD;
33+ f._bf._base = f._p = (unsigned char *)str;
34+ f._bf._size = f._r = strlen(str);
35+ f._read = eofread;
36+ f._ub._base = NULL;
37+ f._lb._base = NULL;
38+ f._extra = &extra;
39+ INITEXTRA(&f);
40+ va_start(ap, fmt);
41+ ret = __svfscanf_l(&f, loc, fmt, ap);
42 va_end(ap);
43 return (ret);
44 }