1: /*
   2:  * Routines dealing with getting input from the keyboard (i.e. from the user).
   3:  */
   4: 
   5: #include "less.h"
   6: 
   7: /*
   8:  * The boolean "reading" is set true or false according to whether
   9:  * we are currently reading from the keyboard.
  10:  * This information is used by the signal handling stuff in signal.c.
  11:  * {{ There are probably some race conditions here
  12:  *    involving the variable "reading". }}
  13:  */
  14: public int reading;
  15: 
  16: static int tty;
  17: 
  18: /*
  19:  * Open keyboard for input.
  20:  * (Just use file descriptor 2.)
  21:  */
  22:     public void
  23: open_getc()
  24: {
  25:     tty = 2;
  26: }
  27: 
  28: /*
  29:  * Get a character from the keyboard.
  30:  */
  31:     public int
  32: getc()
  33: {
  34:     char c;
  35:     int result;
  36: 
  37:     reading = 1;
  38:     do
  39:     {
  40:         flush();
  41:         result = read(tty, &c, 1);
  42:     } while (result != 1);
  43:     reading = 0;
  44:     return (c & 0177);
  45: }

Defined functions

open_getc defined in line 22; used 2 times

Defined variables

public defined in line 31; never used
reading defined in line 14; used 4 times
tty defined in line 16; used 2 times
Last modified: 1990-07-10
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 2359
Valid CSS Valid XHTML 1.0 Strict