a question about using curses lib

Xinhua Wu xwu at pollux.usc.edu
Sat Feb 27 10:33:09 AEST 1988


In article <7078 at oberon.USC.EDU> xwu at pollux.usc.edu (Xinhua Wu) writes:
>I'm writing a program using curses lib.  I want to use function keys (eg,
>...

Thanks a lot to those who responded to my original posting.  I'm sorry that
I failed to state clearly what the problem really is.

I'm using 4.3 (on IBM RT).  I want to use 4 arrow keys and an escape key
(f12 right now) while I'm in a window.  Now I have something like this:

	...
	crmode();
	...
	switch (inbuf[0] = wgetch(win)) {
	  case '\033': 	/* Esc	*/
	    read the rest into inbuf[], again using wgetch();
	    if (strcmp(inbuf, leftarrow) == 0)
	    then ...
	    else if (strcmp(inbuf, rightarrow) == 0)
	    ...

	  case '': ...;

	  ...

	  default: ...;
	}


1. Right now I have a function to set the variable leftarrow (and the length 
of it, to control how many times wgetch() is called - the code for <leftarrow>
is \033A for ibmaed, \033[A for xterm and vt100 under X) etc for known terminal
types.  Can someone show me an example of using termcap database?  How does
getcap(name) work?  tgetstr()?  Is KL (or kl) etc set by setterm()?

2. I'd like to use <Esc> instead of <f12> as the escape key.  How can I
distinguish <Esc> with leftarrow (for example) whose code also begins with an
escape?  Timed input?  How do I know I'm reading just an escape?


Again, thanks in advance for any help.

Xinhua Wu
xwu at cse.usc.edu



More information about the Comp.unix.questions mailing list