rouben@math9.math.umbc.edu (Rouben Rostamian) (04/13/90)
I have been having problems with making curses recognize the arrow keys from any keyboard under ULTRIX. I have tried anything I could, so now in desparation I am asking the net wizards for help. According to the "Guide to Curses" manual, the function call keyboard() makes the function keys return one octal value rather than a sequence of escape characters. For instance, the up-arrow key should return KEY_UP (defined in /usr/include/cursesX.h as 0403) rather that something like ^[OA. On other ( != ULTRIX ) machines this works just fine. However on my DECstation 3100 running ULTIRX the function keys continue returning stuff like ^[OA rather than the octal code regardless of the setting of keypad(). Is there a magic incantation that will fix my problem? Here is a minimal program (test.c) which reads the keyboard and echos the pressed keys. It returns three characters for each pressing of an arrow key. I have compiled the program with cc -O -o test test.c -lcursesX and cc -O -o test test.c /usr/lib/termcap.o -lcursesX with identical results. What gives? /* ------------------------ test.c -------------------------------------- */ #include <cursesX.h> main() { char c; initscr(); cbreak(); noecho(); keypad(stdscr, TRUE); printw("Press any key to test. Press 'q' to quit.\n"); refresh(); while ( ( c = getch() ) != 'q' ) { printw("You pressed %c, Octal: %o\n", c, c); refresh(); } endwin(); } /* ------------------------- end of test.c ---------------------------- */ -- Rouben Rostamian Telephone: (301) 455-2458 Department of Mathematics and Statistics e-mail: University of Maryland Baltimore County rostamian@umbc.bitnet Baltimore, MD 21228 rostamian@umbc3.umbc.edu