1: #ifndef lint
   2: static char *sccsid = "@(#)refer3.c	4.2 (Berkeley) 8/26/85";
   3: #endif
   4: 
   5: #include "refer..c"
   6: #define move(x, y) close(y); dup(x); close(x);
   7: 
   8: corout(in, out, rprog, arg, outlen)
   9: char *in, *out, *rprog;
  10: {
  11:     int pipev[2], fr1, fr2, fw1, fw2, n;
  12:     int status;
  13: 
  14:     pipe(pipev);
  15:     fr1 = pipev[0];
  16:     fw1 = pipev[1];
  17:     pipe(pipev);
  18:     fr2 = pipev[0];
  19:     fw2 = pipev[1];
  20:     if (fork() == 0)
  21:     {
  22:         close(fw1);
  23:         close(fr2);
  24:         move(fr1, 0);
  25:         move(fw2, 1);
  26:         execl(rprog, "deliv", arg, 0);
  27:         err("Can't run %s", rprog);
  28:     }
  29:     close(fw2);
  30:     close(fr1);
  31:     write(fw1, in , strlen(in));
  32:     close(fw1);
  33:     wait(&status);
  34:     n = read(fr2, out, outlen);
  35:     out[n] = 0;
  36:     close(fr2);
  37:     return(n);
  38: }

Defined functions

Defined variables

sccsid defined in line 2; never used

Defined macros

move defined in line 6; used 2 times
Last modified: 1987-02-17
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 870
Valid CSS Valid XHTML 1.0 Strict