Added system fetcher and strcpy(string.h)

This commit is contained in:
Cetica Marco
2021-01-03 18:24:55 +01:00
parent 21f017f13c
commit f13837f6f8
8 changed files with 64 additions and 18 deletions

34
kernel/userspace/fetch.c Normal file
View File

@@ -0,0 +1,34 @@
#include "fetch.h"
#include "../libc/stdio.h"
#include "../libc/string.h"
#include "../libc/time.h"
#include "../drivers/tty.h"
void system_fetcher() {
/*uint8_t *logo = (uint8_t*)" \n \
__ __ ___ ___ \n \
\\ \\ / / / _ \\/ __| \n \
\\ V / | (_) \\__ \\ \n \
\\_/ \\___/|___/";*/
uint8_t user[64], hostname[64];
#define STRINGIZE(x) #x
#define STRINGIZE_VALUE_OF(x) STRINGIZE(x)
#ifdef DEFAULT_USER
strcpy(user, (uint8_t*)STRINGIZE_VALUE_OF(DEFAULT_USER));
#else
#error "-DDEFAULT_USER flag not set"
#endif
#ifdef DEFAULT_HOSTNAME
strcpy(hostname, (uint8_t*)STRINGIZE_VALUE_OF(DEFAULT_HOSTNAME));
#else
#error "-DDEFAULT_HOSTNAME flag not set"
#endif
printf_color("\n__ __ ___ ___ ", LIGHT_RED, BLACK);
printf_color((char*)user, LIGHT_CYAN, BLACK);
printf_color("@", LIGHT_RED, BLACK);
printf_color((char*)hostname, LIGHT_CYAN, BLACK);
}