diff options
| author | Miguel <m.i@gmx.at> | 2018-09-02 00:08:42 +0200 |
|---|---|---|
| committer | Miguel <m.i@gmx.at> | 2018-09-02 00:08:42 +0200 |
| commit | 8e3411139b27a3421e9ac75c13f14f99f6dd3137 (patch) | |
| tree | cf8b53ab02863117c310bde11ee4683e134cf1b2 /userspace/init.c | |
| parent | 0fff2e6dc6fae82da1c7978918a490c25cc36f04 (diff) | |
syscalls
Diffstat (limited to 'userspace/init.c')
| -rw-r--r-- | userspace/init.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/userspace/init.c b/userspace/init.c index 7474b11..6484b78 100644 --- a/userspace/init.c +++ b/userspace/init.c @@ -1,7 +1,16 @@ #include <stdio.h> +#include <time.h> + int main(int argc, char **argv) { + char *argv1[]={"/bin/foolshell",0}; + char *env1[]={"PS1=\033[34m$\033[37m","PWD=/home/miguel","PATH=/bin","TERM=fool-term",0}; + + time_t ltime; + time(<ime); + printf("Current time: %s", ctime(<ime)); + printf("fool-init: spawning a Fool's Shell\n"); //while(1)printf("x"); @@ -11,13 +20,12 @@ int main(int argc, char **argv) { int pid=_fork(); + printf("fool-init: pid: %i\n",pid); 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",argv1,env1); // 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 @@ -25,7 +33,9 @@ int main(int argc, char **argv) // wait until our child process state changes (exits) // and respawn SHELL + while(1); _wait(&status); + printf("fool-init: catched exit of process %d.\n",pid); printf("fool-init: respawning a Fools Shell\n"); |
