[Info-vax] [OT] Unix terminal drivers, was: Re: Moving away from OpenVMS
David Froble
davef at tsoft-inc.com
Sun May 20 16:29:53 EDT 2012
John Reagan wrote:
>
>
> "Simon Clubley" wrote in message news:jp5gd4$khd$1 at dont-email.me...
>
>> Unix terminal drivers have a built in timeout capability (at least the
>> ones I am familiar with); the timeout is in units of 0.1 seconds.
>
>
> Yep, Google "tcsetattr" and you'll find:
>
> In noncanonical mode input is available immediately (without the user
> having to type a line-delimiter character), and line editing is
> disabled. The settings of MIN (c_cc[VMIN]) and TIME (c_cc[VTIME])
> determine the circumstances in which a read(2) completes; there are four
> distinct cases:
>
> * MIN == 0; TIME == 0: If data is available, read(2) returns
> immediately, with the lesser of the number of bytes available, or the
> number of bytes requested. If no data is available, read(2) returns 0.
>
> * MIN > 0; TIME == 0: read(2) blocks until the lesser of MIN bytes or
> the number of bytes requested are available, and returns the lesser of
> these two values.
>
> * MIN == 0; TIME > 0: TIME specifies the limit for a timer in tenths of
> a second. The timer is started when read(2) is called. read(2) returns
> either when at least one byte of data is available, or when the timer
> expires. If the timer expires without any input becoming available,
> read(2) returns 0.
>
> * MIN > 0; TIME > 0: TIME specifies the limit for a timer in tenths of a
> second. Once an initial byte of input becomes available, the timer is
> restarted after each further byte is received. read(2) returns either
> when the lesser of the number of bytes requested or MIN byte have been
> read, or when the inter-byte timeout expires. Because the timer is only
> started after the initial byte becomes available, at least one byte will
> be read.
Or read the VAX Basic manual, keyword "Wait" ....
But I think the granularity is more course, wait is in seconds.
INKEY$
The INKEY$ function reads a single keystroke from a terminal opened on a
specified channel and returns the typed key. Escape sequences are
interpreted and are returned as mnemonic strings.
Example
keystroke$ = INKEY$(0%, WAIT)
A lot more overhead than getting a string of characters, but sometimes that's what is
required.
Don't know much (anything) about Unix, but with the tools on VMS some very capable input
functions can be implemented. What's important to me is, on VMS I don't have to use "C".
More information about the Info-vax
mailing list