aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog37
-rw-r--r--TODO5
-rw-r--r--awk.h4
-rw-r--r--builtin.c37
-rw-r--r--doc/ChangeLog9
-rw-r--r--doc/gawk.info1183
-rw-r--r--doc/gawk.texi73
-rw-r--r--doc/gawktexi.in73
-rw-r--r--io.c71
-rw-r--r--test/ChangeLog6
-rw-r--r--test/Makefile.am5
-rw-r--r--test/Makefile.in15
-rw-r--r--test/Maketests10
-rw-r--r--test/nonfatal1.awk5
-rw-r--r--test/nonfatal1.ok2
-rw-r--r--test/nonfatal2.awk5
-rw-r--r--test/nonfatal2.ok1
17 files changed, 956 insertions, 585 deletions
diff --git a/ChangeLog b/ChangeLog
index f116265a..61362b78 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,23 @@
+<<<<<<< HEAD
+2015-02-08 Andrew J. Schorr <aschorr@telemetry-investments.com>
+
+ * awk.h (RED_NON_FATAL): Removed.
+ (redirect): Add new failure_fatal parameter.
+ (is_non_fatal_redirect): Add declaration.
+ * builtin.c (efwrite): Rework check for non-fatal.
+ (do_printf): Adjust calls to redirect.
+ (do_print_rec): Ditto. Move check for redirection error up.
+ * io.c (redflags2str): Remove RED_NON_FATAL.
+ (redirect): Add new failure_fatal parameter. Simplify the code.
+ (is_non_fatal_redirect): New function.
+ (do_getline_redir): Adjust calls to redirect.
+
+2014-12-27 Arnold D. Robbins <arnold@skeeve.com>
+
+ * awk.h (is_non_fatal_std): Declare new function.
+ * io.c (is_non_fatal_std): New function.
+ * builtin.c (efwrite): Call it.
+=======
2015-02-07 Arnold D. Robbins <arnold@skeeve.com>
* regcomp.c, regex.c, regex.h, regex_internal.c, regex_internal.h,
@@ -99,12 +119,29 @@
* awkgram.y (extensions_used): New variable. Set it on @load.
(do_add_scrfile): Set it on -l.
(process_deferred): Check it also.
+>>>>>>> master
2014-12-24 Arnold D. Robbins <arnold@skeeve.com>
* profile.c (pprint): Be sure to set ip2 in all paths
through the code. Thanks to GCC 4.9 for the warning.
+2014-12-20 Arnold D. Robbins <arnold@skeeve.com>
+
+ Enable non-fatal output on per-file or global basis,
+ via PROCINFO.
+
+ * awk.h (RED_NON_FATAL): New redirection flag.
+ * builtin.c (efwrite): If RED_NON_FATAL set, just set ERRNO and return.
+ (do_printf): Check errflg and if set, set ERRNO and return.
+ (do_print): Ditto.
+ (do_print_rec): Ditto.
+ * io.c (redflags2str): Update table.
+ (redirect): Check for global PROCINFO["nonfatal"] or for
+ PROCINFO[file, "nonfatal"] and don't fail on open if set.
+ Add RED_NON_FATAL to flags.
+ (in_PROCINFO): Make smarter and more general.
+
2014-12-12 Stephen Davies <sdavies@sdc.com.au>
Improve comment handling in pretty printing.
diff --git a/TODO b/TODO
index 3670f126..65aa0f15 100644
--- a/TODO
+++ b/TODO
@@ -1,4 +1,4 @@
-Sun Sep 28 22:19:10 IDT 2014
+Wed Dec 24 20:41:38 IST 2014
============================
There were too many files tracking different thoughts and ideas for
@@ -44,9 +44,6 @@ Minor New Features
Consider relaxing the strictness of --posix.
- Make it possible to put print/printf + redirections into
- an expression.
-
? Add an optional base to strtonum, allowing 2-36.
? Optional third argument for index indicating where to start the
diff --git a/awk.h b/awk.h
index 799295b5..7a44c1d0 100644
--- a/awk.h
+++ b/awk.h
@@ -1482,7 +1482,7 @@ extern void register_two_way_processor(awk_two_way_processor_t *processor);
extern void set_FNR(void);
extern void set_NR(void);
-extern struct redirect *redirect(NODE *redir_exp, int redirtype, int *errflg);
+extern struct redirect *redirect(NODE *redir_exp, int redirtype, int *errflg, bool failure_fatal);
extern NODE *do_close(int nargs);
extern int flush_io(void);
extern int close_io(bool *stdio_problem);
@@ -1494,6 +1494,8 @@ extern NODE *do_getline(int intovar, IOBUF *iop);
extern struct redirect *getredirect(const char *str, int len);
extern bool inrec(IOBUF *iop, int *errcode);
extern int nextfile(IOBUF **curfile, bool skipping);
+extern bool is_non_fatal_std(FILE *fp);
+extern bool is_non_fatal_redirect(const char *str);
/* main.c */
extern int arg_assign(char *arg, bool initing);
extern int is_std_var(const char *var);
diff --git a/builtin.c b/builtin.c
index 38a974fc..37f5ffc7 100644
--- a/builtin.c
+++ b/builtin.c
@@ -129,10 +129,14 @@ wrerror:
if (fp == stdout && errno == EPIPE)
gawk_exit(EXIT_FATAL);
+
/* otherwise die verbosely */
- fatal(_("%s to \"%s\" failed (%s)"), from,
- rp ? rp->value : _("standard output"),
- errno ? strerror(errno) : _("reason unknown"));
+ if ((rp != NULL) ? is_non_fatal_redirect(rp->value) : is_non_fatal_std(fp))
+ update_ERRNO_int(errno);
+ else
+ fatal(_("%s to \"%s\" failed (%s)"), from,
+ rp ? rp->value : _("standard output"),
+ errno ? strerror(errno) : _("reason unknown"));
}
/* do_exp --- exponential function */
@@ -1639,7 +1643,7 @@ do_printf(int nargs, int redirtype)
FILE *fp = NULL;
NODE *tmp;
struct redirect *rp = NULL;
- int errflg; /* not used, sigh */
+ int errflg = 0;
NODE *redir_exp = NULL;
if (nargs == 0) {
@@ -1650,7 +1654,7 @@ do_printf(int nargs, int redirtype)
redir_exp = TOP();
if (redir_exp->type != Node_val)
fatal(_("attempt to use array `%s' in a scalar context"), array_vname(redir_exp));
- rp = redirect(redir_exp, redirtype, & errflg);
+ rp = redirect(redir_exp, redirtype, & errflg, true);
DEREF(redir_exp);
decr_sp();
}
@@ -1663,9 +1667,13 @@ do_printf(int nargs, int redirtype)
redir_exp = PEEK(nargs);
if (redir_exp->type != Node_val)
fatal(_("attempt to use array `%s' in a scalar context"), array_vname(redir_exp));
- rp = redirect(redir_exp, redirtype, & errflg);
+ rp = redirect(redir_exp, redirtype, & errflg, true);
if (rp != NULL)
fp = rp->output.fp;
+ else if (errflg) {
+ update_ERRNO_int(errflg);
+ return;
+ }
} else if (do_debug) /* only the debugger can change the default output */
fp = output_fp;
else
@@ -2078,7 +2086,7 @@ void
do_print(int nargs, int redirtype)
{
struct redirect *rp = NULL;
- int errflg; /* not used, sigh */
+ int errflg = 0;
FILE *fp = NULL;
int i;
NODE *redir_exp = NULL;
@@ -2090,9 +2098,13 @@ do_print(int nargs, int redirtype)
redir_exp = PEEK(nargs);
if (redir_exp->type != Node_val)
fatal(_("attempt to use array `%s' in a scalar context"), array_vname(redir_exp));
- rp = redirect(redir_exp, redirtype, & errflg);
+ rp = redirect(redir_exp, redirtype, & errflg, true);
if (rp != NULL)
fp = rp->output.fp;
+ else if (errflg) {
+ update_ERRNO_int(errflg);
+ return;
+ }
} else if (do_debug) /* only the debugger can change the default output */
fp = output_fp;
else
@@ -2148,13 +2160,13 @@ do_print_rec(int nargs, int redirtype)
FILE *fp = NULL;
NODE *f0;
struct redirect *rp = NULL;
- int errflg; /* not used, sigh */
+ int errflg = 0;
NODE *redir_exp = NULL;
assert(nargs == 0);
if (redirtype != 0) {
redir_exp = TOP();
- rp = redirect(redir_exp, redirtype, & errflg);
+ rp = redirect(redir_exp, redirtype, & errflg, true);
if (rp != NULL)
fp = rp->output.fp;
DEREF(redir_exp);
@@ -2162,6 +2174,11 @@ do_print_rec(int nargs, int redirtype)
} else
fp = output_fp;
+ if (errflg) {
+ update_ERRNO_int(errflg);
+ return;
+ }
+
if (fp == NULL)
return;
diff --git a/doc/ChangeLog b/doc/ChangeLog
index bfb0dbed..5d8c4a5e 100644
--- a/doc/ChangeLog
+++ b/doc/ChangeLog
@@ -61,12 +61,21 @@
* gawkinet.texi: Fix capitalization in document title.
* gawktexi.in: Here we go again: Starting on more O'Reilly fixes.
+2014-12-27 Arnold D. Robbins <arnold@skeeve.com>
+
+ * gawktexi.in: Add info that nonfatal I/O works with stdout and
+ stderr. Revise version info and what was added when.
+
2014-12-26 Antonio Giovanni Colombo <azc100@gmail.com>
* gawktexi.in (Glossary): Really sort the items.
2014-12-24 Arnold D. Robbins <arnold@skeeve.com>
+ * gawktexi.in: Start documenting nonfatal output.
+
+2014-12-24 Arnold D. Robbins <arnold@skeeve.com>
+
* gawktexi.in: Add one more paragraph to new foreword.
* gawktexi.in: Fix exponentiation in TeX mode. Thanks to
Marco Curreli by way of Antonio Giovanni Columbo.
diff --git a/doc/gawk.info b/doc/gawk.info
index 21e8fd3b..d83370e8 100644
--- a/doc/gawk.info
+++ b/doc/gawk.info
@@ -246,6 +246,7 @@ entitled "GNU Free Documentation License".
* Special Caveats:: Things to watch out for.
* Close Files And Pipes:: Closing Input and Output Files and
Pipes.
+* Nonfatal:: Enabling Nonfatal Output.
* Output Summary:: Output summary.
* Output Exercises:: Exercises.
* Values:: Constants, Variables, and Regular
@@ -6122,6 +6123,7 @@ function.
`gawk' allows access to inherited file
descriptors.
* Close Files And Pipes:: Closing Input and Output Files and Pipes.
+* Nonfatal:: Enabling Nonfatal Output.
* Output Summary:: Output summary.
* Output Exercises:: Exercises.
@@ -7035,7 +7037,7 @@ that `gawk' provides:
behavior.

