In linux-2.4.18 and before, one can check for an input keystroke
by setting up a signal handler and acting upon that signal.
A snippet of code follows:
/*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- In Linux-2.4.19, a signal is generated on OUTPUT as well as This is NotGood(tm). Before I make work-arounds in production If somebody has a patch, I can easily check the fix. Cheers, -
/*
* Save terminal characteristics and then set the terminal for raw
* input generating a signal upon any received character.
*/
if(tcgetattr(STDIN_FILENO, &term) == FAIL)
ERRORS(Tcgetattr);
save = term;
term.c_lflag = ISIG;
term.c_iflag = 0;
if(tcsetattr(STDIN_FILENO, TCSANOW, &term) == FAIL)
ERRORS(Tcsetattr);
if((flags = fcntl(STDIN_FILENO, F_GETFL)) == FAIL)
ERRORS(Fcntl);
flags |= (FNDELAY|FASYNC);
if(fcntl(STDIN_FILENO, F_SETFL, flags) == FAIL)
ERRORS(Fcntl);
if(fcntl(STDIN_FILENO, F_SETOWN, getpid()) == FAIL)
ERRORS(Fcntl);
input when STDIN_FILENO is associated with the network through
a virtual terminal 'pty' (like telnet).
code, is this a new standard or is it a bug? If this is a new
'standard', then the signal should be generated upon output
to all I/O terminal devices (which it isn't).
* Johnson
Penguin : Linux version 2.4.18 on an i686 machine (797.90 BogoMips).
The US military has given us many words, FUBAR, SNAFU, now ENRON.
Yes, top management were graduates of West Point and Annapolis.
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
More majordomo info at http://www.veryComputer.com/
Please read the FAQ at http://www.veryComputer.com/