aboutsummaryrefslogtreecommitdiff
path: root/src/userspace/main.c
blob: 982a5ff182dcd8ed2be46010e1b244a5a0ab1848 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include <syscall.h>
#include <mlibc/stdio.h>
#include <mlibc/string.h>

int32_t starts_with(const char *a, const char *b)
{
    size_t length_pre = strlen(b);
    size_t length_main = strlen(a);
    return length_main < length_pre ? 0 : memcmp(b, a, length_pre) == 0;
}

void user_main()
{
    printf("> Successfully switched to usermode!");

    // init_framebuffer();
    writec((char) strlen("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"));

    while (1) {
        char *input = readline();
        if (starts_with(input, "ls")) {
            char test[] = "WOOOHOOO\n";
            syscall_write(test);
        }
    };
}