Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uwm.edu!cs.utexas.edu!rice!sun-spots-request From: ted@arsocomvax.socom.mil (Ted Nolan) Newsgroups: comp.sys.sun Subject: Re: losing input when switching from CBREAK to COOKED in SunOS-4 Keywords: SunOS Message-ID: <4973@brazos.Rice.edu> Date: 13 Feb 90 22:56:06 GMT Sender: root@rice.edu Organization: Sun-Spots Lines: 116 Approved: Sun-Spots@rice.edu X-Sun-Spots-Digest: Volume 9, Issue 41, message 10 >I have a problem with typeahead in my interactions with tcsh on SunOS-4. >The input buffer seems to be flushed when the shell switches from CBREAK >to COOKED. I remember that this was the case in older versions of UNIX I have seen the same problem, and since it breaks certain applications of braggtools (plug..), I sent in a bug report to hotline. Slightly edited, it and a couple of responses appear below: ***** 8< Cut Here >8 ****** X-To: hotline@sun.com X-Subject: TIOCSETN (TCSETS) broken in 4.0.3? I have recently noticed a problem in SunOS4.0.3 (my hardware is Sun3). The following program demonstrates the bug: #include #include main() { struct sgttyb tparms_ori; struct sgttyb tparms_new; char c; if(ioctl(0,TIOCGETP,&tparms_ori) < 0){ perror("Get parms ioctl"); exit(1); } tparms_new = tparms_ori; tparms_new.sg_flags |= CBREAK; if(ioctl(0,TIOCSETP,&tparms_new) < 0){ perror("Set parms ioctl"); exit(1); } if(read(0, &c,1) < 0){ perror("read"); exit(1); } if(ioctl(0,TIOCSETN,&tparms_ori) < 0){ perror("Reset parms ioctl"); exit(1); } } If you run this program on a 4.0.3 system, in a shelltool or commandtool window, the TIOCSETN discards waiting input, even though its function is specifically NOT to do that. Here's an example: 1) type the ls command in a LOCAL shelltool or commandtool window. 2) Using the mouse, grab the ls command, including the carraige return. 3) Run the program above 4) Stuff or paste the ls command into the window. Since the program only demands one character input, and then does a TIOCNSEN, the proper response would be s: Command not found. When the bug is present, you will simply get your prompt back. This program works correctly on 3.5 machines, and on 4.0.3 machines through an rlogin. A fix or workaround would be greatly appreciated. Thanks, Ted Nolan ted@arsocomvax.socom.mil X-From: chico@EBay.Sun.COM (Chico Marx) X-Subject: Re: TIOCSETN (TCSETS) broken in 4.0.3? Thank you for using Software Support Hotline, your call has been dispatched to an engineer and you should be receiving a response shortly. Please reference so#406737 when calling in. If I can help in any way, please contact me at the number below. Thank you Melissa Taylor (408)276-3758 X-To: hotline@sun.com X-Subject: Re: TIOCSETN (TCSETS) broken in 4.0.3? Any progress on so#406737? X-From: melissat@EBay.Sun.COM (Melissa Taylor) X-Subject: Re: TIOCSETN (TCSETS) broken in 4.0.3? I received your e-mail requesting status on so# 406737 and have forwarded your mail to Chris Johnson the engineer who is assigned to your call. If you have any questions please call me at the below number. Thanks, Melissa Taylor (408) 276-3758 So.. they know about it, it's so#406737, and supposedly someone is working on it. If I don't hear anything in a few weeks maybe I'll give them a call. Ted Nolan ted@arsocomvax.socom.mil