From d058c08d610bb5b0c94108d7558e74d8e02cc7d5 Mon Sep 17 00:00:00 2001 From: Kat Richey Date: Sun, 9 Oct 2022 11:47:01 -0500 Subject: [PATCH 1/9] Something's not right here. Ugh --- include/float.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/float.h b/include/float.h index 4f30a05..cc12640 100644 --- a/include/float.h +++ b/include/float.h @@ -22,6 +22,11 @@ #define FLT_RADIX 2 +/* + Okay, hold up. What is going on with LDBL? That...shouldn't be right. Ugh. + -Kat +*/ + #define FLT_MANT_DIG 24 #define DBL_MANT_DIG 53 #define LDBL_MANT_DIG 113 From f609e6db47ee17e8b56438faf1e04c11cd6c2139 Mon Sep 17 00:00:00 2001 From: Kat Richey Date: Sun, 9 Oct 2022 11:47:13 -0500 Subject: [PATCH 2/9] Attribution --- include/stddef.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/stddef.h b/include/stddef.h index 3f3f4fe..a87969d 100755 --- a/include/stddef.h +++ b/include/stddef.h @@ -19,6 +19,10 @@ #include #include +/* + I do believe this is straight ripped from musl. + -Kat +*/ #define offsetof(type, member) (size_t)(&((type *)0->member)) #endif From 859245ac6fac18e4e5f842ad6404c292d70f9974 Mon Sep 17 00:00:00 2001 From: Kat Richey Date: Sun, 9 Oct 2022 11:47:32 -0500 Subject: [PATCH 3/9] Added gethostname declaration --- include/unistd.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/unistd.h b/include/unistd.h index 56e9ae5..35132df 100644 --- a/include/unistd.h +++ b/include/unistd.h @@ -72,4 +72,6 @@ int execv(const char *, char *const []); int execve(const char *, char *const [], char *const []); int execvp(const char *, char *const []); +int gethostname(char *, size_t); + #endif From 9c8ba8254660af63276ee90f07091d44110c3858 Mon Sep 17 00:00:00 2001 From: Kat Richey Date: Sun, 9 Oct 2022 11:47:52 -0500 Subject: [PATCH 4/9] Fixed uname declaration --- include/sys/utsname.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/sys/utsname.h b/include/sys/utsname.h index 5f8fc15..5c0f8a9 100644 --- a/include/sys/utsname.h +++ b/include/sys/utsname.h @@ -20,6 +20,6 @@ struct utsname { char machine[70]; }; -int uname(utsname *); +int uname(struct utsname *); #endif From a06d3c56a869610d46ee9a6c2abf02192eb4b57e Mon Sep 17 00:00:00 2001 From: Kat Richey Date: Sun, 9 Oct 2022 11:48:04 -0500 Subject: [PATCH 5/9] Wrote uname function --- misc/uname.c | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 misc/uname.c diff --git a/misc/uname.c b/misc/uname.c new file mode 100644 index 0000000..16456a4 --- /dev/null +++ b/misc/uname.c @@ -0,0 +1,9 @@ +#include +#include +#include + +int uname(struct utsname * u) { + __syscall_uname(u); + gethostname(u->nodename, 70); + return 1; +} \ No newline at end of file From 000f24b79c4b2f77cbc413288f2944099ec6933a Mon Sep 17 00:00:00 2001 From: Kat Richey Date: Sun, 9 Oct 2022 11:48:26 -0500 Subject: [PATCH 6/9] Wrote strcpy. Not sure if working --- string/strcpy.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100755 string/strcpy.c diff --git a/string/strcpy.c b/string/strcpy.c new file mode 100755 index 0000000..6e66461 --- /dev/null +++ b/string/strcpy.c @@ -0,0 +1,15 @@ +#include + +char * strcpy(char * restrict dest, const char * restrict src) { + char * to = dest; + const char * from = src; + size_t i; + + for(i = 0; from[i] != '\0'; i++) { + to[i] = from[i]; + } + + to[i] = from[i]; + + return dest; +} From b69c712ea52b6c020eb5e16bb6befe490b42d180 Mon Sep 17 00:00:00 2001 From: Kat Richey Date: Sun, 9 Oct 2022 11:48:47 -0500 Subject: [PATCH 7/9] Wrote gethostname filler --- unistd/gethostname.c | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 unistd/gethostname.c diff --git a/unistd/gethostname.c b/unistd/gethostname.c new file mode 100644 index 0000000..3f33034 --- /dev/null +++ b/unistd/gethostname.c @@ -0,0 +1,7 @@ +#include +#include + +int gethostname(char * name, size_t namelen) { + memcpy(name, "TEST_STR_REPLACE_LATER", namelen); + return 0; +} \ No newline at end of file From 6a53e3535a16a6fdecfb8c475b4d51251b46612f Mon Sep 17 00:00:00 2001 From: Kat Richey Date: Sun, 9 Oct 2022 11:49:06 -0500 Subject: [PATCH 8/9] Added uname objs --- makefile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/makefile b/makefile index 7b64263..05888c5 100755 --- a/makefile +++ b/makefile @@ -44,6 +44,7 @@ ctype/isupper.o \ ctype/isxdigit.o \ ctype/tolower.o \ ctype/toupper.o \ +misc/uname.o \ stdlib/abort.o \ stdlib/bsearch.o \ stdio/printf.o \ @@ -54,9 +55,11 @@ string/memcpy.o \ string/memmove.o \ string/memset.o \ string/strcmp.o \ +string/strcpy.o \ string/strcspn.o \ string/strlen.o \ -string/strtok.o +string/strtok.o \ +unistd/gethostname.o HOSTEDOBJS=\ $(ARCH_HOSTEDOBJS) \ From 8458c74ee119047f51854d43ce922dc29bcfdba1 Mon Sep 17 00:00:00 2001 From: Kat Richey Date: Sun, 9 Oct 2022 11:49:10 -0500 Subject: [PATCH 9/9] ??? --- arch/i386/make.config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/i386/make.config b/arch/i386/make.config index 580f075..b8bcc25 100755 --- a/arch/i386/make.config +++ b/arch/i386/make.config @@ -7,4 +7,4 @@ ARCH_FREEOBJS=\ $(ARCHDIR)/inb.o \ $(ARCHDIR)/outb.o -ARCH_HOSTEDOBJS=\ \ No newline at end of file +ARCH_HOSTEDOBJS= \ No newline at end of file