Escape key and curses.
T. Kramer
theo at wiggles.UUCP
Mon Jun 25 16:43:08 AEST 1990
#include <curses.h>
I have been having problems trying to trap a single Escape character
in a couple of implementations of UNIX ie. AIX on the IBM RS/6000 and
UNIX V2 on the ICL Clan 500 machine. Below follows a test program that
will print out a message for every key pressed. However, the Escape
character does not come through when pressed the first time for the
above systems. I am using a freedom 100 terminal on the ICL Clan 500
and an IBM3151 terminal on the RS/6000. I know that it is possible
to trap a single Escape character in both these implementations...
it works in vi!
void main()
{
int key;
initscr();
nonl();
noecho();
cbreak();
keypad(stdscr,1);
key = getch();
while(key != 'Q' && key != 'q')
{
addstr("Key pressed = ");
addch(key);
addch('\n');
refresh();
key = getch();
}
endwin();
}
Does anyone out there have any suggestions?
More information about the Comp.unix.wizards
mailing list