diff options
Diffstat (limited to 'doc/gawk.texi')
-rw-r--r-- | doc/gawk.texi | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/doc/gawk.texi b/doc/gawk.texi index 885bf0ef..5b3dd71c 100644 --- a/doc/gawk.texi +++ b/doc/gawk.texi @@ -393,7 +393,7 @@ particular records in a file and perform operations upon them. * Getline Notes:: Important things to know about @code{getline}. * Getline Summary:: Summary of @code{getline} Variants. -* Read Timeout:: Reading input with timeout. +* Read Timeout:: Reading input with a timeout. * Command line directories:: What happens if you put a directory on the command line. * Print:: The @code{print} statement. @@ -3659,7 +3659,7 @@ the value is rounded up to an integral number of seconds. @item GAWK_READ_TIMEOUT Specifies the time, in milliseconds, for @command{gawk} to -wait for input before returning with error. +wait for input before returning with an error. @xref{Read Timeout}. @end table @@ -5143,7 +5143,7 @@ used with it do not have to be named on the @command{awk} command line * Multiple Line:: Reading multi-line records. * Getline:: Reading files under explicit program control using the @code{getline} function. -* Read Timeout:: Reading input with timeout. +* Read Timeout:: Reading input with a timeout. * Command line directories:: What happens if you put a directory on the command line. @@ -7224,16 +7224,16 @@ and whether the variant is standard or a @command{gawk} extension. @c ENDOFRANGE infir @node Read Timeout -@section Reading Input with Timeout +@section Reading Input With A Timeout @cindex timeout, reading input You may specify a timeout in milliseconds for reading input from a terminal, -pipe or two-way communication including TCP/IP sockets. This can be done +pipe or two-way communication including, TCP/IP sockets. This can be done on a per input, command or connection basis, by setting a special element in the @code{PROCINFO} array: @example -PROCINFO["input_name", "READ_TIMEOUT"] = timeout in milliseconds +PROCINFO["input_name", "READ_TIMEOUT"] = @var{timeout in milliseconds} @end example When set, this will cause @command{gawk} to time out and return failure @@ -7250,8 +7250,9 @@ else if (ERRNO != "") print ERRNO @end example -Here is how to read interactively from the terminal without waiting -for more than 5 seconds: +Here is how to read interactively from the terminal@footnote{This assumes +that standard input is the keyboard} without waiting +for more than five seconds: @example PROCINFO["/dev/stdin", "READ_TIMEOUT"] = 5000 @@ -7265,7 +7266,8 @@ and set the @code{ERRNO} variable to an appropriate string value. A negative or zero value for the timeout is the same as specifying no timeout at all. -Timeout can also be set for reading from terminal in the implicit loop +A timeout can also be set for reading from the terminal in the implicit +loop that reads input records and matches them against patterns, like so: @example @@ -7275,7 +7277,7 @@ $ @kbd{ gawk 'BEGIN @{ PROCINFO["-", "READ_TIMEOUT"] = 5000 @}} @print{} You entered: gawk @end example -In this case, failure to respond within 5 seconds will result in the following +In this case, failure to respond within five seconds results in the following error message: @example @@ -7298,21 +7300,20 @@ while ((Service |& getline) > 0) @{ @quotation NOTE You should not assume that the read operation will block -exactly after the 10th record has been printed. It is possible that -@command{gawk} will read and buffer more than one record +exactly after the tenth record has been printed. It is possible that +@command{gawk} will read and buffer more than one record's worth of data the first time. Because of this, changing the value -of timeout like in the above example has very little usefulness, -if any at all. +of timeout like in the above example is not very useful. @end quotation If the @code{PROCINFO} element is not present and the environment variable @env{GAWK_READ_TIMEOUT} exists, -gawk will use it to initialize the timeout value. +@command{gawk} uses its value to initialize the timeout value. The exclusive use of the environment variable to specify timeout has the disadvantage of not being able to control it on a per command or connection basis. -Gawk considers a timeout event an error even though +@command{gawk} considers a timeout event to be an error even though the attempt to read from the underlying device may succeed in a later attempt. This is a limitation, and it also means that you cannot use this to multiplex input from @@ -7326,7 +7327,6 @@ a connection before it can start reading any data, or the attempt to open a FIFO special file for reading can block indefinitely until some other process opens it for writing. - @node Command line directories @section Directories On The Command Line @cindex directories, command line |