date and time created 88/12/12 20:32:14 by kfall
[unix-history] / usr / src / old / berknet / nettest.c
CommitLineData
5934c60a
KM
1static char sccsid[] = "@(#)nettest.c 4.1 (Berkeley) %G%";
2
3/*
4
5 nettest.c
6
7 fire up two daemons with pipes in between them
8 currently, one is the "r" machine, the other the "v" machine
9*/
10# include "defs.h"
11
12# define NETD "/usr/net/bin/netdaemon"
13
14main(argc,argv)
15 char **argv; {
16 int pip1[2],pip2[2];
17 char b1[20],b2[20],b3[20];
18 char *margv[30];
19 int i;
20 debugflg = 1;
21 for(i =0; i < argc; i++)margv[i] = argv[i];
22 pipe(pip1);
23 pipe(pip2);
24 if(fork()){
25 /* read pip1[0], write pip2[1] */
26 close(pip1[1]); close(pip2[0]);
27 sprintf(b1,"-r%d",pip1[0]);
28 sprintf(b2,"-w%d",pip2[1]);
29 margv[i++] = b1;
30 margv[i++] = b2;
31 margv[i++] = "-mr";
32 margv[i] = 0;
33 mexecv(NETD,margv);
34 }
35 /* read pip2[0], write pip1[1] */
36 close(pip2[1]); close(pip1[0]);
37 sleep(5);
38 sprintf(b1,"-r%d",pip2[0]);
39 sprintf(b2,"-w%d",pip1[1]);
40 margv[i++] = b1;
41 margv[i++] = b2;
42 margv[i++] = "-mv";
43 margv[i] = 0;
44 mexecv(NETD,margv);
45 }