Compare commits

..

No commits in common. "b8b8f58fee398eb33d6c3a5589535e6532c10ca9" and "146e7f65ca5e0076fac2560c02062bfb805a3144" have entirely different histories.

2 changed files with 14 additions and 31 deletions

View file

@ -1,25 +0,0 @@
unsigned char banner[] = {
0x0a, 0x20, 0x20, 0xe2, 0x96, 0x88, 0xe2, 0x96, 0x88, 0xe2, 0x95, 0x97, 0x20, 0x20, 0xe2, 0x96, 0x88, 0xe2, 0x96,
0x88, 0xe2, 0x95, 0x97, 0xe2, 0x96, 0x88, 0xe2, 0x96, 0x88, 0xe2, 0x95, 0x97, 0x20, 0x20, 0x20, 0xe2, 0x96, 0x88,
0xe2, 0x96, 0x88, 0xe2, 0x95, 0x97, 0x20, 0xe2, 0x96, 0x88, 0xe2, 0x96, 0x88, 0xe2, 0x96, 0x88, 0xe2, 0x96, 0x88,
0xe2, 0x96, 0x88, 0xe2, 0x96, 0x88, 0xe2, 0x95, 0x97, 0x0a, 0x20, 0x20, 0xe2, 0x95, 0x9a, 0xe2, 0x96, 0x88, 0xe2,
0x96, 0x88, 0xe2, 0x95, 0x97, 0xe2, 0x96, 0x88, 0xe2, 0x96, 0x88, 0xe2, 0x95, 0x94, 0xe2, 0x95, 0x9d, 0xe2, 0x96,
0x88, 0xe2, 0x96, 0x88, 0xe2, 0x95, 0x91, 0x20, 0x20, 0x20, 0xe2, 0x96, 0x88, 0xe2, 0x96, 0x88, 0xe2, 0x95, 0x91,
0xe2, 0x96, 0x88, 0xe2, 0x96, 0x88, 0xe2, 0x95, 0x94, 0xe2, 0x95, 0x90, 0xe2, 0x95, 0x90, 0xe2, 0x95, 0x90, 0xe2,
0x95, 0x90, 0xe2, 0x95, 0x9d, 0x0a, 0x20, 0x20, 0x20, 0xe2, 0x95, 0x9a, 0xe2, 0x96, 0x88, 0xe2, 0x96, 0x88, 0xe2,
0x96, 0x88, 0xe2, 0x95, 0x94, 0xe2, 0x95, 0x9d, 0x20, 0xe2, 0x96, 0x88, 0xe2, 0x96, 0x88, 0xe2, 0x95, 0x91, 0x20,
0x20, 0x20, 0xe2, 0x96, 0x88, 0xe2, 0x96, 0x88, 0xe2, 0x95, 0x91, 0xe2, 0x96, 0x88, 0xe2, 0x96, 0x88, 0xe2, 0x96,
0x88, 0xe2, 0x96, 0x88, 0xe2, 0x96, 0x88, 0xe2, 0x96, 0x88, 0xe2, 0x96, 0x88, 0xe2, 0x95, 0x97, 0x0a, 0x20, 0x20,
0x20, 0xe2, 0x96, 0x88, 0xe2, 0x96, 0x88, 0xe2, 0x95, 0x94, 0xe2, 0x96, 0x88, 0xe2, 0x96, 0x88, 0xe2, 0x95, 0x97,
0x20, 0xe2, 0x95, 0x9a, 0xe2, 0x96, 0x88, 0xe2, 0x96, 0x88, 0xe2, 0x95, 0x97, 0x20, 0xe2, 0x96, 0x88, 0xe2, 0x96,
0x88, 0xe2, 0x95, 0x94, 0xe2, 0x95, 0x9d, 0xe2, 0x96, 0x88, 0xe2, 0x96, 0x88, 0xe2, 0x95, 0x94, 0xe2, 0x95, 0x90,
0xe2, 0x95, 0x90, 0xe2, 0x95, 0x90, 0xe2, 0x96, 0x88, 0xe2, 0x96, 0x88, 0xe2, 0x95, 0x97, 0x0a, 0x20, 0x20, 0xe2,
0x96, 0x88, 0xe2, 0x96, 0x88, 0xe2, 0x95, 0x94, 0xe2, 0x95, 0x9d, 0x20, 0xe2, 0x96, 0x88, 0xe2, 0x96, 0x88, 0xe2,
0x95, 0x97, 0x20, 0xe2, 0x95, 0x9a, 0xe2, 0x96, 0x88, 0xe2, 0x96, 0x88, 0xe2, 0x96, 0x88, 0xe2, 0x96, 0x88, 0xe2,
0x95, 0x94, 0xe2, 0x95, 0x9d, 0x20, 0xe2, 0x95, 0x9a, 0xe2, 0x96, 0x88, 0xe2, 0x96, 0x88, 0xe2, 0x96, 0x88, 0xe2,
0x96, 0x88, 0xe2, 0x96, 0x88, 0xe2, 0x96, 0x88, 0xe2, 0x95, 0x94, 0xe2, 0x95, 0x9d, 0x0a, 0x20, 0x20, 0xe2, 0x95,
0x9a, 0xe2, 0x95, 0x90, 0xe2, 0x95, 0x9d, 0x20, 0x20, 0xe2, 0x95, 0x9a, 0xe2, 0x95, 0x90, 0xe2, 0x95, 0x9d, 0x20,
0x20, 0xe2, 0x95, 0x9a, 0xe2, 0x95, 0x90, 0xe2, 0x95, 0x90, 0xe2, 0x95, 0x90, 0xe2, 0x95, 0x9d, 0x20, 0x20, 0x20,
0xe2, 0x95, 0x9a, 0xe2, 0x95, 0x90, 0xe2, 0x95, 0x90, 0xe2, 0x95, 0x90, 0xe2, 0x95, 0x90, 0xe2, 0x95, 0x90, 0xe2,
0x95, 0x9d, 0x0a, 0x0a, 0x00,
};

