From 5236e1ef0dafdda00cb6422dae49ee44b27cfb57 Mon Sep 17 00:00:00 2001 From: Bananymous Date: Mon, 17 Jun 2024 21:00:50 +0300 Subject: [PATCH] LibC: Add dummy functions for rename() and strftime() I don't really want to implement them right now, but they are required to exist for some ports. --- libc/stdio.cpp | 9 ++++++++- libc/time.cpp | 9 +++++++++ ports/doom/patches/0001-Add-support-for-banan-os.patch | 10 ++-------- 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/libc/stdio.cpp b/libc/stdio.cpp index d91d30ff..6a298e02 100644 --- a/libc/stdio.cpp +++ b/libc/stdio.cpp @@ -1,3 +1,6 @@ +#include +#include + #include #include #include @@ -603,7 +606,11 @@ int remove(const char* path) } // TODO -int rename(const char*, const char*); +int rename(const char* old, const char* _new) +{ + dwarnln("rename({}, {})", old, _new); + ASSERT_NOT_REACHED(); +} void rewind(FILE* file) { diff --git a/libc/time.cpp b/libc/time.cpp index bf3b0f8d..9fe8a832 100644 --- a/libc/time.cpp +++ b/libc/time.cpp @@ -1,3 +1,6 @@ +#include +#include + #include #include #include @@ -75,3 +78,9 @@ struct tm* localtime(const time_t* timer) // FIXME: support timezones return gmtime(timer); } + +size_t strftime(char* __restrict s, size_t maxsize, const char* __restrict format, const struct tm* __restrict timeptr) +{ + dwarnln("strftime({}, {}, {}, {})", s, maxsize, format, timeptr); + ASSERT_NOT_REACHED(); +} diff --git a/ports/doom/patches/0001-Add-support-for-banan-os.patch b/ports/doom/patches/0001-Add-support-for-banan-os.patch index 481795f9..0d990459 100644 --- a/ports/doom/patches/0001-Add-support-for-banan-os.patch +++ b/ports/doom/patches/0001-Add-support-for-banan-os.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add support for banan-os --- doomgeneric/Makefile.banan_os | 57 +++++++++++ - doomgeneric/doomgeneric_banan_os.cpp | 144 +++++++++++++++++++++++++++ + doomgeneric/doomgeneric_banan_os.cpp | 138 +++++++++++++++++++++++++++ 2 files changed, 200 insertions(+) create mode 100644 doomgeneric/Makefile.banan_os create mode 100644 doomgeneric/doomgeneric_banan_os.cpp @@ -79,7 +79,7 @@ new file mode 100644 index 0000000..9161771 --- /dev/null +++ b/doomgeneric/doomgeneric_banan_os.cpp -@@ -0,0 +1,144 @@ +@@ -0,0 +1,138 @@ +extern "C" +{ +#include "doomgeneric.h" @@ -217,12 +217,6 @@ index 0000000..9161771 + return 0; +} + -+int rename(const char* oldp, const char* newp) -+{ -+ fprintf(stderr, "rename(\"%s\", \"%s\")\n", oldp, newp); -+ exit(1); -+} -+ +} -- 2.45.2