diff options
| author | Miguel <m.i@gmx.at> | 2018-10-18 06:23:26 +0200 |
|---|---|---|
| committer | Miguel <m.i@gmx.at> | 2018-10-18 06:23:26 +0200 |
| commit | e2a6ca9d03a3c0743384f0955609650f2cdce9bb (patch) | |
| tree | 09da82ba6fbb51c9492d05bd94a3d7b044492061 /userspace/xterm/xterm.c | |
| parent | 4d1a149531bc5d672cdf4a5a3e010662f9611d61 (diff) | |
struggling with new syscalls
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]); } } |
