Compare commits

...

9 Commits

Author SHA1 Message Date
Kat R. 8458c74ee1 ??? 2022-10-09 11:49:10 -05:00
Kat R. 6a53e3535a Added uname objs 2022-10-09 11:49:06 -05:00
Kat R. b69c712ea5 Wrote gethostname filler 2022-10-09 11:48:47 -05:00
Kat R. 000f24b79c Wrote strcpy. Not sure if working 2022-10-09 11:48:26 -05:00
Kat R. a06d3c56a8 Wrote uname function 2022-10-09 11:48:04 -05:00
Kat R. 9c8ba82546 Fixed uname declaration 2022-10-09 11:47:52 -05:00
Kat R. 859245ac6f Added gethostname declaration 2022-10-09 11:47:32 -05:00
Kat R. f609e6db47 Attribution 2022-10-09 11:47:13 -05:00
Kat R. d058c08d61 Something's not right here. Ugh 2022-10-09 11:47:01 -05:00
9 changed files with 48 additions and 3 deletions

View File

@ -7,4 +7,4 @@ ARCH_FREEOBJS=\
$(ARCHDIR)/inb.o \
$(ARCHDIR)/outb.o
ARCH_HOSTEDOBJS=\
ARCH_HOSTEDOBJS=

View File

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

View File

@ -19,6 +19,10 @@
#include <types/size_t.h>
#include <types/wchar_t.h>
/*
I do believe this is straight ripped from musl.
-Kat
*/
#define offsetof(type, member) (size_t)(&((type *)0->member))
#endif

View File

@ -20,6 +20,6 @@ struct utsname {
char machine[70];
};
int uname(utsname *);
int uname(struct utsname *);
#endif

View File

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

View File

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

9
misc/uname.c Normal file
View File

@ -0,0 +1,9 @@
#include <sys/utsname.h>
#include <kernel/syscall.h>
#include <unistd.h>
int uname(struct utsname * u) {
__syscall_uname(u);
gethostname(u->nodename, 70);
return 1;
}

15
string/strcpy.c Executable file
View File

@ -0,0 +1,15 @@
#include <string.h>
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;
}

7
unistd/gethostname.c Normal file
View File

@ -0,0 +1,7 @@
#include <unistd.h>
#include <string.h>
int gethostname(char * name, size_t namelen) {
memcpy(name, "TEST_STR_REPLACE_LATER", namelen);
return 0;
}