xref: /original-bsd/old/refer/refer/refer8.c (revision 963f8367)
1 /*-
2  * %sccs.include.proprietary.c%
3  */
4 
5 #ifndef lint
6 static char sccsid[] = "@(#)refer8.c	4.2 (Berkeley) 04/18/91";
7 #endif /* not lint */
8 
9 #include "refer..c"
10 
11 static char ahead[1024];
12 static int peeked = 0;
13 static char *noteof = (char *) 1;
14 
15 char *
16 input(s)
17 char *s;
18 {
19 	if (peeked) {
20 		peeked = 0;
21 		if (noteof == 0)
22 			return(0);
23 		strcpy(s, ahead);
24 		return(s);
25 	}
26 	return(fgets(s, 1000, in));
27 }
28 
29 char *
30 lookat()
31 {
32 	if (peeked)
33 		return(ahead);
34 	noteof = input(ahead);
35 	peeked = 1;
36 	return(noteof);
37 }
38 
39 addch(s, c)
40 char *s;
41 {
42 	while (*s)
43 		s++;
44 	*s++ = c;
45 	*s = 0;
46 }
47