diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2012-02-06 21:40:45 +0200 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2012-02-06 21:40:45 +0200 |
commit | cd44d957787e162df4348028c22e8b9621000790 (patch) | |
tree | e2889309da0e6683ab65486b68aba944647abebd | |
parent | 7ae469692932aae4a587f746dbff61c1d8b12eb9 (diff) | |
download | gawk-cd44d957787e162df4348028c22e8b9621000790.tar.gz |
Minor edits to John's changes.
-rw-r--r-- | doc/ChangeLog | 7 | ||||
-rw-r--r-- | doc/gawk.1 | 8 | ||||
-rw-r--r-- | doc/gawk.texi | 34 |
3 files changed, 28 insertions, 21 deletions
diff --git a/doc/ChangeLog b/doc/ChangeLog index 2307bde2..2bbb982d 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,4 +1,9 @@ -2021-02-03 John Haque <j.eh@mchsi.com> +2012-02-06 Arnold D. Robbins <arnold@skeeve.com> + + * gawk.texi, gawk.1: And some minor edits thereunto. + +2012-02-03 John Haque <j.eh@mchsi.com> + * gawk.texi, gawk.1: Add text on read timeout. 2011-12-28 Arnold D. Robbins <arnold@skeeve.com> @@ -1131,8 +1131,8 @@ depending on how the elements of the array are to be ordered. .TP \fBPROCINFO["input", "READ_TIMEOUT"]\fP specifies the timeout in milliseconds for reading data from -.I input -, where +.IR input , +where .I input is a redirection string or a filename. A value of zero or less than zero means no timeout. @@ -3595,7 +3595,9 @@ and .B \-\^\-file options. .PP -The GAWK_READ_TIMEOUT environment variable can be used to specify a timeout +The +.B GAWK_READ_TIMEOUT +environment variable can be used to specify a timeout in milliseconds for reading input from a terminal, pipe or two-way communication including sockets. .PP 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 |