aboutsummaryrefslogtreecommitdiff
path: root/src/userspace/main.c
blob: 62bdc4e2704ba8989fdfcc73dddabb18f306816e (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
27
#include <syscall.h>
#include <mlibc/stdio.h>
#include <mlibc/stdlib.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()
{
    char text[] = "> Successfully switched to usermode!\n";
    printf(text);

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

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