]> git.saurik.com Git - apple/libc.git/blame - stdio/FreeBSD/sscanf.c.patch
Libc-763.13.tar.gz
[apple/libc.git] / stdio / FreeBSD / sscanf.c.patch
CommitLineData
1f2f436a
A
1--- sscanf.c.orig 2009-11-30 16:15:30.000000000 -0800
2+++ sscanf.c 2009-12-02 16:50:00.000000000 -0800
3@@ -36,42 +36,33 @@ static char sccsid[] = "@(#)sscanf.c 8.1
3d9156a7 4 #include <sys/cdefs.h>
1f2f436a 5 __FBSDID("$FreeBSD: src/lib/libc/stdio/sscanf.c,v 1.13 2008/04/17 22:17:54 jhb Exp $");
3d9156a7
A
6
7+#include "xlocale_private.h"
8+
9 #include <stdio.h>
10 #include <string.h>
11 #include <stdarg.h>
1f2f436a
A
12 #include "local.h"
13
14-static int eofread(void *, char *, int);
15-
16-/* ARGSUSED */
17-static int
18-eofread(cookie, buf, len)
19- void *cookie;
20- char *buf;
21- int len;
3d9156a7 22+int
1f2f436a
A
23+sscanf(const char * __restrict str, char const * __restrict fmt, ...)
24 {
3d9156a7
A
25+ int ret;
26+ va_list ap;
1f2f436a
A
27
28- return (0);
3d9156a7 29+ va_start(ap, fmt);
1f2f436a
A
30+ ret = vsscanf_l(str, __current_locale(), fmt, ap);
31+ va_end(ap);
32+ return (ret);
33 }
34
35 int
36-sscanf(const char * __restrict str, char const * __restrict fmt, ...)
37+sscanf_l(const char * __restrict str, locale_t loc, char const * __restrict fmt, ...)
38 {
39 int ret;
40 va_list ap;
41- FILE f;
42
43- f._file = -1;
44- f._flags = __SRD;
45- f._bf._base = f._p = (unsigned char *)str;
46- f._bf._size = f._r = strlen(str);
47- f._read = eofread;
48- f._ub._base = NULL;
49- f._lb._base = NULL;
50- f._orientation = 0;
51- memset(&f._mbstate, 0, sizeof(mbstate_t));
52 va_start(ap, fmt);
53- ret = __svfscanf(&f, fmt, ap);
54+ ret = vsscanf_l(str, loc, fmt, ap);
3d9156a7
A
55 va_end(ap);
56 return (ret);
57 }