garrett@udel.EDU (Joel Garrett) (12/03/87)
We are trying to port some code from a BSD system to our 9000 running HP-UX (not sure of the release number) that makes use of the Berkeley "half-cooked" or CBREAK mode of input, which hands characters as they become available to read(). After a thorough search of the includes and the docs, we can't find an immediate replacement for this. Does anyone know of a workaround? Please send mail directly to me as I don't usually read this group. If enough people are interested in the answer though, I'll be glad to post it here. Thanks in advance, Joel Garrett Research Associate Center for Composite Materials University of Delaware Newark, DE 19716 arpa: garrett@udel.edu or: garrett@udel-ccm.arpa
zaphod@deepthot.UUCP (12/04/87)
We are running HP-UX 5.2 on a 9000/500 and the curses that we have supports a cbreak mode. -- humbly yours, Lance Bailey Univ. Western Ontario | Robart's Research Institute Dept. of Computer Science | Clinical Trials Unit Graduate Studies | PO Box 5015 London, Canada | London, Canada N6A 5B7 | N6A 5K8 decvax!{utcs|utzoo|watmath}!deepthot!zaphod -or- zaphod@deepthot.uucp
bd@hpsemc.UUCP (bob desinger) (12/08/87)
One way to get cbreak mode on HP-UX, like any System V implementation, is to turn off canonical mode and tell read() to return after one character. The code fragment to do this goes something like: /* turn off canonical mode to get chars as they are typed */ termio_settings.c_lflag &= ~ICANON; /* get 1 character at a time */ termio_settings.c_cc[VMIN] = 1; /* termio_settings.c_cc[VTIME] is now irrelevant */ /* set the terminal */ if (ioctl(ttyfd, TCSETAF, termio_settings) == -1) perror("ioctl(TCSETAF)"); There is an excellent write-up of this technique in Marc Rochkind's _Advanced_Unix_Programming_ (Prentice-Hall, 1985) available in bookstores [and shipped with the HP 9000 Series 800 machines!]. See page 86 starting with section 4.4.8, "Punctual Input," and the next section, 4.5, entitled "Raw Terminal I/O." bob desinger HP Software Evaluation and Migration Center P.S. Has anyone seen his new book about terminal-handling? Is it as good as _Advanced_Unix_Programming_?