matos/userspace/main_user.c
2021-11-06 00:13:40 +01:00

51 lines
1.1 KiB
C

#include "libc.h"
int func_yolo()
{
yolo();
return 0;
}
int func_help()
{
printf("\nAvailable Commands:\n");
printf(" yolo\n");
printf(" suicide\n");
printf(" help\n");
return 0;
}
int func_suicide()
{
printf("User is about to suicide\n");
int *yolo = 0;
*yolo = 1;
return 0;
}
int main(int argc, char *argv[])
{
(void)argc;
(void)argv;
char buf[64];
printf("Shell staring. type \"help\" for help\n");
while (1) {
printf(">");
if (readline(buf, sizeof(buf)))
continue;
if (strcmp(buf, "yolo") == 0) {
func_yolo();
continue;
}
if (strcmp(buf, "help") == 0) {
func_help();
continue;
}
if (strcmp(buf, "suicide") == 0) {
func_suicide();
continue;
}
}
return 0;
}