summaryrefslogtreecommitdiff
path: root/userspace
diff options
context:
space:
mode:
Diffstat (limited to 'userspace')
-rw-r--r--userspace/Makefile1
-rw-r--r--userspace/init.c14
-rw-r--r--userspace/xterm/Makefile5
-rw-r--r--userspace/xterm/xterm.c24
4 files changed, 17 insertions, 27 deletions
diff --git a/userspace/Makefile b/userspace/Makefile
index 860478a..8d9cf8e 100644
--- a/userspace/Makefile
+++ b/userspace/Makefile
@@ -67,6 +67,7 @@ ext2.img: $(PROGS)
#@cp /home/miguel/git/EXT/vim/runtime/ftplugin mnt/usr/share/vim/ -r
@cp fonts/*.bin mnt/doc/fonts
@cp xterm/xterm mnt/bin
+ @cp xterm/rect mnt/bin
@cp cpp/testcpp mnt/bin
@cp ncurses/nc mnt/bin
@cp pain/pain1 mnt/bin
diff --git a/userspace/init.c b/userspace/init.c
index f9a4e78..255b274 100644
--- a/userspace/init.c
+++ b/userspace/init.c
@@ -4,16 +4,18 @@
*
* */
-char *env1[]={"HOME=/home/miguel","PS1=\033[34m$\033[37m","PWD=/home/miguel","PATH=/bin","TERM=fool-term",0};
-char *argv2[]={"pain2",0};
+static char *env1[]={"HOME=/home/miguel","PS1=\033[34m$\033[37m","PWD=/home/miguel","PATH=/bin","TERM=fool-term",0};
+static char *argv1[]={"xterm","/bin/fsh",0};
-#define LAUNCH_COUNT 1
+/*
+#define LAUNCH_COUNT 3
char *argv1[][4]={
{"/bin/xterm","xterm","/bin/fsh",0},
{"/bin/xterm","xterm","/bin/fsh",0},
{"/bin/xterm","xterm","/bin/fsh",0},
};
+*/
void fork_and_exec(char **argv)
{
@@ -22,17 +24,17 @@ void fork_and_exec(char **argv)
if(!pid) //child
{
execve(argv[0],&argv[1],env1);
- while(1);//hopefully never reached
}
}
int main(int argc, char **argv)
{
+ execve("/bin/xterm",argv1,env1);
+ /*
for(int i=0;i<LAUNCH_COUNT;i++)
{
fork_and_exec(argv1[i]);
}
-
wait(999);/// TODO: here we should wait for commnads to spawn new processes?
-
+ */
}
diff --git a/userspace/xterm/Makefile b/userspace/xterm/Makefile
index fdec016..dff4c46 100644
--- a/userspace/xterm/Makefile
+++ b/userspace/xterm/Makefile
@@ -2,7 +2,10 @@ CC=i686-foolos-gcc
CFLAGS = -ggdb -O0 # best gdb debugging experience
+
+all: xterm rect
xterm: vesa.o terminal.o
+rect: vesa.o
clean:
- rm -f *.o xterm
+ rm -f *.o xterm rect
diff --git a/userspace/xterm/xterm.c b/userspace/xterm/xterm.c
index a4325c7..90b2fe0 100644
--- a/userspace/xterm/xterm.c
+++ b/userspace/xterm/xterm.c
@@ -30,19 +30,6 @@ int main(int argc, char **argv)
if(!pid) // child
{
- // we need a window
- _gui_win();
- //srand(time(NULL)); // Initialization, should only be called once.
- while(1)
- {
- int x = rand()%600;
- int y = rand()%300;
- int width=10;
- int height=10;
- int col = rand()% 0x00ffff;
- put_rect( x, y, width,height,col);
- _gui_inval((x<<16)|(y),(width<<16)|height);
- }
//_close(xterm_in[1]);
close(xterm_out[0]);
@@ -54,9 +41,11 @@ int main(int argc, char **argv)
if(argc==1)_execve(argv1[1],argv1,environ);
execve(argv[1],argv,environ);
- printf("unable to execve %s",argv[1]); // never reached
+ printf("unable to execve %s",argv[1]); // never reached hopefully
+ while(1);
}
else{
+ // TODO quit if execve fails or child exits...
//_close(xterm_in[0]);
close(xterm_out[1]);
@@ -64,15 +53,10 @@ int main(int argc, char **argv)
//_dup2(xterm_in[1],0); // compositor writes here.
//_close(xterm_in[1]);
- // TODO quit if execve fails or child exits...
- terminal_put(tty,'X');
- terminal_put(tty,'X');
- terminal_put(tty,'X');
while(1)
{
char buf[1];
- //read(xterm_out[0],buf,1); // show what foolshell writes to its stdout/stderr
- read(tty_fd,buf,1); // show what foolshell writes to its stdout/stderr
+ read(xterm_out[0],buf,1); // show what foolshell writes to its stdout/stderr
terminal_put(tty,buf[0]);
}
}