|
|
1.1 root 1: #include "stdio.h"
2: #include "signal.h"
3: #include "lrnref"
4:
5: static int oldout;
6: static char tee[50];
7:
8: maktee()
9: {
10: int fpip[2], in, out;
11:
12: if (tee[0] == 0)
13: sprintf(tee, "%s/tee", direct);
14: pipe(fpip);
15: in = fpip[0];
16: out= fpip[1];
17: if (fork() == 0) {
18: signal(SIGINT, SIG_IGN);
19: close(0);
20: close(out);
21: dup(in);
22: close(in);
23: execl (tee, "lrntee", 0);
24: fprintf(stderr, "Tee exec failed\n");
25: exit(1);
26: }
27: close(in);
28: fflush(stdout);
29: oldout = dup(1);
30: close(1);
31: if (dup(out) != 1)
32: fprintf(stderr, "Error making tee for copyout\n");
33: close(out);
34: return(1);
35: }
36:
37: untee()
38: {
39: int x;
40:
41: fflush(stdout);
42: close(1);
43: dup(oldout);
44: close(oldout);
45: wait(&x);
46: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.