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 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 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 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 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 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) \ 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 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; +} 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