View file

@ -8,10 +8,21 @@
#include "kernel/file.h" #include "kernel/file.h"
#include "user/user.h" #include "user/user.h"
#include "kernel/fcntl.h" #include "kernel/fcntl.h"
#include "user/banner.h"
char *argv[] = { "sh", 0 }; char *argv[] = { "sh", 0 };
// clang-format off
const char *banner =
"\n $$\\ $$\\ $$$$$$\\\n"
" $$ | $$ | $$ __$$\\ \n"
" \\$$\\ $$ |$$\\ $$\\ $$ / \\__|\n"
" \\$$$$ / \\$$\\ $$ |$$$$$$$\\ \n"
" $$ $$< \\$$\\$$ / $$ __$$\\ \n"
" $$ /\\$$\\ \\$$$ / $$ / $$ |\n"
" $$ / $$ | \\$ / $$$$$$ |\n"
" \\__| \\__| \\_/ \\______/\n\n";
// clang-format on
int int
main(void) main(void)
{ {
@ -26,8 +37,7 @@ main(void)
for(;;) { for(;;) {
printf("init: starting sh\n"); printf("init: starting sh\n");
// printf(banner); printf(banner);
printf((const char *)banner);
pid = fork(); pid = fork();
if(pid < 0) { if(pid < 0) {
printf("init: fork failed\n"); printf("init: fork failed\n");
@ -44,9 +54,7 @@ main(void)
// or if a parentless process exits. // or if a parentless process exits.
wpid = wait((int *)0); wpid = wait((int *)0);
if(wpid == pid) { if(wpid == pid) {
// FIXME: Obviously not how things should be done // the shell exited; restart it.
printf("\nShell exited... Halting\n");
halt();
break; break;
} else if(wpid < 0) { } else if(wpid < 0) {
printf("init: wait returned an error\n"); printf("init: wait returned an error\n");