From b05868d12060acdfd7aa386186ad808b81b78265 Mon Sep 17 00:00:00 2001 From: EnderIce2 Date: Wed, 12 Feb 2025 02:43:43 +0200 Subject: [PATCH] userspace/libc: implement fprintf function Signed-off-by: EnderIce2 --- Userspace/libc/include/stdio.h | 2 +- Userspace/libc/src/std/stdio.c | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Userspace/libc/include/stdio.h b/Userspace/libc/include/stdio.h index fee0fe7e..0ebab822 100644 --- a/Userspace/libc/include/stdio.h +++ b/Userspace/libc/include/stdio.h @@ -97,7 +97,7 @@ extern "C" void flockfile(FILE *); FILE *fmemopen(void *restrict, size_t, const char *restrict); FILE *fopen(const char *restrict pathname, const char *restrict mode); - int fprintf(FILE *restrict, const char *restrict, ...); + int fprintf(FILE *restrict stream, const char *restrict format, ...); int fputc(int c, FILE *stream); int fputs(const char *restrict s, FILE *restrict stream); size_t fread(void *restrict ptr, size_t size, size_t nitems, FILE *restrict stream); diff --git a/Userspace/libc/src/std/stdio.c b/Userspace/libc/src/std/stdio.c index 602da4f9..59a5d731 100644 --- a/Userspace/libc/src/std/stdio.c +++ b/Userspace/libc/src/std/stdio.c @@ -214,7 +214,14 @@ export FILE *fopen(const char *restrict pathname, const char *restrict mode) return file; } -export int fprintf(FILE *restrict, const char *restrict, ...); +export int fprintf(FILE *restrict stream, const char *restrict format, ...) +{ + va_list args; + va_start(args, format); + int ret = vfprintf(stream, format, args); + va_end(args); + return ret; +} export int fputc(int c, FILE *stream) {