1: /*
   2: 
   3: 	nettest.c
   4: 
   5: 	fire up two daemons with pipes in between them
   6: */
   7: # include "defs.h"
   8: 
   9: # define NETD "netdaemon"
  10: 
  11: main(argc,argv)
  12:   char **argv; {
  13:     int pip1[2],pip2[2];
  14:     char b1[20],b2[20],b3[20];
  15:     char *margv[30];
  16:     int i;
  17:     debugflg = 1;
  18:     for(i =0; i < argc; i++)margv[i] = argv[i];
  19:     pipe(pip1);
  20:     pipe(pip2);
  21:     if(fork()){
  22:         /* read pip1[0], write pip2[1] */
  23:         close(pip1[1]); close(pip2[0]);
  24:         sprintf(b1,"-r%d",pip1[0]);
  25:         sprintf(b2,"-w%d",pip2[1]);
  26:         margv[i++] = b1;
  27:         margv[i++] = b2;
  28:         margv[i++] = "-mr";
  29:         margv[i] = 0;
  30:         mexecv(NETD,margv);
  31:         }
  32:     /* read pip2[0], write pip1[1] */
  33:     close(pip2[1]); close(pip1[0]);
  34:     sleep(5);
  35:     sprintf(b1,"-r%d",pip2[0]);
  36:     sprintf(b2,"-w%d",pip1[1]);
  37:     margv[i++] = b1;
  38:     margv[i++] = b2;
  39:     margv[i++] = "-mv";
  40:     margv[i] = 0;
  41:     mexecv(NETD,margv);
  42:     }

Defined functions

main defined in line 11; never used

Defined macros

NETD defined in line 9; used 2 times
Last modified: 1980-07-16
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 653
Valid CSS Valid XHTML 1.0 Strict