diff --git a/src/libc/include/stdio.h b/src/libc/include/stdio.h index d5e68420..6bbfb765 100644 --- a/src/libc/include/stdio.h +++ b/src/libc/include/stdio.h @@ -52,11 +52,15 @@ int scanf(const char *format, ...); int fscanf(FILE *stream, const char *format, ...); int sscanf(const char *str, const char *format, ...); +int vfprintf(FILE *restrict stream, const char *restrict format, va_list ap); int vsnprintf(char *str, size_t size, const char *format, va_list ap); char getchar(void); int fflush(FILE *stream); +int ferror(FILE *stream); +size_t fread(void *ptr, size_t size, size_t nmemb, FILE *restrict stream); + /* int vprintf(const char *format, va_list ap); int vfprintf(FILE *stream, const char *format, va_list ap); @@ -74,12 +78,17 @@ __attribute__((__format__(__scanf__,2,0))); */ +void perror(const char *s); + int fclose(FILE *stream); FILE *fopen(const char *path, const char *mode); int feof(FILE *stream); size_t fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream); char *fgets(char *s, int size, FILE *stream); +long ftell(FILE *stream); FILE *popen(const char *command, const char *type); int pclose(FILE *stream); + +FILE *open_memstream(char **ptr, size_t *sizeloc); #endif diff --git a/src/libc/src/stdio.c b/src/libc/src/stdio.c index 73e19abd..c5529303 100644 --- a/src/libc/src/stdio.c +++ b/src/libc/src/stdio.c @@ -25,6 +25,12 @@ int fscanf(FILE *stream, const char *format, ...) { return 0; } int sscanf(const char *str, const char *format, ...) { return 0; } int fflush(FILE *stream) { return 0; } +int ferror(FILE *stream) { return 0; } +size_t fread(void *ptr, size_t size, size_t nmemb, FILE *restrict stream) { + return 0; +} + +void perror(const char *s) {} int fclose(FILE *stream) { return 0; } FILE *fopen(const char *path, const char *mode) { return 0; } @@ -33,10 +39,19 @@ size_t fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream) { return 0; } char *fgets(char *s, int size, FILE *stream) { return 0; } +long ftell(FILE *stream) { return 0; } FILE *popen(const char *command, const char *type) { return 0; } int pclose(FILE *stream) { return 0; } +int vfprintf(FILE *restrict stream, const char *restrict format, va_list ap) { + return 0; +} int vsnprintf(char *str, size_t size, const char *format, va_list ap) { return 0; } + +FILE memstream = {0}; +FILE *open_memstream(char **ptr, size_t *sizeloc) { + return &memstream; +}