xref: /original-bsd/usr.bin/learn/learn/list.c (revision c3e32dec)
1 /*-
2  * Copyright (c) 1986, 1993
3  *	The Regents of the University of California.  All rights reserved.
4  *
5  * %sccs.include.proprietary.c%
6  */
7 
8 #ifndef lint
9 static char sccsid[] = "@(#)list.c	8.1 (Berkeley) 06/06/93";
10 #endif /* not lint */
11 
12 #include "stdio.h"
13 #include "lrnref.h"
14 #include "signal.h"
15 
16 int istop;
17 
18 list(r)
19 char *r;
20 {
21 	void stop(), intrpt();
22 	FILE *ft;
23 	char s[100];
24 
25 	if (r==0)
26 		return;
27 	istop = 1;
28 	signal(SIGINT, stop);
29 	ft = fopen(r, "r");
30 	if (ft != NULL) {
31 		while (fgets(s, 100, ft) && istop)
32 			fputs(s, stdout);
33 		fclose(ft);
34 	}
35 	signal(SIGINT, intrpt);
36 }
37 
38 void
39 stop()
40 {
41 	istop=0;
42 }
43