diff options
Diffstat (limited to 'userspace/xterm/xterm.c')
| -rw-r--r-- | userspace/xterm/xterm.c | 27 |
1 files changed, 22 insertions, 5 deletions
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]); } } |
