summaryrefslogtreecommitdiff
path: root/userspace/init.c
diff options
context:
space:
mode:
authorMiguel <m.i@gmx.at>2018-08-17 02:28:02 +0200
committerMiguel <m.i@gmx.at>2018-08-17 02:28:02 +0200
commitc742be9c738c91703a7be787639cad167de3a6b1 (patch)
treedb0e170dab1b7f34630489d0cb1d396c92f15c79 /userspace/init.c
parent559eea53ecdd1e3e45f24d15e8739419b0cd647a (diff)
started reviving my fool os
Diffstat (limited to 'userspace/init.c')
-rw-r--r--userspace/init.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/userspace/init.c b/userspace/init.c
index 31f14e3..e984d30 100644
--- a/userspace/init.c
+++ b/userspace/init.c
@@ -1,35 +1,34 @@
+#include <stdio.h>
+
int main(int argc, char **argv)
{
-
printf("fool-init: spawning a Fool's Shell\n");
// loop forever and spawn shells if the top-shell exits
while(1)
{
- int pid=fork();
+ int pid=_fork();
int status;
if(pid==0)
{
char *argv[]={"/bin/foolshell",0};
char *env[]={"PS1=\033[34m$\033[37m","PWD=/home/miguel","PATH=/bin","TERM=fool-term",0};
- execve("/bin/foolshell",argv,env); // replace process with our foolshell :)
+ _execve("/bin/foolshell",argv,env); // replace process with our foolshell :)
//execve("/bin/clear",argv,env); // replace process with our foolshell :)
puts("FATAL ERROR: Something terrible happened. Unable to Execute SHELL!");
while(1);// hang
-
}
// wait until our child process state changes (exits)
// and respawn SHELL
- wait(&status);
+ _wait(&status);
printf("fool-init: catched exit of process %d.\n",pid);
printf("fool-init: respawning a Fools Shell\n");
}
+
return 0;
}
-
-