summaryrefslogtreecommitdiff
path: root/userspace
diff options
context:
space:
mode:
Diffstat (limited to 'userspace')
-rw-r--r--userspace/foolshell.c3
-rw-r--r--userspace/init.c16
2 files changed, 15 insertions, 4 deletions
diff --git a/userspace/foolshell.c b/userspace/foolshell.c
index c5c3b42..38a6e55 100644
--- a/userspace/foolshell.c
+++ b/userspace/foolshell.c
@@ -69,7 +69,8 @@ int main(int argc, char **argv)
//char *buf=malloc(256);
char *buf=calloc(sizeof(char),256);
- printf("setvbuf returned %i\n",setvbuf(stdin,NULL,_IONBF,0));
+// printf("setvbuf returned %i\n",
+ setvbuf(stdin,NULL,_IONBF,0);
while(1)
{
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(&ltime);
+ printf("Current time: %s", ctime(&ltime));
+
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");