1 // ----------------------------------------------------------------------------
3 // ----------------------------------------------------------------------------
4 // Public Domain C Library - http://pdclib.sourceforge.net
5 // This code is Public Domain. Use, modify, and redistribute at will.
6 // ----------------------------------------------------------------------------
8 int fscanf( FILE * restrict stream, const char * restrict format, ... ) { /* TODO */ };
10 /* PDPC code - unreviewed
15 va_start(arg, format);
16 ret = vvscanf(format, arg, stream, NULL);
21 static int vvscanf(const char *format, va_list arg, FILE *fp, const char *s)
36 else if (*format == '%')
41 if (ch != '%') return (cnt);
44 else if (*format == 's')
46 cptr = va_arg(arg, char *);
49 while ((ch >= 0) && (!isspace(ch)))
60 else if (*format == 'd')
62 iptr = va_arg(arg, int *);
63 if (!isdigit(ch)) return (cnt);
66 while ((ch >= 0) && (isdigit(ch)))
68 *iptr = *iptr * 10 + (ch - '0');
79 if (ch != *format) return (cnt);