summaryrefslogtreecommitdiff
path: root/userspace
diff options
context:
space:
mode:
Diffstat (limited to 'userspace')
-rw-r--r--userspace/foolshell.c28
-rw-r--r--userspace/init.c17
2 files changed, 25 insertions, 20 deletions
diff --git a/userspace/foolshell.c b/userspace/foolshell.c
index e010c18..78ba327 100644
--- a/userspace/foolshell.c
+++ b/userspace/foolshell.c
@@ -16,12 +16,12 @@ void hello()
" / __/ / /_/ / /_/ / / / /_/ /___/ / \n"
" /_/ \\____/\\____/_/ \\____//____/ \n"
" \n"
- "Welcome to FoolShell v0.4 (Compiled on " __DATE__ " at " __TIME__ "\n"
+ "Welcome to FoolShell v0.5 (Compiled on " __DATE__ " at " __TIME__ "\n"
"------------------------------------------------------------------\n\n"
"Please type 'help' anytime, to show shell \"built-ins\" or execute \n"
"user programms that are in you $PATH directory by simply typing \n"
"their filenames. You can get additional information for many commands\n"
- "by invking them with the --help or -h flag (e.g. ls --help) \n"
+ "by invoking them with the --help or -h flag (e.g. ls --help) \n"
);
printf("Your $PATH is currently set to: %s\n\n",getenv("PATH"));
@@ -211,20 +211,16 @@ int process(char *buf)
}
else
{
- char buf[256];
- sprintf(buf,"%s/%s",getenv("PATH"),token[0]);
-
- asm("mov $0x05bff,%esp"); // set stack pointer
- execve(buf,token,environ);
- asm("mov $0x07000,%esp"); // set stack pointer
-
- puts("foolshell: command not found");
-
- asm("mov $0x05bff,%esp"); // set stack pointer
- static char *argv[]={"shell","--silent",NULL};
- execve("/bin/foolshell",argv,environ); // start shell
-
-
+ int pid=fork();
+ if(pid!=0)
+ {
+ printf("new task pid: %i \n",pid);
+ char buf[256];
+ sprintf(buf,"%s/%s",getenv("PATH"),token[0]);
+ execve(buf,token,environ);
+ puts("foolshell: command not found");
+ exit(1);
+ }
}
return 0;
diff --git a/userspace/init.c b/userspace/init.c
index d03d173..fd562a9 100644
--- a/userspace/init.c
+++ b/userspace/init.c
@@ -1,12 +1,21 @@
int main(int argc, char **argv)
{
- printf("Fool OS Init 0.1 \n");
-
int pid=fork();
- while(1)
+ if(pid!=0)
{
- printf("I am pid: %i\n",pid);
+ printf("fool-init: forked child (pid: %i) spawning a Fools Shell\n",pid);
+ execve("/bin/foolshell",0,0);
+
+ }
+ else
+ {
+ // TODO: wait for child and respawn shell if needed!
+ volatile int i=0;
+ while(1)
+ {
+
+ }
}
return 0;
}