-File: gawk.info, Node: Close Files And Pipes, Next: Output Summary, Prev: Special Files, Up: Printing
+File: gawk.info, Node: Close Files And Pipes, Next: Nonfatal, Prev: Special Files, Up: Printing
5.9 Closing Input and Output Redirections
=========================================
@@ -7204,9 +7206,61 @@ call. See the system manual pages for information on how to decode this
value.

-File: gawk.info, Node: Output Summary, Next: Output Exercises, Prev: Close Files And Pipes, Up: Printing
+File: gawk.info, Node: Nonfatal, Next: Output Summary, Prev: Close Files And Pipes, Up: Printing
-5.10 Summary
+5.10 Enabling Nonfatal Output
+=============================
+
+This minor node describes a `gawk'-specific feature.
+
+ In standard `awk', output with `print' or `printf' to a nonexistent
+file, or some other I/O error (such as filling up the disk) is a fatal
+error.
+
+ $ gawk 'BEGIN { print "hi" > "/no/such/file" }'
+ error--> gawk: cmd. line:1: fatal: can't redirect to `/no/such/file' (No such file or directory)
+
+ `gawk' makes it possible to detect that an error has occurred,
+allowing you to possibly recover from the error, or at least print an
+error message of your choosing before exiting. You can do this in one
+of two ways:
+
+ * For all output files, by assigning any value to
+ `PROCINFO["nonfatal"]'.
+
+ * On a per-file basis, by assigning any value to `PROCINFO[FILENAME,
+ "nonfatal"]'. Here, FILENAME is the name of the file to which you
+ wish output to be nonfatal.
+
+ Once you have enabled nonfatal output, you must check `ERRNO' after
+every relevant `print' or `printf' statement to see if something went
+wrong. It is also a good idea to initialize `ERRNO' to zero before
+attempting the output. For example:
+
+ $ gawk '
+ > BEGIN {
+ > PROCINFO["nonfatal"] = 1
+ > ERRNO = 0
+ > print "hi" > "/no/such/file"
+ > if (ERRNO) {
+ > print("Output failed:", ERRNO) > "/dev/stderr"
+ > exit 1
+ > }
+ > }'
+ error--> Output failed: No such file or directory
+
+ Here, `gawk' did not produce a fatal error; instead it let the `awk'
+program code detect the problem and handle it.
+
+ This mechanism works also for standard output and standard error.
+For standard output, you may use `PROCINFO["-", "nonfatal"]' or
+`PROCINFO["/dev/stdout", "nonfatal"]'. For standard error, use
+`PROCINFO["/dev/stderr", "nonfatal"]'.
+
+
+File: gawk.info, Node: Output Summary, Next: Output Exercises, Prev: Nonfatal, Up: Printing
+
+5.11 Summary
============
* The `print' statement prints comma-separated expressions. Each
@@ -7228,11 +7282,16 @@ File: gawk.info, Node: Output Summary, Next: Output Exercises, Prev: Close Fi
For coprocesses, it is possible to close only one direction of the
communications.
+ * Normally errors with `print' or `printf' are fatal. `gawk' lets
+ you make output errors be nonfatal either for all files or on a
+ per-file basis. You must then check for errors after every
+ relevant output statement.
+

File: gawk.info, Node: Output Exercises, Prev: Output Summary, Up: Printing
-5.11 Exercises
+5.12 Exercises
==============
1. Rewrite the program:
@@ -26468,6 +26527,9 @@ the current version of `gawk'.
- Directories on the command line produce a warning and are
skipped (*note Command-line directories::).
+ - Output with `print' and `printf' need not be fatal (*note
+ Nonfatal::).
+
* New keywords:
- The `BEGINFILE' and `ENDFILE' special patterns (*note
@@ -26985,6 +27047,8 @@ in POSIX `awk', in the order they were added to `gawk'.
* The maximum number of hexdecimal digits in `\x' escapes is now two.
*Note Escape Sequences::.
+ * Nonfatal output with `print' and `printf'. *Note Nonfatal::.
+
* Support for MirBSD was removed.

@@ -34656,560 +34720,561 @@ Index

