Behaviour of setjmp/longjmp and registers

Leslie Mikesell les at chinet.chi.il.us
Mon Feb 6 07:07:46 AEST 1989


In article <483 at maxim.ERBE.SE> prc at maxim.ERBE.SE (Robert Claeson) writes:

>> In System V based UNIXes, you do an ioctl to set MIN/TIME to be the
>> minimum number of characters to read and the timeout in tenths of a
>> second.  This only works on terminals (and pty's if provided).
>.....

>Does this really work that good? A function key (control) character
>sequence can be of arbitrary length. The up-arrow  key on my keyboard
>sends three characters, whereas a typical F-key sends 5 characters.
>So how do I know what to put into VMIN?

Put something fairly large in VMIN and something small in VTIME.  Then
make read() requests for many characters at a time.  The read() will
return when at least one character is typed and either VTIME has elapsed
between characters or VMIN characters have been entered.  Increasing
VMIN/VTIME beyond what you need to capture the function key strings
will increase efficiency (by reducing the read() system calls) at the
cost of response time if the operator can type faster than VTIME expires.
In any case, this approach should be much more efficient that wrapping
alarm()'s around single character read()s.

Les Mikesell



More information about the Comp.lang.c mailing list