libc: fscanf stubs
This commit is contained in:
parent
994150501a
commit
045e511d74
@ -81,3 +81,5 @@ extern char * tmpnam(char * s);
|
||||
|
||||
extern int vsscanf(const char *str, const char *format, va_list ap);
|
||||
extern int sscanf(const char *str, const char *format, ...);
|
||||
extern int vfscanf(FILE * stream, const char *format, va_list ap);
|
||||
extern int fscanf(FILE *stream, const char *format, ...);
|
||||
|
@ -22,6 +22,21 @@ int vsscanf(const char *str, const char *format, va_list ap) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int vfscanf(FILE * stream, const char *format, va_list ap) {
|
||||
fprintf(stderr, "%s: fscanf(%d, format=%s, ...);\n", _argv_0, fileno(stream), format);
|
||||
while (*format) {
|
||||
if (*format == ' ') {
|
||||
/* Handle whitespace */
|
||||
} else if (*format == '%') {
|
||||
/* Parse */
|
||||
} else {
|
||||
/* Expect exact character? */
|
||||
}
|
||||
format++;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int sscanf(const char *str, const char *format, ...) {
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
@ -29,3 +44,11 @@ int sscanf(const char *str, const char *format, ...) {
|
||||
va_end(args);
|
||||
return out;
|
||||
}
|
||||
|
||||
int fscanf(FILE *stream, const char *format, ...) {
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
int out = vfscanf(stream, format, args);
|
||||
va_end(args);
|
||||
return out;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user