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