On Thu, Jul 23, 2020 at 10:29 PM Noel Chiappa <jnc(a)mercury.lcs.mit.edu
wrote:
...
This is not a C issue; it's the Unix I/O system (and specifically,
terminal I/O).
...
One can suppress all this; there's a mode call 'raw'
Just be sure to turn raw mode off so
canonization is performed again after
your program stops running. Remember this a 'system wide' settings for that
try and all programs start to use that setting. So if some reason, your
program stops and a new program (like the shell) takes back over input from
the try, if you do not have a way to get it back you are screwed.
Back in the day, I have a shell script in my path stored in ~/.bin called: ft
(fix tty) which called the stty command with the way I wanted the
terminal to be set up. Thus is I was running a program that core dumped
and left the try in raw mode, if I could find a way to run the ft script
(usually by typing ^Jft^J ) life was good again. Paul, as an exercise why
would ft<CR> not be good enough? (hint read and study the section 4 man
page for stty)
FWIW: is how the original UCB ex/vi and Cornell's Fred editors for v6
works by the way. I suspect that iyou look at any of the video editors of
the day it will show you the details.
One of the differences between V7 and earlier UNIX tty handlers was that
they tty canonization was split into multiple parts. Also the other hint
with Sixthedition's version of raw and cooked modes, you get all or nothing so
you if you turn on raw, your program, will have do things like backspace
processing, *etc*..