6 #include "stdio_impl.h"
9 static void f_read(rctx_t *r)
12 if ((r->c = __uflow(f)) >= 0) r->l++;
15 int vfscanf(FILE *f, const char *fmt, va_list ap)
17 size_t l = strlen(fmt), i, result;
18 rctx_t r = { f_read, (void *)f, 0, isspace };
25 for (i=0; i<=l; i++) fmt2[i] = (unsigned char)fmt[i];
29 result = __scanf(&r, fmt2, ap);
31 if (r.u && r.c >= 0) {
32 /* This code takes care of the case where the caller performs
33 * a nonmatching scanf to leave a character in the unscan
34 * buffer, followed by an unget, followed by a scanf that
35 * matches zero characters. In this case the final 'unread'
36 * character must be returned to the unget buffer rather than
37 * the unscan buffer. */