25.7 ttyinput (8333)

“canon” removes characters from the “raw” input queue. They are put there in the first place by “ttyinput” which is called by “klrint” (8087) whenever an input character is received from the hardware controller.

The parameters passed to “ttyinput” are a character and a reference to a “tty” structure.

8342:

If the character is a “carriage return” and the terminal operates with a “carriage return” only (instead of a “carriage return” “line feed” pair) change the character to a “new line”;

8344:

If the terminal is not operating in “raw” mode and the character is a “quit” or “delete” (7958) then call “signal” (3949) to send a software interrupt to every process which has the terminal as its controlling terminal, flush all the queues associated with the terminal, and return;

8349:

If the “raw” input queue has grown excessively large, flush all the queues for the terminal and return. (This may seem a trifle harsh at first sight but it will usually be what is required.);

8353:

If the terminal has a limited character set, and the character is an upper case alphabetic, translate it into lower case;

8355:

Insert the character into the “raw” input queue;

8356:

If the terminal is operating in “raw” mode, or the character was a “new line” or “eot” then ...

8357:

“wakeup” any process waiting for input from the terminal, place a delimiter character (all ones) also in the “raw” queue and increment the delimiter count Note this is one point where possible failure of “putc” (when there is no buffer space) is explicitly recognised. A failure occurring here would explain why the test on line 8316 may sometimes succeed.

8361:

Finally, if the input character is to be echoed i.e. the terminal is running in full duplex mode, insert a copy of the character into the output queue, and and arrange to have it transmitted (“ttstart”) back to the terminal.