From f09cb14cb2ffb844ca2389e199ef199b555f2f89 Mon Sep 17 00:00:00 2001 From: Nikhil Tomar Date: Mon, 18 Nov 2019 22:02:17 +0530 Subject: [PATCH] Add files via upload --- user/shell/shell.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ user/shell/shell.h | 7 +++++++ 2 files changed, 51 insertions(+) create mode 100644 user/shell/shell.c create mode 100644 user/shell/shell.h diff --git a/user/shell/shell.c b/user/shell/shell.c new file mode 100644 index 0000000..fd33af5 --- /dev/null +++ b/user/shell/shell.c @@ -0,0 +1,44 @@ +#include "shell.h" +#include "../../include/print.h" +#include "../../include/string.h" + +#define NULL 0 +char* cmdline="shell:# "; + +void help(){ + print("Basic Commands:\n"); + print("about\t-\tabout the system\n"); + print("clear\t-\tclear the screen\n"); + print("help\t-\tbasic help\n"); +} + +void shell(){ + char *cmd; + cmd[0]='\n'; + while(1){ + print_color(cmdline, 0xf9); + cmd=(char*)readStr(); + print("\n"); + if(strcmp("\0", cmd)==1){ } + + else if(strcmp("help", cmd)==1){ + help(); + cmd[0]='\n'; + } + + else if(strcmp("clear", cmd)==1){ + clear_(); + cmd[0]='\n'; + } + else if(strcmp("about", cmd)==1){ + print("Maya is an x86 based OS\n"); + cmd[0]='\n'; + } + + else{ + print("command not found\n"); + cmd[0]='\n'; + } +} +} + diff --git a/user/shell/shell.h b/user/shell/shell.h new file mode 100644 index 0000000..13c34e8 --- /dev/null +++ b/user/shell/shell.h @@ -0,0 +1,7 @@ +#ifndef __SHELL_H__ +#define __SHELL_H__ + +void help(); +void shell(); + +#endif