diff options
| author | Miguel <m.i@gmx.at> | 2018-10-09 16:21:32 +0200 |
|---|---|---|
| committer | Miguel <m.i@gmx.at> | 2018-10-09 16:21:32 +0200 |
| commit | 63e5017d9863d4ed215782e469e8ee2c6ff8473d (patch) | |
| tree | f12d149ffa34e6a39f4bce4fe9a001e4ca8c6027 /userspace/xterm/xterm.c | |
| parent | a6a11437a390fb7e95fe995214d82bf5dbfe1eaf (diff) | |
fix pipers
Diffstat (limited to 'userspace/xterm/xterm.c')
| -rw-r--r-- | userspace/xterm/xterm.c | 25 |
1 files changed, 9 insertions, 16 deletions
diff --git a/userspace/xterm/xterm.c b/userspace/xterm/xterm.c index 31feea7..4680ab8 100644 --- a/userspace/xterm/xterm.c +++ b/userspace/xterm/xterm.c @@ -1,6 +1,6 @@ -#include <stdio.h> +extern char**environ; -int main() +int main(int argc, char **argv) { _gui_win(); @@ -10,13 +10,11 @@ int main() _pipe(xterm_in); _pipe(xterm_out); - vesa_init(); void *tty=terminal_init_vesa(); int pid=_fork(); - if(!pid) { _close(xterm_in[1]); @@ -26,30 +24,25 @@ int main() _dup2(xterm_out[1],1);// stdout _dup2(xterm_out[1],2);// stderr - while(1); - - char *argv1[]={"/bin/fsh",0}; - char *env1[]={"HOME=/home/miguel","PS1=\033[34m$\033[37m","PWD=/home/miguel","PATH=/bin","TERM=fool-term",0}; + _close(xterm_in[0]); + _close(xterm_out[1]); - while(1); - - _execve("/bin/fsh",argv1,env1); // replace process with our foolshell :) + _execve(argv[1],argv,environ); // replace process with our foolshell or whatever } _close(xterm_in[0]); _close(xterm_out[1]); - _dup2(xterm_in[1],1); // compositor writes here. - - while(1); + _dup2(xterm_in[1],0); // compositor writes here. + _close(xterm_in[1]); while(1) { char buf[1]; + _read(xterm_out[0],buf,1); // show what foolshell writes to its stdout/stderr - _gui_rect(); //lock terminal_put(tty,buf[0]); - _gui_rect(); //unlock + _gui_rect(); } } |
