home *** CD-ROM | disk | FTP | other *** search
/ Complete Linux / Complete Linux.iso / docs / apps / database / ingres04.lzh / source / monitor / getch.c < prev    next >
Encoding:
C/C++ Source or Header  |  1985-01-23  |  477 b   |  39 lines

  1. # include    "monitor.h"
  2. # include    <ingres.h>
  3. # include    <aux.h>
  4. # include    <sccs.h>
  5.  
  6. SCCSID(@(#)getch.c    8.1    12/31/84)
  7.  
  8.  
  9.  
  10. /*
  11. **  GET CHARACTER
  12. **
  13. **    This routine is just a getchar, except it allows a pseudo-
  14. **    EOF marker.
  15. */
  16.  
  17. char
  18. getch()
  19. {
  20.     register char    c;
  21.  
  22.     if (GiveEof)
  23.         c = '\0';
  24.     else
  25.         c = getc(Input);
  26.     if (c < 0)
  27.         c = '\0';
  28.  
  29.     /* deliver EOF if newline in Oneline mode */
  30.     if (c == '\n' && Oneline)
  31.     {
  32.         ungetc(c, Input);
  33.         c = '\0';
  34.     }
  35.  
  36.     GiveEof = FALSE;
  37.     return (c);
  38. }
  39.