Path: utzoo!utgpu!watmath!clyde!mcdchg!chinet!les From: les@chinet.chi.il.us (Leslie Mikesell) Newsgroups: comp.lang.c Subject: Re: Behaviour of setjmp/longjmp and registers Message-ID: <7643@chinet.chi.il.us> Date: 5 Feb 89 21:07:46 GMT References: <25@torsqnt.UUCP> <8867@bloom-beacon.MIT.EDU> <9480@smoke.BRL.MIL> <3112@xyzzy.UUCP> <483@maxim.ERBE.SE> Reply-To: les@chinet.chi.il.us (Leslie Mikesell) Organization: Chinet - Public Access Unix Lines: 23 In article <483@maxim.ERBE.SE> prc@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