Losing pending input in entering RAW or CBREAK

mike.stefanik mike at bria.UUCP
Sat May 4 14:58:41 AEST 1991


In an article, dfenyes at thesis1.med.uth.tmc.edu (David Fenyes) writes:
|Hello,
|
|I have an application that enters CBREAK mode (to do editing).
|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?

Well, having never progammed under Coherent (and, with God's grace, I
won't at any time in the near future :-) I will make the assumption
that Coherent uses termio ... with that out of the way ...

Are you using curses, or have you written your own?  The reason that
I ask is that if you are using curses, then you are probably SOL.
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

	TCSETAW		wait for the output to drain before setting the
			new parameters

	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.

-- 
Michael Stefanik, MGI Inc, Los Angeles | Opinions stated are never realistic
Title of the week: Systems Engineer    | UUCP: ...!uunet!bria!mike
-------------------------------------------------------------------------------
If MS-DOS didn't exist, who would UNIX programmers have to make fun of?



More information about the Comp.unix.programmer mailing list