Tag Table:
Node: Top1204
-Node: Foreword342225
-Node: Foreword446669
-Node: Preface48200
-Ref: Preface-Footnote-151071
-Ref: Preface-Footnote-251178
-Ref: Preface-Footnote-351411
-Node: History51553
-Node: Names53904
-Ref: Names-Footnote-154997
-Node: This Manual55143
-Ref: This Manual-Footnote-161643
-Node: Conventions61743
-Node: Manual History64080
-Ref: Manual History-Footnote-167073
-Ref: Manual History-Footnote-267114
-Node: How To Contribute67188
-Node: Acknowledgments68317
-Node: Getting Started73134
-Node: Running gawk75573
-Node: One-shot76763
-Node: Read Terminal78027
-Node: Long80058
-Node: Executable Scripts81571
-Ref: Executable Scripts-Footnote-184360
-Node: Comments84463
-Node: Quoting86945
-Node: DOS Quoting92463
-Node: Sample Data Files93138
-Node: Very Simple95733
-Node: Two Rules100632
-Node: More Complex102518
-Node: Statements/Lines105380
-Ref: Statements/Lines-Footnote-1109835
-Node: Other Features110100
-Node: When111036
-Ref: When-Footnote-1112790
-Node: Intro Summary112855
-Node: Invoking Gawk113739
-Node: Command Line115253
-Node: Options116051
-Ref: Options-Footnote-1131846
-Ref: Options-Footnote-2132075
-Node: Other Arguments132100
-Node: Naming Standard Input135048
-Node: Environment Variables136141
-Node: AWKPATH Variable136699
-Ref: AWKPATH Variable-Footnote-1140106
-Ref: AWKPATH Variable-Footnote-2140151
-Node: AWKLIBPATH Variable140411
-Node: Other Environment Variables141667
-Node: Exit Status145185
-Node: Include Files145861
-Node: Loading Shared Libraries149450
-Node: Obsolete150877
-Node: Undocumented151569
-Node: Invoking Summary151836
-Node: Regexp153499
-Node: Regexp Usage154953
-Node: Escape Sequences156990
-Node: Regexp Operators163219
-Ref: Regexp Operators-Footnote-1170629
-Ref: Regexp Operators-Footnote-2170776
-Node: Bracket Expressions170874
-Ref: table-char-classes172889
-Node: Leftmost Longest175831
-Node: Computed Regexps177133
-Node: GNU Regexp Operators180562
-Node: Case-sensitivity184234
-Ref: Case-sensitivity-Footnote-1187119
-Ref: Case-sensitivity-Footnote-2187354
-Node: Regexp Summary187462
-Node: Reading Files188929
-Node: Records191022
-Node: awk split records191755
-Node: gawk split records196684
-Ref: gawk split records-Footnote-1201223
-Node: Fields201260
-Ref: Fields-Footnote-1204038
-Node: Nonconstant Fields204124
-Ref: Nonconstant Fields-Footnote-1206362
-Node: Changing Fields206565
-Node: Field Separators212496
-Node: Default Field Splitting215200
-Node: Regexp Field Splitting216317
-Node: Single Character Fields219667
-Node: Command Line Field Separator220726
-Node: Full Line Fields223943
-Ref: Full Line Fields-Footnote-1225464
-Ref: Full Line Fields-Footnote-2225510
-Node: Field Splitting Summary225611
-Node: Constant Size227685
-Node: Splitting By Content232268
-Ref: Splitting By Content-Footnote-1236233
-Node: Multiple Line236396
-Ref: Multiple Line-Footnote-1242277
-Node: Getline242456
-Node: Plain Getline244663
-Node: Getline/Variable247303
-Node: Getline/File248452
-Node: Getline/Variable/File249837
-Ref: Getline/Variable/File-Footnote-1251440
-Node: Getline/Pipe251527
-Node: Getline/Variable/Pipe254205
-Node: Getline/Coprocess255336
-Node: Getline/Variable/Coprocess256600
-Node: Getline Notes257339
-Node: Getline Summary260133
-Ref: table-getline-variants260545
-Node: Read Timeout261374
-Ref: Read Timeout-Footnote-1265211
-Node: Command-line directories265269
-Node: Input Summary266174
-Node: Input Exercises269559
-Node: Printing270287
-Node: Print272064
-Node: Print Examples273521
-Node: Output Separators276300
-Node: OFMT278318
-Node: Printf279673
-Node: Basic Printf280458
-Node: Control Letters282030
-Node: Format Modifiers286015
-Node: Printf Examples292025
-Node: Redirection294511
-Node: Special FD301349
-Ref: Special FD-Footnote-1304515
-Node: Special Files304589
-Node: Other Inherited Files305206
-Node: Special Network306206
-Node: Special Caveats307068
-Node: Close Files And Pipes308017
-Ref: Close Files And Pipes-Footnote-1315208
-Ref: Close Files And Pipes-Footnote-2315356
-Node: Output Summary315506
-Node: Output Exercises316504
-Node: Expressions317184
-Node: Values318373
-Node: Constants319050
-Node: Scalar Constants319741
-Ref: Scalar Constants-Footnote-1320603
-Node: Nondecimal-numbers320853
-Node: Regexp Constants323863
-Node: Using Constant Regexps324389
-Node: Variables327552
-Node: Using Variables328209
-Node: Assignment Options330120
-Node: Conversion331995
-Node: Strings And Numbers332519
-Ref: Strings And Numbers-Footnote-1335584
-Node: Locale influences conversions335693
-Ref: table-locale-affects338439
-Node: All Operators339031
-Node: Arithmetic Ops339660
-Node: Concatenation342165
-Ref: Concatenation-Footnote-1344984
-Node: Assignment Ops345091
-Ref: table-assign-ops350070
-Node: Increment Ops351380
-Node: Truth Values and Conditions354811
-Node: Truth Values355894
-Node: Typing and Comparison356943
-Node: Variable Typing357759
-Node: Comparison Operators361426
-Ref: table-relational-ops361836
-Node: POSIX String Comparison365331
-Ref: POSIX String Comparison-Footnote-1366403
-Node: Boolean Ops366542
-Ref: Boolean Ops-Footnote-1371020
-Node: Conditional Exp371111
-Node: Function Calls372849
-Node: Precedence376729
-Node: Locales380389
-Node: Expressions Summary382021
-Node: Patterns and Actions384592
-Node: Pattern Overview385712
-Node: Regexp Patterns387391
-Node: Expression Patterns387934
-Node: Ranges391643
-Node: BEGIN/END394750
-Node: Using BEGIN/END395511
-Ref: Using BEGIN/END-Footnote-1398247
-Node: I/O And BEGIN/END398353
-Node: BEGINFILE/ENDFILE400668
-Node: Empty403565
-Node: Using Shell Variables403882
-Node: Action Overview406155
-Node: Statements408481
-Node: If Statement410329
-Node: While Statement411824
-Node: Do Statement413852
-Node: For Statement415000
-Node: Switch Statement418158
-Node: Break Statement420540
-Node: Continue Statement422581
-Node: Next Statement424408
-Node: Nextfile Statement426789
-Node: Exit Statement429417
-Node: Built-in Variables431828
-Node: User-modified432961
-Ref: User-modified-Footnote-1440664
-Node: Auto-set440726
-Ref: Auto-set-Footnote-1454435
-Ref: Auto-set-Footnote-2454640
-Node: ARGC and ARGV454696
-Node: Pattern Action Summary458914
-Node: Arrays461347
-Node: Array Basics462676
-Node: Array Intro463520
-Ref: figure-array-elements465454
-Ref: Array Intro-Footnote-1468074
-Node: Reference to Elements468202
-Node: Assigning Elements470664
-Node: Array Example471155
-Node: Scanning an Array472914
-Node: Controlling Scanning475934
-Ref: Controlling Scanning-Footnote-1481328
-Node: Numeric Array Subscripts481644
-Node: Uninitialized Subscripts483829
-Node: Delete485446
-Ref: Delete-Footnote-1488195
-Node: Multidimensional488252
-Node: Multiscanning491349
-Node: Arrays of Arrays492938
-Node: Arrays Summary497692
-Node: Functions499783
-Node: Built-in500822
-Node: Calling Built-in501900
-Node: Numeric Functions503895
-Ref: Numeric Functions-Footnote-1508713
-Ref: Numeric Functions-Footnote-2509070
-Ref: Numeric Functions-Footnote-3509118
-Node: String Functions509390
-Ref: String Functions-Footnote-1532891
-Ref: String Functions-Footnote-2533020
-Ref: String Functions-Footnote-3533268
-Node: Gory Details533355
-Ref: table-sub-escapes535136
-Ref: table-sub-proposed536651
-Ref: table-posix-sub538013
-Ref: table-gensub-escapes539550
-Ref: Gory Details-Footnote-1540383
-Node: I/O Functions540534
-Ref: I/O Functions-Footnote-1547770
-Node: Time Functions547917
-Ref: Time Functions-Footnote-1558426
-Ref: Time Functions-Footnote-2558494
-Ref: Time Functions-Footnote-3558652
-Ref: Time Functions-Footnote-4558763
-Ref: Time Functions-Footnote-5558875
-Ref: Time Functions-Footnote-6559102
-Node: Bitwise Functions559368
-Ref: table-bitwise-ops559930
-Ref: Bitwise Functions-Footnote-1564258
-Node: Type Functions564430
-Node: I18N Functions565582
-Node: User-defined567229
-Node: Definition Syntax568034
-Ref: Definition Syntax-Footnote-1573693
-Node: Function Example573764
-Ref: Function Example-Footnote-1576685
-Node: Function Caveats576707
-Node: Calling A Function577225
-Node: Variable Scope578183
-Node: Pass By Value/Reference581176
-Node: Return Statement584673
-Node: Dynamic Typing587652
-Node: Indirect Calls588581
-Ref: Indirect Calls-Footnote-1599887
-Node: Functions Summary600015
-Node: Library Functions602717
-Ref: Library Functions-Footnote-1606325
-Ref: Library Functions-Footnote-2606468
-Node: Library Names606639
-Ref: Library Names-Footnote-1610097
-Ref: Library Names-Footnote-2610320
-Node: General Functions610406
-Node: Strtonum Function611509
-Node: Assert Function614531
-Node: Round Function617855
-Node: Cliff Random Function619396
-Node: Ordinal Functions620412
-Ref: Ordinal Functions-Footnote-1623475
-Ref: Ordinal Functions-Footnote-2623727
-Node: Join Function623938
-Ref: Join Function-Footnote-1625708
-Node: Getlocaltime Function625908
-Node: Readfile Function629652
-Node: Shell Quoting631624
-Node: Data File Management633025
-Node: Filetrans Function633657
-Node: Rewind Function637753
-Node: File Checking639139
-Ref: File Checking-Footnote-1640472
-Node: Empty Files640673
-Node: Ignoring Assigns642652
-Node: Getopt Function644202
-Ref: Getopt Function-Footnote-1655666
-Node: Passwd Functions655866
-Ref: Passwd Functions-Footnote-1664706
-Node: Group Functions664794
-Ref: Group Functions-Footnote-1672691
-Node: Walking Arrays672896
-Node: Library Functions Summary674496
-Node: Library Exercises675900
-Node: Sample Programs677180
-Node: Running Examples677950
-Node: Clones678678
-Node: Cut Program679902
-Node: Egrep Program689622
-Ref: Egrep Program-Footnote-1697125
-Node: Id Program697235
-Node: Split Program700911
-Ref: Split Program-Footnote-1704365
-Node: Tee Program704493
-Node: Uniq Program707282
-Node: Wc Program714701
-Ref: Wc Program-Footnote-1718951
-Node: Miscellaneous Programs719045
-Node: Dupword Program720258
-Node: Alarm Program722289
-Node: Translate Program727094
-Ref: Translate Program-Footnote-1731657
-Node: Labels Program731927
-Ref: Labels Program-Footnote-1735278
-Node: Word Sorting735362
-Node: History Sorting739432
-Node: Extract Program741267
-Node: Simple Sed748791
-Node: Igawk Program751861
-Ref: Igawk Program-Footnote-1766187
-Ref: Igawk Program-Footnote-2766388
-Ref: Igawk Program-Footnote-3766510
-Node: Anagram Program766625
-Node: Signature Program769686
-Node: Programs Summary770933
-Node: Programs Exercises772154
-Ref: Programs Exercises-Footnote-1776285
-Node: Advanced Features776376
-Node: Nondecimal Data778358
-Node: Array Sorting779948
-Node: Controlling Array Traversal780648
-Ref: Controlling Array Traversal-Footnote-1789014
-Node: Array Sorting Functions789132
-Ref: Array Sorting Functions-Footnote-1793018
-Node: Two-way I/O793214
-Ref: Two-way I/O-Footnote-1798159
-Ref: Two-way I/O-Footnote-2798345
-Node: TCP/IP Networking798427
-Node: Profiling801299
-Node: Advanced Features Summary809570
-Node: Internationalization811503
-Node: I18N and L10N812983
-Node: Explaining gettext813669
-Ref: Explaining gettext-Footnote-1818694
-Ref: Explaining gettext-Footnote-2818878
-Node: Programmer i18n819043
-Ref: Programmer i18n-Footnote-1823919
-Node: Translator i18n823968
-Node: String Extraction824762
-Ref: String Extraction-Footnote-1825893
-Node: Printf Ordering825979
-Ref: Printf Ordering-Footnote-1828765
-Node: I18N Portability828829
-Ref: I18N Portability-Footnote-1831285
-Node: I18N Example831348
-Ref: I18N Example-Footnote-1834151
-Node: Gawk I18N834223
-Node: I18N Summary834867
-Node: Debugger836207
-Node: Debugging837229
-Node: Debugging Concepts837670
-Node: Debugging Terms839480
-Node: Awk Debugging842052
-Node: Sample Debugging Session842958
-Node: Debugger Invocation843492
-Node: Finding The Bug844877
-Node: List of Debugger Commands851356
-Node: Breakpoint Control852688
-Node: Debugger Execution Control856365
-Node: Viewing And Changing Data859724
-Node: Execution Stack863100
-Node: Debugger Info864735
-Node: Miscellaneous Debugger Commands868780
-Node: Readline Support873781
-Node: Limitations874675
-Node: Debugging Summary876790
-Node: Arbitrary Precision Arithmetic877964
-Node: Computer Arithmetic879380
-Ref: table-numeric-ranges882978
-Ref: Computer Arithmetic-Footnote-1883837
-Node: Math Definitions883894
-Ref: table-ieee-formats887182
-Ref: Math Definitions-Footnote-1887786
-Node: MPFR features887891
-Node: FP Math Caution889562
-Ref: FP Math Caution-Footnote-1890612
-Node: Inexactness of computations890981
-Node: Inexact representation891940
-Node: Comparing FP Values893297
-Node: Errors accumulate894379
-Node: Getting Accuracy895812
-Node: Try To Round898474
-Node: Setting precision899373
-Ref: table-predefined-precision-strings900057
-Node: Setting the rounding mode901846
-Ref: table-gawk-rounding-modes902210
-Ref: Setting the rounding mode-Footnote-1905665
-Node: Arbitrary Precision Integers905844
-Ref: Arbitrary Precision Integers-Footnote-1910744
-Node: POSIX Floating Point Problems910893
-Ref: POSIX Floating Point Problems-Footnote-1914766
-Node: Floating point summary914804
-Node: Dynamic Extensions916998
-Node: Extension Intro918550
-Node: Plugin License919816
-Node: Extension Mechanism Outline920613
-Ref: figure-load-extension921041
-Ref: figure-register-new-function922521
-Ref: figure-call-new-function923525
-Node: Extension API Description925511
-Node: Extension API Functions Introduction926961
-Node: General Data Types931785
-Ref: General Data Types-Footnote-1937524
-Node: Memory Allocation Functions937823
-Ref: Memory Allocation Functions-Footnote-1940662
-Node: Constructor Functions940758
-Node: Registration Functions942492
-Node: Extension Functions943177
-Node: Exit Callback Functions945474
-Node: Extension Version String946722
-Node: Input Parsers947387
-Node: Output Wrappers957266
-Node: Two-way processors961781
-Node: Printing Messages963985
-Ref: Printing Messages-Footnote-1965061
-Node: Updating `ERRNO'965213
-Node: Requesting Values965953
-Ref: table-value-types-returned966681
-Node: Accessing Parameters967638
-Node: Symbol Table Access968869
-Node: Symbol table by name969383
-Node: Symbol table by cookie971364
-Ref: Symbol table by cookie-Footnote-1975508
-Node: Cached values975571
-Ref: Cached values-Footnote-1979070
-Node: Array Manipulation979161
-Ref: Array Manipulation-Footnote-1980259
-Node: Array Data Types980296
-Ref: Array Data Types-Footnote-1982951
-Node: Array Functions983043
-Node: Flattening Arrays986897
-Node: Creating Arrays993789
-Node: Extension API Variables998560
-Node: Extension Versioning999196
-Node: Extension API Informational Variables1001097
-Node: Extension API Boilerplate1002162
-Node: Finding Extensions1005971
-Node: Extension Example1006531
-Node: Internal File Description1007303
-Node: Internal File Ops1011370
-Ref: Internal File Ops-Footnote-11023040
-Node: Using Internal File Ops1023180
-Ref: Using Internal File Ops-Footnote-11025563
-Node: Extension Samples1025836
-Node: Extension Sample File Functions1027362
-Node: Extension Sample Fnmatch1035000
-Node: Extension Sample Fork1036491
-Node: Extension Sample Inplace1037706
-Node: Extension Sample Ord1039381
-Node: Extension Sample Readdir1040217
-Ref: table-readdir-file-types1041093
-Node: Extension Sample Revout1041904
-Node: Extension Sample Rev2way1042494
-Node: Extension Sample Read write array1043234
-Node: Extension Sample Readfile1045174
-Node: Extension Sample Time1046269
-Node: Extension Sample API Tests1047618
-Node: gawkextlib1048109
-Node: Extension summary1050767
-Node: Extension Exercises1054456
-Node: Language History1055178
-Node: V7/SVR3.11056834
-Node: SVR41059015
-Node: POSIX1060460
-Node: BTL1061849
-Node: POSIX/GNU1062583
-Node: Feature History1068372
-Node: Common Extensions1082098
-Node: Ranges and Locales1083422
-Ref: Ranges and Locales-Footnote-11088040
-Ref: Ranges and Locales-Footnote-21088067
-Ref: Ranges and Locales-Footnote-31088301
-Node: Contributors1088522
-Node: History summary1094063
-Node: Installation1095433
-Node: Gawk Distribution1096379
-Node: Getting1096863
-Node: Extracting1097686
-Node: Distribution contents1099321
-Node: Unix Installation1105386
-Node: Quick Installation1106069
-Node: Shell Startup Files1108480
-Node: Additional Configuration Options1109559
-Node: Configuration Philosophy1111298
-Node: Non-Unix Installation1113667
-Node: PC Installation1114125
-Node: PC Binary Installation1115444
-Node: PC Compiling1117292
-Ref: PC Compiling-Footnote-11120313
-Node: PC Testing1120422
-Node: PC Using1121598
-Node: Cygwin1125713
-Node: MSYS1126536
-Node: VMS Installation1127036
-Node: VMS Compilation1127828
-Ref: VMS Compilation-Footnote-11129050
-Node: VMS Dynamic Extensions1129108
-Node: VMS Installation Details1130792
-Node: VMS Running1133044
-Node: VMS GNV1135880
-Node: VMS Old Gawk1136614
-Node: Bugs1137084
-Node: Other Versions1140967
-Node: Installation summary1147391
-Node: Notes1148447
-Node: Compatibility Mode1149312
-Node: Additions1150094
-Node: Accessing The Source1151019
-Node: Adding Code1152454
-Node: New Ports1158611
-Node: Derived Files1163093
-Ref: Derived Files-Footnote-11168568
-Ref: Derived Files-Footnote-21168602
-Ref: Derived Files-Footnote-31169198
-Node: Future Extensions1169312
-Node: Implementation Limitations1169918
-Node: Extension Design1171166
-Node: Old Extension Problems1172320
-Ref: Old Extension Problems-Footnote-11173837
-Node: Extension New Mechanism Goals1173894
-Ref: Extension New Mechanism Goals-Footnote-11177254
-Node: Extension Other Design Decisions1177443
-Node: Extension Future Growth1179551
-Node: Old Extension Mechanism1180387
-Node: Notes summary1182149
-Node: Basic Concepts1183335
-Node: Basic High Level1184016
-Ref: figure-general-flow1184288
-Ref: figure-process-flow1184887
-Ref: Basic High Level-Footnote-11188116
-Node: Basic Data Typing1188301
-Node: Glossary1191629
-Node: Copying1223558
-Node: GNU Free Documentation License1261114
-Node: Index1286250
+Node: Foreword342291
+Node: Foreword446735
+Node: Preface48266
+Ref: Preface-Footnote-151137
+Ref: Preface-Footnote-251244
+Ref: Preface-Footnote-351477
+Node: History51619
+Node: Names53970
+Ref: Names-Footnote-155063
+Node: This Manual55209
+Ref: This Manual-Footnote-161709
+Node: Conventions61809
+Node: Manual History64146
+Ref: Manual History-Footnote-167139
+Ref: Manual History-Footnote-267180
+Node: How To Contribute67254
+Node: Acknowledgments68383
+Node: Getting Started73200
+Node: Running gawk75639
+Node: One-shot76829
+Node: Read Terminal78093
+Node: Long80124
+Node: Executable Scripts81637
+Ref: Executable Scripts-Footnote-184426
+Node: Comments84529
+Node: Quoting87011
+Node: DOS Quoting92529
+Node: Sample Data Files93204
+Node: Very Simple95799
+Node: Two Rules100698
+Node: More Complex102584
+Node: Statements/Lines105446
+Ref: Statements/Lines-Footnote-1109901
+Node: Other Features110166
+Node: When111102
+Ref: When-Footnote-1112856
+Node: Intro Summary112921
+Node: Invoking Gawk113805
+Node: Command Line115319
+Node: Options116117
+Ref: Options-Footnote-1131912
+Ref: Options-Footnote-2132141
+Node: Other Arguments132166
+Node: Naming Standard Input135114
+Node: Environment Variables136207
+Node: AWKPATH Variable136765
+Ref: AWKPATH Variable-Footnote-1140172
+Ref: AWKPATH Variable-Footnote-2140217
+Node: AWKLIBPATH Variable140477
+Node: Other Environment Variables141733
+Node: Exit Status145251
+Node: Include Files145927
+Node: Loading Shared Libraries149516
+Node: Obsolete150943
+Node: Undocumented151635
+Node: Invoking Summary151902
+Node: Regexp153565
+Node: Regexp Usage155019
+Node: Escape Sequences157056
+Node: Regexp Operators163285
+Ref: Regexp Operators-Footnote-1170695
+Ref: Regexp Operators-Footnote-2170842
+Node: Bracket Expressions170940
+Ref: table-char-classes172955
+Node: Leftmost Longest175897
+Node: Computed Regexps177199
+Node: GNU Regexp Operators180628
+Node: Case-sensitivity184300
+Ref: Case-sensitivity-Footnote-1187185
+Ref: Case-sensitivity-Footnote-2187420
+Node: Regexp Summary187528
+Node: Reading Files188995
+Node: Records191088
+Node: awk split records191821
+Node: gawk split records196750
+Ref: gawk split records-Footnote-1201289
+Node: Fields201326
+Ref: Fields-Footnote-1204104
+Node: Nonconstant Fields204190
+Ref: Nonconstant Fields-Footnote-1206428
+Node: Changing Fields206631
+Node: Field Separators212562
+Node: Default Field Splitting215266
+Node: Regexp Field Splitting216383
+Node: Single Character Fields219733
+Node: Command Line Field Separator220792
+Node: Full Line Fields224009
+Ref: Full Line Fields-Footnote-1225530
+Ref: Full Line Fields-Footnote-2225576
+Node: Field Splitting Summary225677
+Node: Constant Size227751
+Node: Splitting By Content232334
+Ref: Splitting By Content-Footnote-1236299
+Node: Multiple Line236462
+Ref: Multiple Line-Footnote-1242343
+Node: Getline242522
+Node: Plain Getline244729
+Node: Getline/Variable247369
+Node: Getline/File248518
+Node: Getline/Variable/File249903
+Ref: Getline/Variable/File-Footnote-1251506
+Node: Getline/Pipe251593
+Node: Getline/Variable/Pipe254271
+Node: Getline/Coprocess255402
+Node: Getline/Variable/Coprocess256666
+Node: Getline Notes257405
+Node: Getline Summary260199
+Ref: table-getline-variants260611
+Node: Read Timeout261440
+Ref: Read Timeout-Footnote-1265277
+Node: Command-line directories265335
+Node: Input Summary266240
+Node: Input Exercises269625
+Node: Printing270353
+Node: Print272188
+Node: Print Examples273645
+Node: Output Separators276424
+Node: OFMT278442
+Node: Printf279797
+Node: Basic Printf280582
+Node: Control Letters282154
+Node: Format Modifiers286139
+Node: Printf Examples292149
+Node: Redirection294635
+Node: Special FD301473
+Ref: Special FD-Footnote-1304639
+Node: Special Files304713
+Node: Other Inherited Files305330
+Node: Special Network306330
+Node: Special Caveats307192
+Node: Close Files And Pipes308141
+Ref: Close Files And Pipes-Footnote-1315326
+Ref: Close Files And Pipes-Footnote-2315474
+Node: Nonfatal315624
+Node: Output Summary317547
+Node: Output Exercises318768
+Node: Expressions319448
+Node: Values320637
+Node: Constants321314
+Node: Scalar Constants322005
+Ref: Scalar Constants-Footnote-1322867
+Node: Nondecimal-numbers323117
+Node: Regexp Constants326127
+Node: Using Constant Regexps326653
+Node: Variables329816
+Node: Using Variables330473
+Node: Assignment Options332384
+Node: Conversion334259
+Node: Strings And Numbers334783
+Ref: Strings And Numbers-Footnote-1337848
+Node: Locale influences conversions337957
+Ref: table-locale-affects340703
+Node: All Operators341295
+Node: Arithmetic Ops341924
+Node: Concatenation344429
+Ref: Concatenation-Footnote-1347248
+Node: Assignment Ops347355
+Ref: table-assign-ops352334
+Node: Increment Ops353644
+Node: Truth Values and Conditions357075
+Node: Truth Values358158
+Node: Typing and Comparison359207
+Node: Variable Typing360023
+Node: Comparison Operators363690
+Ref: table-relational-ops364100
+Node: POSIX String Comparison367595
+Ref: POSIX String Comparison-Footnote-1368667
+Node: Boolean Ops368806
+Ref: Boolean Ops-Footnote-1373284
+Node: Conditional Exp373375
+Node: Function Calls375113
+Node: Precedence378993
+Node: Locales382653
+Node: Expressions Summary384285
+Node: Patterns and Actions386856
+Node: Pattern Overview387976
+Node: Regexp Patterns389655
+Node: Expression Patterns390198
+Node: Ranges393907
+Node: BEGIN/END397014
+Node: Using BEGIN/END397775
+Ref: Using BEGIN/END-Footnote-1400511
+Node: I/O And BEGIN/END400617
+Node: BEGINFILE/ENDFILE402932
+Node: Empty405829
+Node: Using Shell Variables406146
+Node: Action Overview408419
+Node: Statements410745
+Node: If Statement412593
+Node: While Statement414088
+Node: Do Statement416116
+Node: For Statement417264
+Node: Switch Statement420422
+Node: Break Statement422804
+Node: Continue Statement424845
+Node: Next Statement426672
+Node: Nextfile Statement429053
+Node: Exit Statement431681
+Node: Built-in Variables434092
+Node: User-modified435225
+Ref: User-modified-Footnote-1442928
+Node: Auto-set442990
+Ref: Auto-set-Footnote-1456699
+Ref: Auto-set-Footnote-2456904
+Node: ARGC and ARGV456960
+Node: Pattern Action Summary461178
+Node: Arrays463611
+Node: Array Basics464940
+Node: Array Intro465784
+Ref: figure-array-elements467718
+Ref: Array Intro-Footnote-1470338
+Node: Reference to Elements470466
+Node: Assigning Elements472928
+Node: Array Example473419
+Node: Scanning an Array475178
+Node: Controlling Scanning478198
+Ref: Controlling Scanning-Footnote-1483592
+Node: Numeric Array Subscripts483908
+Node: Uninitialized Subscripts486093
+Node: Delete487710
+Ref: Delete-Footnote-1490459
+Node: Multidimensional490516
+Node: Multiscanning493613
+Node: Arrays of Arrays495202
+Node: Arrays Summary499956
+Node: Functions502047
+Node: Built-in503086
+Node: Calling Built-in504164
+Node: Numeric Functions506159
+Ref: Numeric Functions-Footnote-1510977
+Ref: Numeric Functions-Footnote-2511334
+Ref: Numeric Functions-Footnote-3511382
+Node: String Functions511654
+Ref: String Functions-Footnote-1535155
+Ref: String Functions-Footnote-2535284
+Ref: String Functions-Footnote-3535532
+Node: Gory Details535619
+Ref: table-sub-escapes537400
+Ref: table-sub-proposed538915
+Ref: table-posix-sub540277
+Ref: table-gensub-escapes541814
+Ref: Gory Details-Footnote-1542647
+Node: I/O Functions542798
+Ref: I/O Functions-Footnote-1550034
+Node: Time Functions550181
+Ref: Time Functions-Footnote-1560690
+Ref: Time Functions-Footnote-2560758
+Ref: Time Functions-Footnote-3560916
+Ref: Time Functions-Footnote-4561027
+Ref: Time Functions-Footnote-5561139
+Ref: Time Functions-Footnote-6561366
+Node: Bitwise Functions561632
+Ref: table-bitwise-ops562194
+Ref: Bitwise Functions-Footnote-1566522
+Node: Type Functions566694
+Node: I18N Functions567846
+Node: User-defined569493
+Node: Definition Syntax570298
+Ref: Definition Syntax-Footnote-1575957
+Node: Function Example576028
+Ref: Function Example-Footnote-1578949
+Node: Function Caveats578971
+Node: Calling A Function579489
+Node: Variable Scope580447
+Node: Pass By Value/Reference583440
+Node: Return Statement586937
+Node: Dynamic Typing589916
+Node: Indirect Calls590845
+Ref: Indirect Calls-Footnote-1602151
+Node: Functions Summary602279
+Node: Library Functions604981
+Ref: Library Functions-Footnote-1608589
+Ref: Library Functions-Footnote-2608732
+Node: Library Names608903
+Ref: Library Names-Footnote-1612361
+Ref: Library Names-Footnote-2612584
+Node: General Functions612670
+Node: Strtonum Function613773
+Node: Assert Function616795
+Node: Round Function620119
+Node: Cliff Random Function621660
+Node: Ordinal Functions622676
+Ref: Ordinal Functions-Footnote-1625739
+Ref: Ordinal Functions-Footnote-2625991
+Node: Join Function626202
+Ref: Join Function-Footnote-1627972
+Node: Getlocaltime Function628172
+Node: Readfile Function631916
+Node: Shell Quoting633888
+Node: Data File Management635289
+Node: Filetrans Function635921
+Node: Rewind Function640017
+Node: File Checking641403
+Ref: File Checking-Footnote-1642736
+Node: Empty Files642937
+Node: Ignoring Assigns644916
+Node: Getopt Function646466
+Ref: Getopt Function-Footnote-1657930
+Node: Passwd Functions658130
+Ref: Passwd Functions-Footnote-1666970
+Node: Group Functions667058
+Ref: Group Functions-Footnote-1674955
+Node: Walking Arrays675160
+Node: Library Functions Summary676760
+Node: Library Exercises678164
+Node: Sample Programs679444
+Node: Running Examples680214
+Node: Clones680942
+Node: Cut Program682166
+Node: Egrep Program691886
+Ref: Egrep Program-Footnote-1699389
+Node: Id Program699499
+Node: Split Program703175
+Ref: Split Program-Footnote-1706629
+Node: Tee Program706757
+Node: Uniq Program709546
+Node: Wc Program716965
+Ref: Wc Program-Footnote-1721215
+Node: Miscellaneous Programs721309
+Node: Dupword Program722522
+Node: Alarm Program724553
+Node: Translate Program729358
+Ref: Translate Program-Footnote-1733921
+Node: Labels Program734191
+Ref: Labels Program-Footnote-1737542
+Node: Word Sorting737626
+Node: History Sorting741696
+Node: Extract Program743531
+Node: Simple Sed751055
+Node: Igawk Program754125
+Ref: Igawk Program-Footnote-1768451
+Ref: Igawk Program-Footnote-2768652
+Ref: Igawk Program-Footnote-3768774
+Node: Anagram Program768889
+Node: Signature Program771950
+Node: Programs Summary773197
+Node: Programs Exercises774418
+Ref: Programs Exercises-Footnote-1778549
+Node: Advanced Features778640
+Node: Nondecimal Data780622
+Node: Array Sorting782212
+Node: Controlling Array Traversal782912
+Ref: Controlling Array Traversal-Footnote-1791278
+Node: Array Sorting Functions791396
+Ref: Array Sorting Functions-Footnote-1795282
+Node: Two-way I/O795478
+Ref: Two-way I/O-Footnote-1800423
+Ref: Two-way I/O-Footnote-2800609
+Node: TCP/IP Networking800691
+Node: Profiling803563
+Node: Advanced Features Summary811834
+Node: Internationalization813767
+Node: I18N and L10N815247
+Node: Explaining gettext815933
+Ref: Explaining gettext-Footnote-1820958
+Ref: Explaining gettext-Footnote-2821142
+Node: Programmer i18n821307
+Ref: Programmer i18n-Footnote-1826183
+Node: Translator i18n826232
+Node: String Extraction827026
+Ref: String Extraction-Footnote-1828157
+Node: Printf Ordering828243
+Ref: Printf Ordering-Footnote-1831029
+Node: I18N Portability831093
+Ref: I18N Portability-Footnote-1833549
+Node: I18N Example833612
+Ref: I18N Example-Footnote-1836415
+Node: Gawk I18N836487
+Node: I18N Summary837131
+Node: Debugger838471
+Node: Debugging839493
+Node: Debugging Concepts839934
+Node: Debugging Terms841744
+Node: Awk Debugging844316
+Node: Sample Debugging Session845222
+Node: Debugger Invocation845756
+Node: Finding The Bug847141
+Node: List of Debugger Commands853620
+Node: Breakpoint Control854952
+Node: Debugger Execution Control858629
+Node: Viewing And Changing Data861988
+Node: Execution Stack865364
+Node: Debugger Info866999
+Node: Miscellaneous Debugger Commands871044
+Node: Readline Support876045
+Node: Limitations876939
+Node: Debugging Summary879054
+Node: Arbitrary Precision Arithmetic880228
+Node: Computer Arithmetic881644
+Ref: table-numeric-ranges885242
+Ref: Computer Arithmetic-Footnote-1886101
+Node: Math Definitions886158
+Ref: table-ieee-formats889446
+Ref: Math Definitions-Footnote-1890050
+Node: MPFR features890155
+Node: FP Math Caution891826
+Ref: FP Math Caution-Footnote-1892876
+Node: Inexactness of computations893245
+Node: Inexact representation894204
+Node: Comparing FP Values895561
+Node: Errors accumulate896643
+Node: Getting Accuracy898076
+Node: Try To Round900738
+Node: Setting precision901637
+Ref: table-predefined-precision-strings902321
+Node: Setting the rounding mode904110
+Ref: table-gawk-rounding-modes904474
+Ref: Setting the rounding mode-Footnote-1907929
+Node: Arbitrary Precision Integers908108
+Ref: Arbitrary Precision Integers-Footnote-1913008
+Node: POSIX Floating Point Problems913157
+Ref: POSIX Floating Point Problems-Footnote-1917030
+Node: Floating point summary917068
+Node: Dynamic Extensions919262
+Node: Extension Intro920814
+Node: Plugin License922080
+Node: Extension Mechanism Outline922877
+Ref: figure-load-extension923305
+Ref: figure-register-new-function924785
+Ref: figure-call-new-function925789
+Node: Extension API Description927775
+Node: Extension API Functions Introduction929225
+Node: General Data Types934049
+Ref: General Data Types-Footnote-1939788
+Node: Memory Allocation Functions940087
+Ref: Memory Allocation Functions-Footnote-1942926
+Node: Constructor Functions943022
+Node: Registration Functions944756
+Node: Extension Functions945441
+Node: Exit Callback Functions947738
+Node: Extension Version String948986
+Node: Input Parsers949651
+Node: Output Wrappers959530
+Node: Two-way processors964045
+Node: Printing Messages966249
+Ref: Printing Messages-Footnote-1967325
+Node: Updating `ERRNO'967477
+Node: Requesting Values968217
+Ref: table-value-types-returned968945
+Node: Accessing Parameters969902
+Node: Symbol Table Access971133
+Node: Symbol table by name971647
+Node: Symbol table by cookie973628
+Ref: Symbol table by cookie-Footnote-1977772
+Node: Cached values977835
+Ref: Cached values-Footnote-1981334
+Node: Array Manipulation981425
+Ref: Array Manipulation-Footnote-1982523
+Node: Array Data Types982560
+Ref: Array Data Types-Footnote-1985215
+Node: Array Functions985307
+Node: Flattening Arrays989161
+Node: Creating Arrays996053
+Node: Extension API Variables1000824
+Node: Extension Versioning1001460
+Node: Extension API Informational Variables1003361
+Node: Extension API Boilerplate1004426
+Node: Finding Extensions1008235
+Node: Extension Example1008795
+Node: Internal File Description1009567
+Node: Internal File Ops1013634
+Ref: Internal File Ops-Footnote-11025304
+Node: Using Internal File Ops1025444
+Ref: Using Internal File Ops-Footnote-11027827
+Node: Extension Samples1028100
+Node: Extension Sample File Functions1029626
+Node: Extension Sample Fnmatch1037264
+Node: Extension Sample Fork1038755
+Node: Extension Sample Inplace1039970
+Node: Extension Sample Ord1041645
+Node: Extension Sample Readdir1042481
+Ref: table-readdir-file-types1043357
+Node: Extension Sample Revout1044168
+Node: Extension Sample Rev2way1044758
+Node: Extension Sample Read write array1045498
+Node: Extension Sample Readfile1047438
+Node: Extension Sample Time1048533
+Node: Extension Sample API Tests1049882
+Node: gawkextlib1050373
+Node: Extension summary1053031
+Node: Extension Exercises1056720
+Node: Language History1057442
+Node: V7/SVR3.11059098
+Node: SVR41061279
+Node: POSIX1062724
+Node: BTL1064113
+Node: POSIX/GNU1064847
+Node: Feature History1070728
+Node: Common Extensions1084522
+Node: Ranges and Locales1085846
+Ref: Ranges and Locales-Footnote-11090464
+Ref: Ranges and Locales-Footnote-21090491
+Ref: Ranges and Locales-Footnote-31090725
+Node: Contributors1090946
+Node: History summary1096487
+Node: Installation1097857
+Node: Gawk Distribution1098803
+Node: Getting1099287
+Node: Extracting1100110
+Node: Distribution contents1101745
+Node: Unix Installation1107810
+Node: Quick Installation1108493
+Node: Shell Startup Files1110904
+Node: Additional Configuration Options1111983
+Node: Configuration Philosophy1113722
+Node: Non-Unix Installation1116091
+Node: PC Installation1116549
+Node: PC Binary Installation1117868
+Node: PC Compiling1119716
+Ref: PC Compiling-Footnote-11122737
+Node: PC Testing1122846
+Node: PC Using1124022
+Node: Cygwin1128137
+Node: MSYS1128960
+Node: VMS Installation1129460
+Node: VMS Compilation1130252
+Ref: VMS Compilation-Footnote-11131474
+Node: VMS Dynamic Extensions1131532
+Node: VMS Installation Details1133216
+Node: VMS Running1135468
+Node: VMS GNV1138304
+Node: VMS Old Gawk1139038
+Node: Bugs1139508
+Node: Other Versions1143391
+Node: Installation summary1149815
+Node: Notes1150871
+Node: Compatibility Mode1151736
+Node: Additions1152518
+Node: Accessing The Source1153443
+Node: Adding Code1154878
+Node: New Ports1161035
+Node: Derived Files1165517
+Ref: Derived Files-Footnote-11170992
+Ref: Derived Files-Footnote-21171026
+Ref: Derived Files-Footnote-31171622
+Node: Future Extensions1171736
+Node: Implementation Limitations1172342
+Node: Extension Design1173590
+Node: Old Extension Problems1174744
+Ref: Old Extension Problems-Footnote-11176261
+Node: Extension New Mechanism Goals1176318
+Ref: Extension New Mechanism Goals-Footnote-11179678
+Node: Extension Other Design Decisions1179867
+Node: Extension Future Growth1181975
+Node: Old Extension Mechanism1182811
+Node: Notes summary1184573
+Node: Basic Concepts1185759
+Node: Basic High Level1186440
+Ref: figure-general-flow1186712
+Ref: figure-process-flow1187311
+Ref: Basic High Level-Footnote-11190540
+Node: Basic Data Typing1190725
+Node: Glossary1194053
+Node: Copying1225982
+Node: GNU Free Documentation License1263538
+Node: Index1288674

