some missing stdio stuff

This commit is contained in:
K. Lange 2018-07-19 19:12:49 +09:00
parent 89d107374c
commit b9419c756b
2 changed files with 12 additions and 0 deletions

View File

@ -37,10 +37,13 @@ extern int printf(const char *fmt, ...);
extern int snprintf(char * buf, size_t size, const char * fmt, ...);
extern int vsprintf(char * buf, const char *fmt, va_list args);
extern int vsnprintf(char * buf, size_t size, const char *fmt, va_list args);
extern int vfprintf(FILE * device, const char *format, va_list ap);
extern int puts(const char *s);
extern int fputs(const char *s, FILE *stream);
extern int fputc(int c, FILE *stream);
#define putc(c,s) fputc((c),(s))
#define putchar(c) fputc((c),stdout)
extern int fgetc(FILE *stream);
extern char *fgets(char *s, int size, FILE *stream);

View File

@ -265,6 +265,15 @@ int vsnprintf(char * buf, size_t size, const char *fmt, va_list args) {
return xvasprintf(buf, fmt, args);
}
int vfprintf(FILE * device, const char *fmt, va_list args) {
char * buffer;
vasprintf(&buffer, fmt, args);
int out = fwrite(buffer, 1, strlen(buffer), device);
free(buffer);
return out;
}
int fprintf(FILE * device, const char *fmt, ...) {
va_list args;