xref: /original-bsd/old/berknet/listen.c (revision 4d1ce0b0)
1 static char sccsid[] = "@(#)listen.c	4.1	(Berkeley)	10/02/82";
2 
3 /*
4 	listen.c
5 
6 	listen for a packet from the program interact.c and print it
7 */
8 # include "defs.h"
9 main(argc,argv)
10 	  char **argv;
11 {
12 	struct packet *pp;
13 	char buf[BUFSIZ];
14 	setupdaemon(argc,argv);
15 	initseqno();
16 	putchar('!');
17 	fflush(stdout);
18 	for(;;){
19 		pp = getpacket();
20 		printpacket(pp,buf);
21 		printf("got %s\n",buf);
22 		if(pp == NULL )continue;
23 		pp->pcode = ACK;
24 		pp->len = 0;
25 		sendpacket(pp);
26 		printpacket(pp,buf);
27 		printf("sent %s\n",buf);
28 	}
29 }
30