home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky comp.unix.misc:3327 comp.sys.sun.misc:3823 comp.unix.programmer:4393
- Newsgroups: comp.unix.misc,comp.sys.sun.misc,comp.unix.programmer
- Path: sparky!uunet!haven.umd.edu!darwin.sura.net!news.duc.auburn.edu!ducvax.auburn.edu!swanger
- From: swanger@ducvax.auburn.edu
- Subject: Curses/Sun problem
- Message-ID: <1992Aug21.093130.1@ducvax.auburn.edu>
- Lines: 63
- Sender: usenet@news.duc.auburn.edu (News Account)
- Nntp-Posting-Host: ducvax
- Organization: Auburn University, AL
- Date: Fri, 21 Aug 1992 14:31:30 GMT
- Lines: 63
-
- I am writing a program that uses curses (Sys V) to capture information from
- the keyboard. I am using a SUN Sparcstation IPC, with SUNOS 4.1.2. I can't
- seem to get unique values for some of the keypad keys. If I press any of
- the cursor (arrow) keys, I get a value that is consistent with the values
- listed in the curses(v) man pages under SYSTEM V FUNCTION KEYS. However, if
- I press any other key on the keypad, a unique value is not returned. All I
- seem to get for any of these keys is a lowercase 'z'. Actually, I suspect
- some sort of escape sequence that ends (or begins) with 'z' is being
- returned. Still, I am using the curses keypad() function that I thought
- would cause these keys to return a unique value, not a sequence.
-
- I have included the program below. I compile and link the program with the
- following command:
-
- /usr/5bin/cc -I/usr/5include -L/usr/5lib -o ctest ctest.c -lcurses -ltermcap
-
- -----------------------------cut here-------------------------------------
- #include "curses.h"
-
- main()
- {
- int key, finished;
- WINDOW *input;
-
- finished = FALSE;
-
- if ((int)initscr() == ERR)
- {
- exit(0);
- }
-
- refresh();
-
- input = newwin(LINES,COLS,0,0);
- wrefresh(input);
-
- cbreak();
- noecho();
- nonl();
- intrflush(input, FALSE);
- keypad(input, TRUE);
-
- while(finished == FALSE)
- {
- wmove(input,0,0);
- wrefresh(input);
- key = wgetch(input);
- wmove(input, 1, 0);
- wprintw(input, "%c ", key);
- wmove(input, 2, 0);
- wprintw(input," %o %d ", key, key);
- wrefresh(input);
- if (key == 'x') finished = TRUE;
- }
-
- delwin(input);
- endwin();
- }
- -----------------------------cut here-------------------------------------
-
- Thanks in advance for any help you can send!
- --
- David Swanger, Auburn University, Alabama, swanger@ducvax.auburn.edu
-