End Tag Table
diff --git a/doc/gawk.texi b/doc/gawk.texi
index 1f0fd2ac..81568fe7 100644
--- a/doc/gawk.texi
+++ b/doc/gawk.texi
@@ -633,6 +633,7 @@ particular records in a file and perform operations upon them.
* Special Caveats:: Things to watch out for.
* Close Files And Pipes:: Closing Input and Output Files and
Pipes.
+* Nonfatal:: Enabling Nonfatal Output.
* Output Summary:: Output summary.
* Output Exercises:: Exercises.
* Values:: Constants, Variables, and Regular
@@ -8929,6 +8930,7 @@ and discusses the @code{close()} built-in function.
@command{gawk} allows access to inherited file
descriptors.
* Close Files And Pipes:: Closing Input and Output Files and Pipes.
+* Nonfatal:: Enabling Nonfatal Output.
* Output Summary:: Output summary.
* Output Exercises:: Exercises.
@end menu
@@ -10435,6 +10437,63 @@ when closing a pipe.
@end ifnotdocbook
+@node Nonfatal
+@section Enabling Nonfatal Output
+
+This @value{SECTION} describes a @command{gawk}-specific feature.
+
+In standard @command{awk}, output with @code{print} or @code{printf}
+to a nonexistent file, or some other I/O error (such as filling up the
+disk) is a fatal error.
+
+@example
+$ @kbd{gawk 'BEGIN @{ print "hi" > "/no/such/file" @}'}
+@error{} gawk: cmd. line:1: fatal: can't redirect to `/no/such/file' (No such file or directory)
+@end example
+
+@command{gawk} makes it possible to detect that an error has
+occurred, allowing you to possibly recover from the error, or
+at least print an error message of your choosing before exiting.
+You can do this in one of two ways:
+
+@itemize @bullet
+@item
+For all output files, by assigning any value to @code{PROCINFO["nonfatal"]}.
+
+@item
+On a per-file basis, by assigning any value to
+@code{PROCINFO[@var{filename}, "nonfatal"]}.
+Here, @var{filename} is the name of the file to which
+you wish output to be nonfatal.
+@end itemize
+
+Once you have enabled nonfatal output, you must check @code{ERRNO}
+after every relevant @code{print} or @code{printf} statement to
+see if something went wrong. It is also a good idea to initialize
+@code{ERRNO} to zero before attempting the output. For example:
+
+@example
+$ @kbd{gawk '}
+> @kbd{BEGIN @{}
+> @kbd{ PROCINFO["nonfatal"] = 1}
+> @kbd{ ERRNO = 0}
+> @kbd{ print "hi" > "/no/such/file"}
+> @kbd{ if (ERRNO) @{}
+> @kbd{ print("Output failed:", ERRNO) > "/dev/stderr"}
+> @kbd{ exit 1}
+> @kbd{ @}}
+> @kbd{@}'}
+@error{} Output failed: No such file or directory
+@end example
+
+Here, @command{gawk} did not produce a fatal error; instead
+it let the @command{awk} program code detect the problem and handle it.
+
+This mechanism works also for standard output and standard error.
+For standard output, you may use @code{PROCINFO["-", "nonfatal"]}
+or @code{PROCINFO["/dev/stdout", "nonfatal"]}. For standard error, use
+@code{PROCINFO["/dev/stderr", "nonfatal"]}.
+
@node Output Summary
@section Summary
@@ -10463,6 +10522,12 @@ Use @code{close()} to close open file, pipe, and coprocess redirections.
For coprocesses, it is possible to close only one direction of the
communications.
+@item
+Normally errors with @code{print} or @code{printf} are fatal.
+@command{gawk} lets you make output errors be nonfatal either for
+all files or on a per-file basis. You must then check for errors
+after every relevant output statement.
+
@end itemize
@c EXCLUDE START
@@ -35650,6 +35715,10 @@ Indirect function calls
@item
Directories on the command line produce a warning and are skipped
(@pxref{Command-line directories}).
+
+@item
+Output with @code{print} and @code{printf} need not be fatal
+(@pxref{Nonfatal}).
@end itemize
@item
@@ -36529,6 +36598,10 @@ is now two.
@xref{Escape Sequences}.
@item
+Nonfatal output with @code{print} and @code{printf}.
+@xref{Nonfatal}.
+
+@item
Support for MirBSD was removed.
@end itemize
diff --git a/doc/gawktexi.in b/doc/gawktexi.in
index 38e741e1..e127f428 100644
--- a/doc/gawktexi.in
+++ b/doc/gawktexi.in
@@ -628,6 +628,7 @@ particular records in a file and perform operations upon them.
* Special Caveats:: Things to watch out for.
* Close Files And Pipes:: Closing Input and Output Files and
Pipes.
+* Nonfatal:: Enabling Nonfatal Output.
* Output Summary:: Output summary.
* Output Exercises:: Exercises.
* Values:: Constants, Variables, and Regular
@@ -8529,6 +8530,7 @@ and discusses the @code{close()} built-in function.
@command{gawk} allows access to inherited file
descriptors.
* Close Files And Pipes:: Closing Input and Output Files and Pipes.
+* Nonfatal:: Enabling Nonfatal Output.
* Output Summary:: Output summary.
* Output Exercises:: Exercises.
@end menu
@@ -9931,6 +9933,63 @@ when closing a pipe.
@end sidebar
+@node Nonfatal
+@section Enabling Nonfatal Output
+
+This @value{SECTION} describes a @command{gawk}-specific feature.
+
+In standard @command{awk}, output with @code{print} or @code{printf}
+to a nonexistent file, or some other I/O error (such as filling up the
+disk) is a fatal error.
+
+@example
+$ @kbd{gawk 'BEGIN @{ print "hi" > "/no/such/file" @}'}
+@error{} gawk: cmd. line:1: fatal: can't redirect to `/no/such/file' (No such file or directory)
+@end example
+
+@command{gawk} makes it possible to detect that an error has
+occurred, allowing you to possibly recover from the error, or
+at least print an error message of your choosing before exiting.
+You can do this in one of two ways:
+
+@itemize @bullet
+@item
+For all output files, by assigning any value to @code{PROCINFO["nonfatal"]}.
+
+@item
+On a per-file basis, by assigning any value to
+@code{PROCINFO[@var{filename}, "nonfatal"]}.
+Here, @var{filename} is the name of the file to which
+you wish output to be nonfatal.
+@end itemize
+
+Once you have enabled nonfatal output, you must check @code{ERRNO}
+after every relevant @code{print} or @code{printf} statement to
+see if something went wrong. It is also a good idea to initialize
+@code{ERRNO} to zero before attempting the output. For example:
+
+@example
+$ @kbd{gawk '}
+> @kbd{BEGIN @{}
+> @kbd{ PROCINFO["nonfatal"] = 1}
+> @kbd{ ERRNO = 0}
+> @kbd{ print "hi" > "/no/such/file"}
+> @kbd{ if (ERRNO) @{}
+> @kbd{ print("Output failed:", ERRNO) > "/dev/stderr"}
+> @kbd{ exit 1}
+> @kbd{ @}}
+> @kbd{@}'}
+@error{} Output failed: No such file or directory
+@end example
+
+Here, @command{gawk} did not produce a fatal error; instead
+it let the @command{awk} program code detect the problem and handle it.
+
+This mechanism works also for standard output and standard error.
+For standard output, you may use @code{PROCINFO["-", "nonfatal"]}
+or @code{PROCINFO["/dev/stdout", "nonfatal"]}. For standard error, use
+@code{PROCINFO["/dev/stderr", "nonfatal"]}.
+
@node Output Summary
@section Summary
@@ -9959,6 +10018,12 @@ Use @code{close()} to close open file, pipe, and coprocess redirections.
For coprocesses, it is possible to close only one direction of the
communications.
+@item
+Normally errors with @code{print} or @code{printf} are fatal.
+@command{gawk} lets you make output errors be nonfatal either for
+all files or on a per-file basis. You must then check for errors
+after every relevant output statement.
+
@end itemize
@c EXCLUDE START
@@ -34741,6 +34806,10 @@ Indirect function calls
@item
Directories on the command line produce a warning and are skipped
(@pxref{Command-line directories}).
+
+@item
+Output with @code{print} and @code{printf} need not be fatal
+(@pxref{Nonfatal}).
@end itemize
@item
@@ -35620,6 +35689,10 @@ is now two.
@xref{Escape Sequences}.
@item
+Nonfatal output with @code{print} and @code{printf}.
+@xref{Nonfatal}.
+
+@item
Support for MirBSD was removed.
@end itemize
diff --git a/io.c b/io.c
index 1d15d887..db8a0a2b 100644
--- a/io.c
+++ b/io.c
@@ -261,7 +261,6 @@ struct recmatch {
static int iop_close(IOBUF *iop);
-struct redirect *redirect(NODE *redir_exp, int redirtype, int *errflg);
static void close_one(void);
static int close_redir(struct redirect *rp, bool exitwarn, two_way_close_type how);
#ifndef PIPES_SIMULATED
@@ -727,7 +726,7 @@ redflags2str(int flags)
/* redirect --- Redirection for printf and print commands */
struct redirect *
-redirect(NODE *redir_exp, int redirtype, int *errflg)
+redirect(NODE *redir_exp, int redirtype, int *errflg, bool failure_fatal)
{
struct redirect *rp;
char *str;
@@ -892,6 +891,12 @@ redirect(NODE *redir_exp, int redirtype, int *errflg)
(void) flush_io();
os_restore_mode(fileno(stdin));
+ /*
+ * Don't check failure_fatal; see input pipe below.
+ * Note that the failure happens upon failure to fork,
+ * using a non-existant program will still succeed the
+ * popen().
+ */
if ((rp->output.fp = popen(str, binmode("w"))) == NULL)
fatal(_("can't open pipe `%s' for output (%s)"),
str, strerror(errno));
@@ -927,13 +932,11 @@ redirect(NODE *redir_exp, int redirtype, int *errflg)
case redirect_twoway:
direction = "to/from";
if (! two_way_open(str, rp)) {
-#ifdef HAVE_SOCKETS
- if (inetfile(str, NULL)) {
+ if (! failure_fatal || is_non_fatal_redirect(str)) {
*errflg = errno;
/* do not free rp, saving it for reuse (save_rp = rp) */
return NULL;
} else
-#endif
fatal(_("can't open two way pipe `%s' for input/output (%s)"),
str, strerror(errno));
}
@@ -1009,11 +1012,14 @@ redirect(NODE *redir_exp, int redirtype, int *errflg)
* can return -1. For output to file,
* complain. The shell will complain on
* a bad command to a pipe.
+ *
+ * 12/2014: Take nonfatal settings in PROCINFO into account.
*/
if (errflg != NULL)
*errflg = errno;
- if ( redirtype == redirect_output
- || redirtype == redirect_append) {
+ if (failure_fatal && ! is_non_fatal_redirect(str) &&
+ (redirtype == redirect_output
+ || redirtype == redirect_append)) {
/* multiple messages make life easier for translators */
if (*direction == 'f')
fatal(_("can't redirect from `%s' (%s)"),
@@ -1058,6 +1064,34 @@ getredirect(const char *str, int len)
return NULL;
}
+/* is_non_fatal_std --- return true if fp is stdout/stderr and nonfatal */
+
+bool
+is_non_fatal_std(FILE *fp)
+{
+ if (in_PROCINFO("nonfatal", NULL, NULL))
+ return true;
+
+ /* yucky logic. sigh. */
+ if (fp == stdout) {
+ return ( in_PROCINFO("-", "nonfatal", NULL) != NULL
+ || in_PROCINFO("/dev/stdout", "nonfatal", NULL) != NULL);
+ } else if (fp == stderr) {
+ return (in_PROCINFO("/dev/stderr", "nonfatal", NULL) != NULL);
+ }
+
+ return false;
+}
+
+/* is_non_fatal_redirect --- return true if redirected I/O should be nonfatal */
+
+bool
+is_non_fatal_redirect(const char *str)
+{
+ return in_PROCINFO("nonfatal", NULL, NULL) != NULL
+ || in_PROCINFO(str, "nonfatal", NULL) != NULL;
+}
+
/* close_one --- temporarily close an open file to re-use the fd */
static void
@@ -2421,7 +2455,7 @@ do_getline_redir(int into_variable, enum redirval redirtype)
assert(redirtype != redirect_none);
redir_exp = TOP();
- rp = redirect(redir_exp, redirtype, & redir_error);
+ rp = redirect(redir_exp, redirtype, & redir_error, false);
DEREF(redir_exp);
decr_sp();
if (rp == NULL) {
@@ -3799,12 +3833,21 @@ in_PROCINFO(const char *pidx1, const char *pidx2, NODE **full_idx)
NODE *r, *sub = NULL;
NODE *subsep = SUBSEP_node->var_value;
+ if (PROCINFO_node == NULL || (pidx1 == NULL && pidx2 == NULL))
+ return NULL;
+
/* full_idx is in+out parameter */
if (full_idx)
sub = *full_idx;
- str_len = strlen(pidx1) + subsep->stlen + strlen(pidx2);
+ if (pidx1 != NULL && pidx2 == NULL)
+ str_len = strlen(pidx1);
+ else if (pidx1 == NULL && pidx2 != NULL)
+ str_len = strlen(pidx2);
+ else
+ str_len = strlen(pidx1) + subsep->stlen + strlen(pidx2);
+
if (sub == NULL) {
emalloc(str, char *, str_len + 1, "in_PROCINFO");
sub = make_str_node(str, str_len, ALREADY_MALLOCED);
@@ -3818,8 +3861,14 @@ in_PROCINFO(const char *pidx1, const char *pidx2, NODE **full_idx)
sub->stlen = str_len;
}
- sprintf(sub->stptr, "%s%.*s%s", pidx1, (int)subsep->stlen,
- subsep->stptr, pidx2);
+ if (pidx1 != NULL && pidx2 == NULL)
+ strcpy(sub->stptr, pidx1);
+ else if (pidx1 == NULL && pidx2 != NULL)
+ strcpy(sub->stptr, pidx2);
+ else
+ sprintf(sub->stptr, "%s%.*s%s", pidx1, (int)subsep->stlen,
+ subsep->stptr, pidx2);
+
r = in_array(PROCINFO_node, sub);
if (! full_idx)
unref(sub);
diff --git a/test/ChangeLog b/test/ChangeLog
index e9d5620a..b0979d8a 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,9 @@
+2015-02-06 Arnold D. Robbins <arnold@skeeve.com>
+
+ * Makefile.am (nonfatal1, nonfatal2): New tests.
+ * nonfatal1.awk, nonfatal1.ok: New files.
+ * nonfatal2.awk, nonfatal2.ok: New files.
+
2015-02-01 Arnold D. Robbins <arnold@skeeve.com>
* Makefile.am (paramasfunc1, paramasfunc2): Now need --posix.
diff --git a/test/Makefile.am b/test/Makefile.am
index c4c0b8b3..053f89fd 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -597,6 +597,10 @@ EXTRA_DIST = \
nondec.ok \
nondec2.awk \
nondec2.ok \
+ nonfatal1.awk \
+ nonfatal1.ok \
+ nonfatal2.awk \
+ nonfatal2.ok \
nonl.awk \
nonl.ok \
noparms.awk \
@@ -1042,6 +1046,7 @@ GAWK_EXT_TESTS = \
lint lintold lintwarn \
manyfiles match1 match2 match3 mbstr1 \
nastyparm next nondec nondec2 \
+ nonfatal1 nonfatal2 \
patsplit posix printfbad1 printfbad2 printfbad3 printfbad4 printhuge procinfs \
profile1 profile2 profile3 profile4 profile5 profile6 profile7 \
profile8 pty1 \
diff --git a/test/Makefile.in b/test/Makefile.in
index 212cb779..25ea167b 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -854,6 +854,10 @@ EXTRA_DIST = \
nondec.ok \
nondec2.awk \
nondec2.ok \
+ nonfatal1.awk \
+ nonfatal1.ok \
+ nonfatal2.awk \
+ nonfatal2.ok \
nonl.awk \
nonl.ok \
noparms.awk \
@@ -1298,6 +1302,7 @@ GAWK_EXT_TESTS = \
lint lintold lintwarn \
manyfiles match1 match2 match3 mbstr1 \
nastyparm next nondec nondec2 \
+ nonfatal1 nonfatal2 \
patsplit posix printfbad1 printfbad2 printfbad3 printfbad4 printhuge procinfs \
profile1 profile2 profile3 profile4 profile5 profile6 profile7 \
profile8 pty1 \
@@ -3620,6 +3625,16 @@ nondec:
@AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+nonfatal1:
+ @echo $@
+ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
+nonfatal2:
+ @echo $@
+ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
patsplit:
@echo $@
@AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
diff --git a/test/Maketests b/test/Maketests
index f3639b0f..9e19a2d5 100644
--- a/test/Maketests
+++ b/test/Maketests
@@ -1147,6 +1147,16 @@ nondec:
@AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+nonfatal1:
+ @echo $@
+ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
+nonfatal2:
+ @echo $@
+ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
patsplit:
@echo $@
@AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
diff --git a/test/nonfatal1.awk b/test/nonfatal1.awk
new file mode 100644
index 00000000..83661284
--- /dev/null
+++ b/test/nonfatal1.awk
@@ -0,0 +1,5 @@
+BEGIN {
+ PROCINFO["nonfatal"]
+ print |& "/inet/tcp/0/ti10/357"
+ print ERRNO
+}
diff --git a/test/nonfatal1.ok b/test/nonfatal1.ok
new file mode 100644
index 00000000..b96b8e27
--- /dev/null
+++ b/test/nonfatal1.ok
@@ -0,0 +1,2 @@
+gawk: nonfatal1.awk:3: fatal: remote host and port information (ti10, 357) invalid
+EXIT CODE: 2
diff --git a/test/nonfatal2.awk b/test/nonfatal2.awk
new file mode 100644
index 00000000..f5db71c5
--- /dev/null
+++ b/test/nonfatal2.awk
@@ -0,0 +1,5 @@
+BEGIN {
+ PROCINFO["nonfatal"] = 1
+ print > "/dev/no/such/file"
+ print ERRNO
+}
diff --git a/test/nonfatal2.ok b/test/nonfatal2.ok
new file mode 100644
index 00000000..ddc88691
--- /dev/null
+++ b/test/nonfatal2.ok
@@ -0,0 +1 @@
+No such file or directory