xref: /original-bsd/usr.bin/learn/learn/list.c (revision 7f22226e)
1 #ifndef lint
2 static char sccsid[] = "@(#)list.c	4.3	(Berkeley)	03/01/91";
3 #endif not lint
4 
5 #include "stdio.h"
6 #include "lrnref.h"
7 #include "signal.h"
8 
9 int istop;
10 
11 list(r)
12 char *r;
13 {
14 	void stop(), intrpt();
15 	FILE *ft;
16 	char s[100];
17 
18 	if (r==0)
19 		return;
20 	istop = 1;
21 	signal(SIGINT, stop);
22 	ft = fopen(r, "r");
23 	if (ft != NULL) {
24 		while (fgets(s, 100, ft) && istop)
25 			fputs(s, stdout);
26 		fclose(ft);
27 	}
28 	signal(SIGINT, intrpt);
29 }
30 
31 void
32 stop()
33 {
34 	istop=0;
35 }
36