Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!rutgers!orstcs!statware!scf From: scf@statware.UUCP (Steve Fullerton) Newsgroups: comp.sys.hp Subject: Re: buggy hp9000/800 3.01 code? Keywords: hp,unix Message-ID: <1876@statware.UUCP> Date: 30 Mar 89 16:59:40 GMT References: <659@kcdev.UUCP> Reply-To: scf@statware.UUCP (Steve Fullerton) Organization: Statware, Corvallis, Oregon Lines: 42 In article <659@kcdev.UUCP> gentry@kcdev.UUCP (Art Gentry) writes: >A few words to the wise on possible nasty bugs in the 3.01 release of >HP9000/850 UNIX. I have encountered another curious problem, anomaly, bug, with the HP-UX 3.0 release. Our code for doing raw input that worked fine under HP-UX 2.0 (as well as about 20 other UN*X systems) now fails under 3.0. At first the 2.0x executable failed (I'll explain below) when run under 3.0. Next, we tried linking under 3.0 and got the same failure. Finally, re-compiling and linking yielded the same result. What we are doing is setting termio to raw and reading characters 1 at a time. It works fine until a cursor key is pressed and then the 2nd character gets hung in the buffer until the next read...very strange. We are doing blocked reads so what happens is: 1) Issue the read 2) User enters a character, it is read and all is fine, go to 1) 3) User enters a cursor key so the read returns an ESC, issue another read 4) This second read blocks waiting for input. When a key is pressed, the second character from the cursor key is what is read. 5) Subsequent reads remain out-of-sync; i.e., when a character is entered, the previous entry is what is read. The code we are using for raw input was extracted directly from Marc Roshkind's "Advanced UNIX Programming". Specifically, pages 88-89. He suggests termio.c_cc[VMIN] = 5 and termio.c_cc[VTIME] = 2. I wasn't sure whether or not the bug was related to VMIN and VTIME or else ICANON. I was finally able to get it to work by setting the VMIN value to 1 and the VTIME value to 0. I am confident in the code---it has been ported to all major UN*X systems and even worked fine for HP-UX 2.0x as well as on HP9000/3xx 6.x systems. So something is really wrong and programs doing screen handling might have a big surprise when moving to 3.0. -- Steve Fullerton Statware, Inc. scf%statware.uucp@cs.orst.edu 260 SW Madison Ave, Suite 109 orstcs!statware!scf Corvallis, OR 97333 503/753-5382