From 6e4b9831f903e583d58de8b4265159f6d859ebc2 Mon Sep 17 00:00:00 2001 From: dzwdz Date: Fri, 2 Sep 2022 23:56:18 +0200 Subject: user/ports: bare minimum to run doomgeneric --- src/user/lib/include/fcntl.h | 0 src/user/lib/include/inttypes.h | 1 + src/user/lib/include/math.h | 2 -- src/user/lib/include/stdio.h | 2 ++ src/user/lib/include/stdlib.h | 5 +++++ src/user/lib/include/string.h | 3 +++ src/user/lib/include/strings.h | 5 +++++ src/user/lib/include/sys/stat.h | 8 ++++++++ src/user/lib/include/sys/types.h | 1 + 9 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 src/user/lib/include/fcntl.h create mode 100644 src/user/lib/include/inttypes.h create mode 100644 src/user/lib/include/strings.h (limited to 'src/user/lib/include') diff --git a/src/user/lib/include/fcntl.h b/src/user/lib/include/fcntl.h new file mode 100644 index 0000000..e69de29 diff --git a/src/user/lib/include/inttypes.h b/src/user/lib/include/inttypes.h new file mode 100644 index 0000000..9a6118b --- /dev/null +++ b/src/user/lib/include/inttypes.h @@ -0,0 +1 @@ +#include diff --git a/src/user/lib/include/math.h b/src/user/lib/include/math.h index 07ff81d..1aec564 100644 --- a/src/user/lib/include/math.h +++ b/src/user/lib/include/math.h @@ -3,8 +3,6 @@ #define INFINITY __builtin_inff() #define HUGE_VAL ((double)INFINITY) -int abs(int i); - double acos(double x); double asin(double x); double atan2(double x, double y); diff --git a/src/user/lib/include/stdio.h b/src/user/lib/include/stdio.h index dd6a078..5ee0878 100644 --- a/src/user/lib/include/stdio.h +++ b/src/user/lib/include/stdio.h @@ -81,3 +81,5 @@ int rename(const char *old, const char *new); #define L_tmpnam (5 + 16 + 1) char *tmpnam(char *s); + +int sscanf(const char *restrict s, const char *restrict format, ...); diff --git a/src/user/lib/include/stdlib.h b/src/user/lib/include/stdlib.h index 8c827e3..2df0bf7 100644 --- a/src/user/lib/include/stdlib.h +++ b/src/user/lib/include/stdlib.h @@ -15,3 +15,8 @@ _Noreturn void exit(int); int mkstemp(char *template); char *getenv(const char *name); int system(const char *cmd); + +int abs(int i); + +int atoi(const char *s); +double atof(const char *s); diff --git a/src/user/lib/include/string.h b/src/user/lib/include/string.h index cf621d5..38fb0d2 100644 --- a/src/user/lib/include/string.h +++ b/src/user/lib/include/string.h @@ -4,6 +4,7 @@ long strtol(const char *restrict s, char **restrict end, int base); double strtod(const char *restrict s, char **restrict end); char *strchr(const char *s, int c); +char *strrchr(const char *s, int c); size_t strspn(const char *s, const char *accept); size_t strcspn(const char *s, const char *reject); @@ -18,5 +19,7 @@ int strcoll(const char *s1, const char *s2); char *strstr(const char *s1, const char *s2); char *strcpy(char *restrict s1, const char *restrict s2); +char *strncpy(char *restrict s1, const char *restrict s2, size_t n); +char *strdup(const char *s); char *strerror(int errnum); diff --git a/src/user/lib/include/strings.h b/src/user/lib/include/strings.h new file mode 100644 index 0000000..d0abc47 --- /dev/null +++ b/src/user/lib/include/strings.h @@ -0,0 +1,5 @@ +#pragma once +#include + +int strcasecmp(const char *s1, const char *s2); +int strncasecmp(const char *s1, const char *s2, size_t n); diff --git a/src/user/lib/include/sys/stat.h b/src/user/lib/include/sys/stat.h index a954c9b..78a8fc1 100644 --- a/src/user/lib/include/sys/stat.h +++ b/src/user/lib/include/sys/stat.h @@ -1,4 +1,5 @@ #pragma once +#include #include // only for ENOSYS #define S_ISFIFO(x) 0 @@ -9,3 +10,10 @@ static inline int fstat(int fd, struct stat *sb) { errno = ENOSYS; return -1; } + +static inline int mkdir(const char *path, mode_t mode) { + // TODO + (void)path; (void)mode; + errno = ENOSYS; + return -1; +} diff --git a/src/user/lib/include/sys/types.h b/src/user/lib/include/sys/types.h index 3b1772b..9f6f8f8 100644 --- a/src/user/lib/include/sys/types.h +++ b/src/user/lib/include/sys/types.h @@ -5,3 +5,4 @@ typedef long long off_t; typedef int64_t time_t; typedef uint64_t clock_t; +typedef int mode_t; -- cgit v1.2.3