printf, data presentation
Guy Harris
guy at auspex.UUCP
Sat Jan 14 15:52:00 AEST 1989
>At least *some* System V's will treat VMIN == 0, VTIME == 0 as the inkey()
>function originally requested.
In the code as distributed by AT&T, reads with VMIN == 0, VTIME == 0 are
non-blocking reads, and reads with VMIN == 0, VTIME == 10 wait for up to
1 second, or until a character arrives. I would hope *all* System V's
work that way, but it's conceivable some are broken....
>From the SunOS 4.0 TERMIO(4) (it implements an S5 superset - this part
is not a superset, though, S5 does the same stuff):
Case C: MIN = 0, TIME > 0
In this case, since MIN = 0, TIME no longer represents an
intercharacter timer. It now serves as a read timer that is
activated as soon as a read() is done. A read is satisfied
as soon as a single character is received or the read timer
expires. Note: in this case if the timer expires, no char-
acter will be returned. If the timer does not expire, the
only way the read can be satisfied is if a character is
received. In this case the read will not block indefinitely
waiting for a character - if no character is received within
TIME*.10 seconds after the read is initiated, the read will
return with zero characters.
Case D: MIN = 0, TIME = 0
In this case return is immediate. The minimum of either the
number of characters requested or the number of characters
currently available will be returned without waiting for
more characters to be input.
>I *hope* that POSIX is dealing with this.
POSIX specifies an S5-like tty driver, with S5-style behavior for VMIN
and VTIME.
More information about the Comp.unix.wizards
mailing list