crouch@toadflax.axion.bt.co.uk (chris rouch) (11/04/88)
Reply-to: crouch@toadflax.axion.bt.co.uk (chris rouch) I'm trying to use ultrix curses for some screen handling routines. What I want to to do is interpret each character as it is typed (so that i can respond to arrow keys etc.), while allowing typeahead. The program looks something like this: main(0 { /*initialisation*/ crmode(); . . . get_raw_char(str,size,echo_it); . . etc. nocrmode(); } get_raw_char(str,size,echo_it) char *str; int size,echo_it; { int i; if (echo_it != TRUE) noecho(); for (i=0;i<size;i++) { str[i] = getch(); } echo(); } The problem occurs if I try and type ahead more than a minimal amount (1 or 2 characters) the program ignores what is typed. Worse still it misses the <esc> part of the arrow key sequence resulting in '[B' or similar being returned. I've tried replacing [no]crmode() with [no]raw(), but the effect is the same. Is there anyway of getting curses to accept typeahead? Or is there a better way of getting single character input while using curses? Any help would be greatly appreciated. Please e-mail any suggestions to me and I'll post a summary, when (if) I get something working. Chris Rouch -------------------------------------------------------------------------- vax to vax (UUCP) CRouch@axion.bt.co.uk (...!ukc!btnix!crouch) desk to desk RT3124, 310 SSTF, British Telecom Research Laboratories, Martlesham Heath, IPSWICH, IP5 7RE, UK. voice to voice +44 473 646093 "If you can't think once then don't think twice" --------------------------------------------------------------------------
condor@mas1.UUCP (Rick Kawala) (03/08/90)
I have an application that we've been running under 4.x BSD for about 6 years now. When we went to move it to Ultrix, we found that curses.h didn't contain "extern" declarations for the variables KL and KR (which normally are extern char *'s that point to the sequences generated by the left and right arrow keys on a particular terminal). Does anyone know why these variables aren't available? I tried "externing" them myself, but they just weren't there. Is there another way of getting this information? Do I have to hardwire these codes in for every terminal type we use (fortunately, we only have about 5, but it's still a disgusting solution)? Any info would be appreciated. Rick Kawala Whatever it is, consider it disclaimed.
meissner@osf.org (Michael Meissner) (03/08/90)
In article <2009@mas1.UUCP> condor@mas1.UUCP (Rick Kawala) writes: | I have an application that we've been running under 4.x BSD | for about 6 years now. When we went to move it to Ultrix, we | found that curses.h didn't contain "extern" declarations for | the variables KL and KR (which normally are extern char *'s | that point to the sequences generated by the left and right | arrow keys on a particular terminal). | | Does anyone know why these variables aren't available? I tried | "externing" them myself, but they just weren't there. Is there | another way of getting this information? Do I have to hardwire | these codes in for every terminal type we use (fortunately, | we only have about 5, but it's still a disgusting solution)? | Any info would be appreciated. Just do tgetstr yourself on the following termcap entries (descriptions yanked from man termcap(5)): kd str Sent by terminal down arrow key kl str Sent by terminal left arrow key kr str Sent by terminal right arrow key ku str Sent by terminal up arrow key -- Michael Meissner email: meissner@osf.org phone: 617-621-8861 Open Software Foundation, 11 Cambridge Center, Cambridge, MA Catproof is an oxymoron, Childproof is nearly so