Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!swrinde!cs.utexas.edu!sun-barr!olivea!mintaka!bloom-picayune.mit.edu!news From: scs@adam.mit.edu (Steve Summit) Newsgroups: comp.unix.programmer Subject: Re: Losing pending input in entering RAW or CBREAK Message-ID: <1991May7.012922.2647@athena.mit.edu> Date: 7 May 91 01:29:22 GMT References: <5027@lib.tmc.edu> <243@bria.UUCP> Sender: news@athena.mit.edu (News system) Reply-To: scs@adam.mit.edu Distribution: usa Organization: Thermal Technologies, Cambridge, MA Lines: 29 In article <243@bria.UUCP> uunet!bria!mike writes: >In an article, dfenyes@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@adam.mit.edu