manpagez: man pages & more
info gawk
Home | html | info | man

gawk: Retrying Input

 
 4.12 Retrying Reads After Certain Input Errors
 ==============================================
 
 This minor node describes a feature that is specific to 'gawk'.
 
    When 'gawk' encounters an error while reading input, by default
 'getline' returns -1, and subsequent attempts to read from that file
 result in an end-of-file indication.  However, you may optionally
 instruct 'gawk' to allow I/O to be retried when certain errors are
 Auto-set::):
 
      PROCINFO["INPUT_NAME", "RETRY"] = 1
 
    When this element exists, 'gawk' checks the value of the system (C
 language) 'errno' variable when an I/O error occurs.  If 'errno'
 indicates a subsequent I/O attempt may succeed, 'getline' instead
 returns -2 and further calls to 'getline' may succeed.  This applies to
 the 'errno' values 'EAGAIN', 'EWOULDBLOCK', 'EINTR', or 'ETIMEDOUT'.
 
    This feature is useful in conjunction with 'PROCINFO["INPUT_NAME",
 "READ_TIMEOUT"]' or situations where a file descriptor has been
 configured to behave in a non-blocking fashion.
 
© manpagez.com 2000-2018
Individual documents may contain additional copyright information.