diff options
| author | Miguel <m.i@gmx.at> | 2018-10-05 23:41:51 +0200 |
|---|---|---|
| committer | Miguel <m.i@gmx.at> | 2018-10-05 23:41:51 +0200 |
| commit | fe8180d88540bfa96595dcc58290de5425e534e3 (patch) | |
| tree | a7a681cdcf013119d121fb17ce3b731763a4a644 /userspace/xterm/xterm.c | |
| parent | 4dbe6a264d7a3bd38ca1ac0921248654a50f1b5e (diff) | |
drunken proggin
Diffstat (limited to 'userspace/xterm/xterm.c')
| -rw-r--r-- | userspace/xterm/xterm.c | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/userspace/xterm/xterm.c b/userspace/xterm/xterm.c index 10b222c..96389a9 100644 --- a/userspace/xterm/xterm.c +++ b/userspace/xterm/xterm.c @@ -1,2 +1,48 @@ #include <stdio.h> +int main() +{ + _gui_win(); + + int xterm_in[2]; + int xterm_out[2]; + + _pipe(xterm_in); + _pipe(xterm_out); + + + vesa_init(); + void *tty=terminal_init_vesa(); + + int pid=_fork(); + + if(!pid) + { + _close(xterm_in[1]); + _close(xterm_out[0]); + + _dup2(xterm_in[0],0);// stdin + _dup2(xterm_out[1],1);// stdout + _dup2(xterm_out[1],2);// stderr + + char *argv1[]={"/bin/fsh",0}; + char *env1[]={"HOME=/home/miguel","PS1=\033[34m$\033[37m","PWD=/home/miguel","PATH=/bin","TERM=fool-term",0}; + + _execve("/bin/fsh",argv1,env1); // replace process with our foolshell :) + } + + _close(xterm_in[0]); + _close(xterm_out[1]); + + _dup2(xterm_in[1],1); // compositor writes here. + + 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 + } +} |
