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.
This commit is contained in:
Bananymous 2024-06-17 21:00:50 +03:00
parent be7ed8e74a
commit 5236e1ef0d
3 changed files with 19 additions and 9 deletions

View File

@ -1,3 +1,6 @@
#include <BAN/Assert.h>
#include <BAN/Debug.h>
#include <bits/printf.h>
#include <errno.h>
#include <fcntl.h>
@ -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)
{

View File

@ -1,3 +1,6 @@
#include <BAN/Assert.h>
#include <BAN/Debug.h>
#include <sys/syscall.h>
#include <time.h>
#include <unistd.h>
@ -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();
}

View File

@ -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