From e2a6ca9d03a3c0743384f0955609650f2cdce9bb Mon Sep 17 00:00:00 2001 From: Miguel Date: Thu, 18 Oct 2018 06:23:26 +0200 Subject: struggling with new syscalls --- userspace/init.c | 4 ++-- userspace/pain2.c | 3 ++- userspace/put_pixel.h | 1 - userspace/xterm/xterm.c | 27 ++++++++++++++++++++++----- 4 files changed, 26 insertions(+), 9 deletions(-) (limited to 'userspace') 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 #include +#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]); } } -- cgit v1.2.3