home *** CD-ROM | disk | FTP | other *** search
/ minnie.tuhs.org / unixen.tar / unixen / PDP-11 / Trees / V7 / usr / src / cmd / refer / refer8.c < prev    next >
Encoding:
C/C++ Source or Header  |  1979-01-10  |  375 b   |  31 lines

  1. # include "refer..c"
  2. static char ahead[1000];
  3. static int peeked 0;
  4. static int noteof 1;
  5. input (s)
  6.     char *s;
  7. {
  8. if (peeked)
  9.     {
  10.     peeked=0;
  11.     if (noteof==0) return(0);
  12.     strcpy (s, ahead);
  13.     return(s);
  14.     }
  15. return(fgets(s, 1000, in));
  16. }
  17. lookat()
  18. {
  19. if (peeked) return(ahead);
  20. noteof=input(ahead);
  21. peeked=1;
  22. return(noteof);
  23. }
  24. addch(s, c)
  25.     char *s;
  26. {
  27. while (*s) s++;
  28. *s++ = c;
  29. *s = 0;
  30. }
  31.