1: # include "refer..c"
   2: corout(in, out, rprog, arg, outlen)
   3:     char *in, *out, *rprog;
   4: {
   5: # define move(x, y) close(y); dup(x); close(x);
   6: int pipev[2], fr1, fr2, fw1, fw2, n;
   7: 
   8: pipe (pipev); fr1= pipev[0]; fw1 = pipev[1];
   9: pipe (pipev); fr2= pipev[0]; fw2 = pipev[1];
  10: if (fork()==0)
  11:     {
  12:     close (fw1); close (fr2);
  13:     move (fr1, 0);
  14:     move (fw2, 1);
  15:     execl(rprog, "deliv", arg, 0);
  16:     err ("Can't run %s", rprog);
  17:     }
  18: close(fw2); close(fr1);
  19: write (fw1, in , strlen(in));
  20: close(fw1);
  21: wait(0);
  22: n = read (fr2, out, outlen);
  23: out[n]=0;
  24: close(fr2);
  25: return(n);
  26: }

Defined functions

Defined macros

move defined in line 5; used 2 times
Last modified: 1981-07-10
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 669
Valid CSS Valid XHTML 1.0 Strict