diff options
Diffstat (limited to 'userspace')
| -rw-r--r-- | userspace/init.c | 4 | ||||
| -rw-r--r-- | userspace/pain2.c | 3 | ||||
| -rw-r--r-- | userspace/put_pixel.h | 1 | ||||
| -rw-r--r-- | userspace/xterm/xterm.c | 27 |
4 files changed, 26 insertions, 9 deletions
diff --git a/userspace/init.c b/userspace/init.c index dc21678..f9a4e78 100644 --- a/userspace/init.c +++ b/userspace/init.c @@ -5,8 +5,9 @@ * */ char *env1[]={"HOME=/home/miguel","PS1=\033[34m$\033[37m","PWD=/home/miguel","PATH=/bin","TERM=fool-term",0}; +char *argv2[]={"pain2",0}; -#define LAUNCH_COUNT 3 +#define LAUNCH_COUNT 1 char *argv1[][4]={ {"/bin/xterm","xterm","/bin/fsh",0}, @@ -27,7 +28,6 @@ void fork_and_exec(char **argv) int main(int argc, char **argv) { - for(int i=0;i<LAUNCH_COUNT;i++) { fork_and_exec(argv1[i]); diff --git a/userspace/pain2.c b/userspace/pain2.c index 68ca715..3c62463 100644 --- a/userspace/pain2.c +++ b/userspace/pain2.c @@ -24,6 +24,7 @@ void doscolor(int color,int color2) int main(int argc,char **argv) { + _gui_win(); for(int i=0;i<2000;i++) @@ -43,6 +44,6 @@ int main(int argc,char **argv) } } - return EXIT_SUCCESS; + return 0; } diff --git a/userspace/put_pixel.h b/userspace/put_pixel.h index 563a7e8..4b45e83 100644 --- a/userspace/put_pixel.h +++ b/userspace/put_pixel.h @@ -29,7 +29,6 @@ void put_rect(int x,int y, int w, int h,uint32_t col) pix++; } pix+=640-w; - } } diff --git a/userspace/xterm/xterm.c b/userspace/xterm/xterm.c index 5540ac9..a4325c7 100644 --- a/userspace/xterm/xterm.c +++ b/userspace/xterm/xterm.c @@ -1,5 +1,6 @@ #include <stdlib.h> #include <stdio.h> +#include "../put_pixel.h" extern char**environ; @@ -23,12 +24,25 @@ int main(int argc, char **argv) //_pipe(xterm_in); pipe(xterm_out); - int pid=fork(); + int tty_fd=_open("/dev/tty"); + + int pid=fork(); if(!pid) // child { - int tty_fd=_open("/dev/tty"); - + // 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]); @@ -51,11 +65,14 @@ int main(int argc, char **argv) //_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(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 terminal_put(tty,buf[0]); } } |
