mirror of
https://github.com/nikhilroxtomar/Simple-Operating-System-from-Scratch.git
synced 2026-01-14 00:48:50 +00:00
Add files via upload
This commit is contained in:
44
user/shell/shell.c
Normal file
44
user/shell/shell.c
Normal 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
7
user/shell/shell.h
Normal file
@ -0,0 +1,7 @@
|
||||
#ifndef __SHELL_H__
|
||||
#define __SHELL_H__
|
||||
|
||||
void help();
|
||||
void shell();
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user