Losing pending input in entering RAW or CBREAK

Steve Summit scs at adam.mit.edu
Tue May 7 11:29:22 AEST 1991


In article <243 at bria.UUCP> uunet!bria!mike writes:
>In an article, dfenyes at thesis1.med.uth.tmc.edu (David Fenyes) writes:
>|When I switch from cooked to CBREAK, any pending input appears
>|to be discarded.  How can this be avoided or worked around?
>|
>|I'm using Coherent.  Is this an anomaly, or standard tty behavior?
>
>An excerpt from The Holiest of Tomes:
>
>	TCSETA		set the parameters associated with the terminal
>			from the structure passed as `arg'.  The change
>			is immediate
>
>	TCSETAF		wait for the output to drain and flush the input
>			queue before setting the new parameters
>
>It would seem that the ioctl() that is setting the terminal characteristics
>is using TCSETAF which is forcing the flush on the input queue.  If
>your cbreak is homegrown, then try using TCSETA instead.

I'm not familiar with Coherent, either, and Michael is probably
correct in assuming that it is termio and/or termios based, but
in case it derives from V7 and/or BSD, the equivalent ioctl's are

	TIOCSETP	set tty parameters (and flush pending input)
	TIOCSETN	set tty parameters (no flush of pending input)

                                            Steve Summit
                                            scs at adam.mit.edu



More information about the Comp.unix.programmer mailing list