diff options
| author | Xavier Del Campo Romero <xavi.dcr@tutanota.com> | 2021-10-24 02:48:31 +0200 |
|---|---|---|
| committer | Xavier Del Campo Romero <xavi.dcr@tutanota.com> | 2021-10-24 03:10:03 +0200 |
| commit | 80beba98c7bb968e830d0fe2f737b4e7cf3640d3 (patch) | |
| tree | 67c9fabc7e6d2994908ccf11f2c6b54fbe0b013b /libpsx | |
| parent | fdf8c183357a1c2892ab100591e257f46cdadd4c (diff) | |
Provide implementation for fprintf(3)
Diffstat (limited to 'libpsx')
| -rw-r--r-- | libpsx/include/stdio.h | 2 | ||||
| -rw-r--r-- | libpsx/src/libc/printf.c | 16 |
2 files changed, 17 insertions, 1 deletions
diff --git a/libpsx/include/stdio.h b/libpsx/include/stdio.h index 6ffd4e0..0e093d9 100644 --- a/libpsx/include/stdio.h +++ b/libpsx/include/stdio.h @@ -85,7 +85,7 @@ int puts(const char *str); */ extern int printf(const char *format, ...); - +int fprintf(FILE *fd, const char *format, ...); #ifdef __IN_LIBPSX diff --git a/libpsx/src/libc/printf.c b/libpsx/src/libc/printf.c index a278435..d2deeb0 100644 --- a/libpsx/src/libc/printf.c +++ b/libpsx/src/libc/printf.c @@ -853,6 +853,22 @@ int vsprintf(char *string, const char *fmt, va_list ap) return vsnprintf(string, 0xffffffff, fmt, ap); } +int fprintf(FILE *const fd, const char *fmt, ...) +{ + if (fd == stdout || fd == stderr) + { + int r; + va_list ap; + + va_start(ap, fmt); + r = vprintf(fmt, ap); + va_end(ap); + return r; + } + + return -1; +} + int sprintf(char *string, const char *fmt, ...) { int r; |
