goal is to get this to work when its ran/called
This commit is contained in:
parent
124daeaa07
commit
159ad1c789
39
shell.c
Normal file
39
shell.c
Normal file
@ -0,0 +1,39 @@
|
||||
// NOTE: we shouldn't have to worry about scrolling so the library/kernel
|
||||
// should do this for us
|
||||
// Oh yes
|
||||
#include "stlio.h"
|
||||
#include "types.h"
|
||||
|
||||
#define bsize 101
|
||||
|
||||
#define banner0 "_______ _______ _________"
|
||||
#define banner1 "\\ _ \\____________ ____ ____ ____ \\ _ \\ / _____/"
|
||||
#define banner2 "/ /_\\ \\_ __ \\__ \\ / \\ / ___\\_/ __ \\/ /_\\ \\ \\_____ \\ "
|
||||
#define banner3 "\\ \\_/ \\ | \\// __ \\| | \\/ /_/ > ___/\\ \\_/ \\/ \\"
|
||||
#define banner4 " \\_____ /__| (____ /___| /\\___ / \\___ >\\_____ /_______ /"
|
||||
#define banner5 " \\/ \\/ \\//_____/ \\/ \\/ \\/ "
|
||||
|
||||
void smain(void) {
|
||||
// print out a nice banner on start
|
||||
printf(banner0);
|
||||
printf(banner1);
|
||||
printf(banner2);
|
||||
printf(banner3);
|
||||
printf(banner4);
|
||||
printf(banner5);
|
||||
|
||||
char buffer[bsize];
|
||||
while(1) {
|
||||
// read into buffer bsize bytes, if we reach bsize then we just keep replacing that character
|
||||
// keep in mind however that backspace will take us back as well
|
||||
u32 bytes = read(buffer, bsize); // reeads n - 1 characters as the last one is always null
|
||||
// now we process options
|
||||
if(strcmp(buffer, "quit") == 0) {
|
||||
break;
|
||||
}
|
||||
// generate a random number on the screen for now
|
||||
if(strcmp(buffer, "rand") == 0) {
|
||||
printHex(random32(5000));
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user