home *** CD-ROM | disk | FTP | other *** search
/ minnie.tuhs.org / unixen.tar / unixen / PDP-11 / Distributions / ucb / spencer_2bsd.tar.gz / 2bsd.tar / src / net / nettest.c < prev    next >
C/C++ Source or Header  |  1980-02-17  |  689b  |  28 lines

  1. /* Copyright (c) 1979 Regents of the University of California */
  2. # include <stdio.h>
  3. # include "mach.h"
  4. # include "Paths.h"
  5.  
  6. main(argc,argv)
  7.   char **argv; {
  8.     int pip1[2],pip2[2];
  9.     char b1[20],b2[20];
  10.     char *command1,*command2;
  11.     command1 = argc > 1 ? argv[1] : NETDAEMON;
  12.     command2 = argc > 2 ? argv[2] : NETDAEMON;
  13.     pipe(pip1);
  14.     pipe(pip2);
  15.     if(fork()){
  16.         /* read pip1[0], write pip2[1] */
  17.         close(pip1[1]); close(pip2[0]);
  18.         sprintf(b1,"%d",pip1[0]);
  19.         sprintf(b2,"%d",pip2[1]);
  20.         execl(command1,command1,"y",b1,b2,0);
  21.         }
  22.     /* read pip2[0], write pip1[1] */
  23.     close(pip2[1]); close(pip1[0]);
  24.     sprintf(b1,"%d",pip2[0]);
  25.     sprintf(b2,"%d",pip1[1]);
  26.     execl(command2,command2,"v",b1,b2,0);
  27.     }
  28.