From ac72d6449064ed5360c1f619fdd6902a40446f97 Mon Sep 17 00:00:00 2001 From: apio Date: Sat, 8 Oct 2022 13:45:57 +0200 Subject: [PATCH] Make (v)fprintf alias to (v)printf instead of throwing an error We don't have files :) (yet) But if someone wants to fprintf(stderr), then fine. Do it. Except it won't be any different from fprintf(stdout) or printf(). --- libs/libc/src/stdio.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/libs/libc/src/stdio.cpp b/libs/libc/src/stdio.cpp index a59357ad..7768dc77 100644 --- a/libs/libc/src/stdio.cpp +++ b/libs/libc/src/stdio.cpp @@ -20,9 +20,13 @@ extern "C" { NOT_IMPLEMENTED("fopen"); } - int fprintf(FILE*, const char*, ...) + int fprintf(FILE*, const char* format, ...) // FIXME: Make fprintf print to the selected file instead of stdout. { - NOT_IMPLEMENTED("fprintf"); + va_list ap; + va_start(ap, format); + int written = vprintf(format, ap); + va_end(ap); + return written; } size_t fread(void*, size_t, size_t, FILE*) { @@ -44,9 +48,10 @@ extern "C" { NOT_IMPLEMENTED("setbuf"); } - int vfprintf(FILE*, const char*, va_list) + int vfprintf(FILE*, const char* format, + va_list ap) // FIXME: Make vfprintf print to the selected file instead of stdout. { - NOT_IMPLEMENTED("vfprintf"); + return vprintf(format, ap); } int puts(const char* s) {