termios question, PENDIN option

Chris Torek chris at mimsy.umd.edu
Wed Nov 22 08:41:41 AEST 1989


In article <2640 at auspex.auspex.com> guy at auspex.auspex.com (Guy Harris) writes:
>... So, to fix this, [tcsh]:
>	1) it sends a CR to the terminal, to zip the cursor back
>	   to column 0;
>	2) reprints the prompt;
>	3) pushes the characters back, still with echoing off;
>	4) sets the PENDING flag, so that those characters will
>	   be "retyped", this time with echoing on.

Of course, instead of all this insanity, it could simply:

	1) send CR; 2) reprint the prompt; 3) push the characters
	back WITH ECHO ENABLED.

This would cut down on the number of system calls.

(Of course, if the machine is heavily loaded or otherwise slow, and
you type something while the characters are being `pushed back',
what you typed will come out in the middle of the pushed-back
characters, no matter what method is used to push them back.  That is,
the sequence of events will be:

		to push back `hello world':
	TIOCSTI('h')		raw queue now `h'
	TIOCSTI('e')		raw queue now `he'
	TIOCSTI('l')		raw queue now `hel'
	input interrupt: `f'	raw queue now `helf'
	TIOCSTI('l')		raw queue now `helfl'
	. . .

This routinely happens to me in ucb mail, which uses TIOCSTI for
header editing.  It is extremely annoying.)
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163)
Domain:	chris at cs.umd.edu	Path:	uunet!mimsy!chris



More information about the Comp.unix.questions mailing list