Add files via upload

This commit is contained in:
Nikhil Tomar
2019-11-18 22:02:17 +05:30
committed by GitHub
parent 5e51e76cdc
commit f09cb14cb2
2 changed files with 51 additions and 0 deletions

44
user/shell/shell.c Normal file
View File

@ -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';
}
}
}

7
user/shell/shell.h Normal file
View File

@ -0,0 +1,7 @@
#ifndef __SHELL_H__
#define __SHELL_H__
void help();
void shell();
#endif