Path: utzoo!mnetor!uunet!seismo!sundc!pitstop!sun!decwrl!labrea!agate!pasteur!ames!ll-xn!oberon!pollux.usc.edu!xwu From: xwu@pollux.usc.edu (Xinhua Wu) Newsgroups: comp.unix.questions Subject: Re: a question about using curses lib Message-ID: <7255@oberon.USC.EDU> Date: 27 Feb 88 00:33:09 GMT References: <7078@oberon.USC.EDU> Sender: news@oberon.USC.EDU Reply-To: xwu@pollux.usc.edu (Xinhua Wu) Organization: University of Southern California, Los Angeles, CA Lines: 44 In article <7078@oberon.USC.EDU> xwu@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 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 instead of as the escape key. How can I distinguish 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@cse.usc.edu