Upload files to "src"

This commit is contained in:
2026-02-27 13:06:59 +00:00
parent f9687a067f
commit 3c72907c5f
5 changed files with 198 additions and 39 deletions

View File

@@ -9,46 +9,34 @@
// our own exit LINUX ONLY
void exit(int code){
syscall1(SYS_exit, code);
for(;;){}
for(;;) {}
}
// handles the length of a string for print
long unsigned strlen(char *string){
char *cursor = string;
while(*cursor){
cursor++;
// safty last
void safeError(char *error){
if(error != NULL){
print(error);
ColorPrint("exiting with code -1\n", RED);
exit(-1);
}
long unsigned result = cursor - string;
return result;
print("something went wrong ");
ColorPrint("exiting with code -1\n", RED);
exit(-1);
}
// only use this when something will work but not as intended
void riskyError(){
print("not critical error was found\n");
}
// print
void print(char *string){
syscall3(SYS_write, 1, (long)string, strlen(string));
}
// #Schlaf mein Kindlein, schlaf doch ein, der Rabe hat nach dir gerufen.#
void sleeper(long seconds){
timespec duration = {0};
duration.tv_sec = seconds;
// it can do everythig print can but better
void ColorPrint(char *string, char *color){
syscall3(SYS_write, 1, (long)color, strlen(color));
syscall3(SYS_write, 1, (long)string, strlen(string));
syscall3(SYS_write, 1, (long)NORMAL, sizeof(NORMAL)-1);
}
syscall2(SYS_sleep, (long)(&duration), 0);
// instead of changing the foreground it changes the background
void BackgroundPrint(char *string, char *Bcolor){
syscall3(SYS_write, 1, (long)Bcolor, strlen(Bcolor));
syscall3(SYS_write, 1, (long)string, strlen(string));
syscall3(SYS_write, 1, (long)NORMAL, sizeof(NORMAL)-1);
}
// it should be set to W for wumbo
long Wopen(const char *pathname, int flags, int mode){
syscall3(SYS_open, (long)pathname, flags, mode);
}
// named like this to not cause compat issues with glibc
long closeFile(long fd){
syscall2(SYS_close, fd);
}