blob: 4680ab8021048c3ee6e0b3d42647a746dfa7bb1d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
extern char**environ;
int main(int argc, char **argv)
{
_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
_close(xterm_in[0]);
_close(xterm_out[1]);
_execve(argv[1],argv,environ); // replace process with our foolshell or whatever
}
_close(xterm_in[0]);
_close(xterm_out[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
terminal_put(tty,buf[0]);
_gui_rect();
}
}
|