Xref: utzoo alt.sys.sun:1892 comp.unix.internals:917 Path: utzoo!utgpu!freedom!elroy.jpl.nasa.gov!aero!usasoc.soc.mil!news From: ted@arsocomvax.socom.mil (Ted Nolan) Newsgroups: alt.sys.sun,comp.unix.internals Subject: Re: ioctl's that flush typeahead on SunOS 4.0.3 Message-ID: <1990Oct31.212012.13776@usasoc.soc.mil> Date: 31 Oct 90 21:20:12 GMT References: <43727@andante.att.com> Reply-To: ted@usasoc.soc.mil (Ted Nolan) Organization: SRI International, Ft. Bragg NC Lines: 44 It sounds like you are running into a problem I found on 4.0.3. We have an application that drives a terminal window by essentially "stuffing" into it. I had modified the "less" pager program to use a nonflushing IOCTL to return to terminal to cooked mode from cbreak mode, so that our application could stuff something like q^Uunix command The intent was that if the pager was active, the 'q' would exit it, and then the unix command would start. (If the pager were not active, the ^U would erase the 'q', and the command would still be ok). This worked fine under SunOS 2.X and 3.X, but in 4.0.3 the ioctl (TIOCSETN (bsd) == TCSETS (sysV)) that is documented NOT to flush the input actually does flush it, and our application doesn't work. Whether or not this is "good" in some abstract sense, is, I suppose, debatable. However, it does not work as documented, which seems clearly wrong to me. Here's the response I got back from sun: > > deleted stuff > >In looking this over it looks like you are running into a problem under >4.0 and later, when things were switched over to STREAMS. The bugid >that you are running into is 1007731. The problem turns out to be, that >when the mode of the tty changes to between ~CBREAK and CBREAK, an >automatic flush (M_FLUSH) occurs. In your example, you will see, that >if you comment out the ORing of the CBREAK flag, the TIOCSETN will work >correctly as you indicated. From the bug report this looks like this >will be fixed in 4.1 (the next release). > This doesn't really help, because I need CBREAK to ~CBREAK transitions. Am I to gather this is still not fixed in 4.1? Ted Nolan ted@usasoc.soc.mil PS: One weird workaround I found... Do an rlogin localhost in the window you want this to work in, and most of the time it will.