# 2.11BSD#431 - /usr/src/local/less/ttyin.c

##### Functions

    getc              X
    open_getc         X

##### Variables

    public            X
    reading           X

       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

getc defined in line 31; used 6 times

- in /usr/src/local/less/command.c line 190, 214
- in /usr/src/local/less/funcs.h line 76
- in /usr/src/local/less/main.c line 147
- in /usr/src/local/less/output.c line 203-206(2)

open_getc defined in line 22; used 2 times

- in /usr/src/local/less/funcs.h line 75
- in /usr/src/local/less/main.c line 307

#### Defined variables

public defined in line 31; never used
reading defined in line 14; used 4 times

- in line 37, 43
- in /usr/src/local/less/signal.c line 45, 58

tty defined in line 16; used 2 times

- in line 25, 41

Last modified: 1990-07-10 Generated: 2016-12-26 | Generated by src2html V0.67 page hit count: 681 |