Files
musl/src/stdio/vsscanf.c
Rich Felker 18efeb320b new scanf implementation and corresponding integer parser/converter
advantages over the old code:
- correct results for floating point (old code was bogus)
- wide/regular scanf separated so scanf does not pull in wide code
- well-defined behavior on integers that overflow dest type
- support for %[a-b] ranges with %[ (impl-defined by widely used)
- no intermediate conversion of fmt string to wide string
- cleaner, easier to share code with strto* functions
- better standards conformance for corner cases

the old code remains in the source tree, as the wide versions of the
scanf-family functions are still using it. it will be removed when no
longer needed.
2012-04-16 16:03:45 -04:00

16 lines
306 B
C

#include "stdio_impl.h"
static size_t do_read(FILE *f, unsigned char *buf, size_t len)
{
return __string_read(f, buf, len);
}
int vsscanf(const char *s, const char *fmt, va_list ap)
{
FILE f = {
.buf = (void *)s, .cookie = (void *)s,
.read = do_read, .lock = -1
};
return vfscanf(&f, fmt, ap);
}