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: }

Defined functions

maktee defined in line 8; used 1 times
untee defined in line 37; used 1 times

Defined variables

oldout defined in line 5; used 3 times
tee defined in line 6; used 3 times
Last modified: 1981-07-10
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 759
Valid CSS Valid XHTML 1.0 Strict