[TUHS] V6 Console IO

Noel Chiappa jnc at mercury.lcs.mit.edu
Fri Jul 24 12:28:07 AEST 2020


    > From: Paul Riley

    > I'm struggling however with how C processes the IO. It seems that when I
    > type at the console, my typing is immediately echoed to my terminal
    > window. ...  nothing appears on the terminal until I press enter, when
    > the system displays the whole line of input ... How
    > can I suppress the original C/Unix echo, and get my output to appear
    > immediately?

This is not a C issue; it's the Unix I/O system (and specifically, terminal I/O).

Normally, Unix terminal input is done line-at-a-time: i.e. the read() call to
the OS (whether for 1 character, or a large number) doesn't return until an
enire line has been typed, and [Retrurn] has been hit; then the entire line is
available. While it's being buffered by the OS, echoing is done, and rubout
processing is also performed.

One can suppress all this; there's a mode call 'raw' (the normal mode is
sometime labelled 'cooked') which suppresses all that, and just gives one the
characters actually typed, as they are typed. The stty() system call can be
used to turn this on.

See the V6 tty(IV) manual entry for more. stty() is in stty(II).

    Noel


More information about the TUHS mailing list