aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog39
-rw-r--r--TODO5
-rw-r--r--awk.h4
-rw-r--r--builtin.c37
-rw-r--r--doc/ChangeLog10
-rw-r--r--doc/gawk.info1183
-rw-r--r--doc/gawk.texi73
-rw-r--r--doc/gawktexi.in73
-rw-r--r--io.c73
-rw-r--r--test/ChangeLog10
-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, 965 insertions, 585 deletions
diff --git a/ChangeLog b/ChangeLog
index 161c374b..f024ec17 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -26,6 +26,29 @@
* profile.c (pprint): Restore printing of count for rules.
Bug report by Hermann Peifer.
+2015-02-08 Arnold D. Robbins <arnold@skeeve.com>
+
+ * io.c: Make it "NONFATAL" everywhere.
+
+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,
@@ -133,6 +156,22 @@
* 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 1b809580..47756846 100644
--- a/doc/ChangeLog
+++ b/doc/ChangeLog
@@ -42,6 +42,7 @@
2015-02-08 Arnold D. Robbins <arnold@skeeve.com>
* gawktexi.in: O'Reilly fixes.
+ Make non-fatal i/o use "NONFATAL".
2015-02-06 Arnold D. Robbins <arnold@skeeve.com>
@@ -102,12 +103,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 Colombo.
diff --git a/doc/gawk.info b/doc/gawk.info
index 6cddc1ba..83a5d818 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
@@ -6128,6 +6129,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.
@@ -7041,7 +7043,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
=========================================
@@ -7210,9 +7212,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
@@ -7234,11 +7288,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:
@@ -26479,6 +26538,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
@@ -26994,6 +27056,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.

@@ -34667,560 +34731,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-154998
-Node: This Manual55144
-Ref: This Manual-Footnote-161644
-Node: Conventions61744
-Node: Manual History64081
-Ref: Manual History-Footnote-167074
-Ref: Manual History-Footnote-267115
-Node: How To Contribute67189
-Node: Acknowledgments68318
-Node: Getting Started73184
-Node: Running gawk75623
-Node: One-shot76813
-Node: Read Terminal78077
-Node: Long80108
-Node: Executable Scripts81621
-Ref: Executable Scripts-Footnote-184410
-Node: Comments84513
-Node: Quoting86995
-Node: DOS Quoting92513
-Node: Sample Data Files93188
-Node: Very Simple95783
-Node: Two Rules100682
-Node: More Complex102568
-Node: Statements/Lines105430
-Ref: Statements/Lines-Footnote-1109885
-Node: Other Features110150
-Node: When111086
-Ref: When-Footnote-1112840
-Node: Intro Summary112905
-Node: Invoking Gawk113789
-Node: Command Line115303
-Node: Options116101
-Ref: Options-Footnote-1131896
-Ref: Options-Footnote-2132125
-Node: Other Arguments132150
-Node: Naming Standard Input135098
-Node: Environment Variables136191
-Node: AWKPATH Variable136749
-Ref: AWKPATH Variable-Footnote-1140156
-Ref: AWKPATH Variable-Footnote-2140201
-Node: AWKLIBPATH Variable140461
-Node: Other Environment Variables141717
-Node: Exit Status145235
-Node: Include Files145911
-Node: Loading Shared Libraries149500
-Node: Obsolete150927
-Node: Undocumented151619
-Node: Invoking Summary151886
-Node: Regexp153549
-Node: Regexp Usage155003
-Node: Escape Sequences157040
-Node: Regexp Operators163269
-Ref: Regexp Operators-Footnote-1170679
-Ref: Regexp Operators-Footnote-2170826
-Node: Bracket Expressions170924
-Ref: table-char-classes172939
-Node: Leftmost Longest175881
-Node: Computed Regexps177183
-Node: GNU Regexp Operators180612
-Node: Case-sensitivity184284
-Ref: Case-sensitivity-Footnote-1187169
-Ref: Case-sensitivity-Footnote-2187404
-Node: Regexp Summary187512
-Node: Reading Files188979
-Node: Records191072
-Node: awk split records191805
-Node: gawk split records196734
-Ref: gawk split records-Footnote-1201273
-Node: Fields201310
-Ref: Fields-Footnote-1204088
-Node: Nonconstant Fields204174
-Ref: Nonconstant Fields-Footnote-1206412
-Node: Changing Fields206615
-Node: Field Separators212546
-Node: Default Field Splitting215250
-Node: Regexp Field Splitting216367
-Node: Single Character Fields219717
-Node: Command Line Field Separator220776
-Node: Full Line Fields223993
-Ref: Full Line Fields-Footnote-1225514
-Ref: Full Line Fields-Footnote-2225560
-Node: Field Splitting Summary225661
-Node: Constant Size227735
-Node: Splitting By Content232318
-Ref: Splitting By Content-Footnote-1236283
-Node: Multiple Line236446
-Ref: Multiple Line-Footnote-1242327
-Node: Getline242506
-Node: Plain Getline244713
-Node: Getline/Variable247353
-Node: Getline/File248502
-Node: Getline/Variable/File249887
-Ref: Getline/Variable/File-Footnote-1251490
-Node: Getline/Pipe251577
-Node: Getline/Variable/Pipe254255
-Node: Getline/Coprocess255386
-Node: Getline/Variable/Coprocess256650
-Node: Getline Notes257389
-Node: Getline Summary260183
-Ref: table-getline-variants260595
-Node: Read Timeout261424
-Ref: Read Timeout-Footnote-1265261
-Node: Command-line directories265319
-Node: Input Summary266224
-Node: Input Exercises269609
-Node: Printing270337
-Node: Print272114
-Node: Print Examples273571
-Node: Output Separators276350
-Node: OFMT278368
-Node: Printf279723
-Node: Basic Printf280508
-Node: Control Letters282080
-Node: Format Modifiers286065
-Node: Printf Examples292071
-Node: Redirection294557
-Node: Special FD301395
-Ref: Special FD-Footnote-1304561
-Node: Special Files304635
-Node: Other Inherited Files305252
-Node: Special Network306252
-Node: Special Caveats307114
-Node: Close Files And Pipes308063
-Ref: Close Files And Pipes-Footnote-1315254
-Ref: Close Files And Pipes-Footnote-2315402
-Node: Output Summary315552
-Node: Output Exercises316550
-Node: Expressions317230
-Node: Values318419
-Node: Constants319096
-Node: Scalar Constants319787
-Ref: Scalar Constants-Footnote-1320649
-Node: Nondecimal-numbers320899
-Node: Regexp Constants323909
-Node: Using Constant Regexps324435
-Node: Variables327598
-Node: Using Variables328255
-Node: Assignment Options330166
-Node: Conversion332041
-Node: Strings And Numbers332565
-Ref: Strings And Numbers-Footnote-1335630
-Node: Locale influences conversions335739
-Ref: table-locale-affects338485
-Node: All Operators339077
-Node: Arithmetic Ops339706
-Node: Concatenation342211
-Ref: Concatenation-Footnote-1345030
-Node: Assignment Ops345137
-Ref: table-assign-ops350116
-Node: Increment Ops351426
-Node: Truth Values and Conditions354857
-Node: Truth Values355940
-Node: Typing and Comparison356989
-Node: Variable Typing357805
-Node: Comparison Operators361472
-Ref: table-relational-ops361882
-Node: POSIX String Comparison365377
-Ref: POSIX String Comparison-Footnote-1366449
-Node: Boolean Ops366588
-Ref: Boolean Ops-Footnote-1371066
-Node: Conditional Exp371157
-Node: Function Calls372895
-Node: Precedence376775
-Node: Locales380435
-Node: Expressions Summary382067
-Node: Patterns and Actions384638
-Node: Pattern Overview385758
-Node: Regexp Patterns387437
-Node: Expression Patterns387980
-Node: Ranges391760
-Node: BEGIN/END394867
-Node: Using BEGIN/END395628
-Ref: Using BEGIN/END-Footnote-1398364
-Node: I/O And BEGIN/END398470
-Node: BEGINFILE/ENDFILE400785
-Node: Empty403682
-Node: Using Shell Variables403999
-Node: Action Overview406272
-Node: Statements408598
-Node: If Statement410446
-Node: While Statement411941
-Node: Do Statement413969
-Node: For Statement415117
-Node: Switch Statement418275
-Node: Break Statement420657
-Node: Continue Statement422750
-Node: Next Statement424577
-Node: Nextfile Statement426958
-Node: Exit Statement429586
-Node: Built-in Variables431997
-Node: User-modified433130
-Ref: User-modified-Footnote-1440764
-Node: Auto-set440826
-Ref: Auto-set-Footnote-1454535
-Ref: Auto-set-Footnote-2454740
-Node: ARGC and ARGV454796
-Node: Pattern Action Summary459014
-Node: Arrays461447
-Node: Array Basics462776
-Node: Array Intro463620
-Ref: figure-array-elements465554
-Ref: Array Intro-Footnote-1468174
-Node: Reference to Elements468302
-Node: Assigning Elements470764
-Node: Array Example471255
-Node: Scanning an Array473014
-Node: Controlling Scanning476034
-Ref: Controlling Scanning-Footnote-1481428
-Node: Numeric Array Subscripts481744
-Node: Uninitialized Subscripts483929
-Node: Delete485546
-Ref: Delete-Footnote-1488295
-Node: Multidimensional488352
-Node: Multiscanning491449
-Node: Arrays of Arrays493038
-Node: Arrays Summary497792
-Node: Functions499883
-Node: Built-in500922
-Node: Calling Built-in502000
-Node: Numeric Functions503995
-Ref: Numeric Functions-Footnote-1508813
-Ref: Numeric Functions-Footnote-2509170
-Ref: Numeric Functions-Footnote-3509218
-Node: String Functions509490
-Ref: String Functions-Footnote-1532991
-Ref: String Functions-Footnote-2533120
-Ref: String Functions-Footnote-3533368
-Node: Gory Details533455
-Ref: table-sub-escapes535236
-Ref: table-sub-proposed536751
-Ref: table-posix-sub538113
-Ref: table-gensub-escapes539650
-Ref: Gory Details-Footnote-1540483
-Node: I/O Functions540634
-Ref: I/O Functions-Footnote-1547870
-Node: Time Functions548017
-Ref: Time Functions-Footnote-1558526
-Ref: Time Functions-Footnote-2558594
-Ref: Time Functions-Footnote-3558752
-Ref: Time Functions-Footnote-4558863
-Ref: Time Functions-Footnote-5558975
-Ref: Time Functions-Footnote-6559202
-Node: Bitwise Functions559468
-Ref: table-bitwise-ops560030
-Ref: Bitwise Functions-Footnote-1564358
-Node: Type Functions564530
-Node: I18N Functions565682
-Node: User-defined567329
-Node: Definition Syntax568134
-Ref: Definition Syntax-Footnote-1573793
-Node: Function Example573864
-Ref: Function Example-Footnote-1576785
-Node: Function Caveats576807
-Node: Calling A Function577325
-Node: Variable Scope578283
-Node: Pass By Value/Reference581276
-Node: Return Statement584773
-Node: Dynamic Typing587752
-Node: Indirect Calls588681
-Ref: Indirect Calls-Footnote-1598546
-Node: Functions Summary598674
-Node: Library Functions601376
-Ref: Library Functions-Footnote-1604984
-Ref: Library Functions-Footnote-2605127
-Node: Library Names605298
-Ref: Library Names-Footnote-1608756
-Ref: Library Names-Footnote-2608979
-Node: General Functions609065
-Node: Strtonum Function610168
-Node: Assert Function613190
-Node: Round Function616514
-Node: Cliff Random Function618055
-Node: Ordinal Functions619071
-Ref: Ordinal Functions-Footnote-1622134
-Ref: Ordinal Functions-Footnote-2622386
-Node: Join Function622597
-Ref: Join Function-Footnote-1624367
-Node: Getlocaltime Function624567
-Node: Readfile Function628311
-Node: Shell Quoting630283
-Node: Data File Management631684
-Node: Filetrans Function632316
-Node: Rewind Function636412
-Node: File Checking637798
-Ref: File Checking-Footnote-1639131
-Node: Empty Files639332
-Node: Ignoring Assigns641311
-Node: Getopt Function642861
-Ref: Getopt Function-Footnote-1654325
-Node: Passwd Functions654525
-Ref: Passwd Functions-Footnote-1663365
-Node: Group Functions663453
-Ref: Group Functions-Footnote-1671350
-Node: Walking Arrays671555
-Node: Library Functions Summary674561
-Node: Library Exercises675963
-Node: Sample Programs677243
-Node: Running Examples678013
-Node: Clones678741
-Node: Cut Program679965
-Node: Egrep Program689685
-Ref: Egrep Program-Footnote-1697188
-Node: Id Program697298
-Node: Split Program700974
-Ref: Split Program-Footnote-1704428
-Node: Tee Program704556
-Node: Uniq Program707345
-Node: Wc Program714764
-Ref: Wc Program-Footnote-1719014
-Node: Miscellaneous Programs719108
-Node: Dupword Program720321
-Node: Alarm Program722352
-Node: Translate Program727157
-Ref: Translate Program-Footnote-1731720
-Node: Labels Program731990
-Ref: Labels Program-Footnote-1735341
-Node: Word Sorting735425
-Node: History Sorting739495
-Node: Extract Program741330
-Node: Simple Sed748854
-Node: Igawk Program751924
-Ref: Igawk Program-Footnote-1766250
-Ref: Igawk Program-Footnote-2766451
-Ref: Igawk Program-Footnote-3766573
-Node: Anagram Program766688
-Node: Signature Program769749
-Node: Programs Summary770996
-Node: Programs Exercises772217
-Ref: Programs Exercises-Footnote-1776348
-Node: Advanced Features776439
-Node: Nondecimal Data778421
-Node: Array Sorting780011
-Node: Controlling Array Traversal780711
-Ref: Controlling Array Traversal-Footnote-1789077
-Node: Array Sorting Functions789195
-Ref: Array Sorting Functions-Footnote-1793081
-Node: Two-way I/O793277
-Ref: Two-way I/O-Footnote-1798222
-Ref: Two-way I/O-Footnote-2798408
-Node: TCP/IP Networking798490
-Node: Profiling801362
-Node: Advanced Features Summary809633
-Node: Internationalization811566
-Node: I18N and L10N813046
-Node: Explaining gettext813732
-Ref: Explaining gettext-Footnote-1818757
-Ref: Explaining gettext-Footnote-2818941
-Node: Programmer i18n819106
-Ref: Programmer i18n-Footnote-1823982
-Node: Translator i18n824031
-Node: String Extraction824825
-Ref: String Extraction-Footnote-1825956
-Node: Printf Ordering826042
-Ref: Printf Ordering-Footnote-1828828
-Node: I18N Portability828892
-Ref: I18N Portability-Footnote-1831348
-Node: I18N Example831411
-Ref: I18N Example-Footnote-1834214
-Node: Gawk I18N834286
-Node: I18N Summary834930
-Node: Debugger836270
-Node: Debugging837292
-Node: Debugging Concepts837733
-Node: Debugging Terms839543
-Node: Awk Debugging842115
-Node: Sample Debugging Session843021
-Node: Debugger Invocation843555
-Node: Finding The Bug844940
-Node: List of Debugger Commands851419
-Node: Breakpoint Control852751
-Node: Debugger Execution Control856428
-Node: Viewing And Changing Data859787
-Node: Execution Stack863163
-Node: Debugger Info864798
-Node: Miscellaneous Debugger Commands868843
-Node: Readline Support873844
-Node: Limitations874738
-Node: Debugging Summary876853
-Node: Arbitrary Precision Arithmetic878027
-Node: Computer Arithmetic879443
-Ref: table-numeric-ranges883042
-Ref: Computer Arithmetic-Footnote-1883566
-Node: Math Definitions883623
-Ref: table-ieee-formats886918
-Ref: Math Definitions-Footnote-1887522
-Node: MPFR features887627
-Node: FP Math Caution889298
-Ref: FP Math Caution-Footnote-1890348
-Node: Inexactness of computations890717
-Node: Inexact representation891676
-Node: Comparing FP Values893034
-Node: Errors accumulate894116
-Node: Getting Accuracy895548
-Node: Try To Round898252
-Node: Setting precision899151
-Ref: table-predefined-precision-strings899835
-Node: Setting the rounding mode901664
-Ref: table-gawk-rounding-modes902028
-Ref: Setting the rounding mode-Footnote-1905480
-Node: Arbitrary Precision Integers905659
-Ref: Arbitrary Precision Integers-Footnote-1910557
-Node: POSIX Floating Point Problems910706
-Ref: POSIX Floating Point Problems-Footnote-1914585
-Node: Floating point summary914623
-Node: Dynamic Extensions916810
-Node: Extension Intro918362
-Node: Plugin License919627
-Node: Extension Mechanism Outline920424
-Ref: figure-load-extension920852
-Ref: figure-register-new-function922332
-Ref: figure-call-new-function923336
-Node: Extension API Description925323
-Node: Extension API Functions Introduction926773
-Node: General Data Types931594
-Ref: General Data Types-Footnote-1937494
-Node: Memory Allocation Functions937793
-Ref: Memory Allocation Functions-Footnote-1940632
-Node: Constructor Functions940731
-Node: Registration Functions942470
-Node: Extension Functions943155
-Node: Exit Callback Functions945452
-Node: Extension Version String946700
-Node: Input Parsers947363
-Node: Output Wrappers957238
-Node: Two-way processors961751
-Node: Printing Messages964014
-Ref: Printing Messages-Footnote-1965090
-Node: Updating `ERRNO'965242
-Node: Requesting Values965982
-Ref: table-value-types-returned966709
-Node: Accessing Parameters967666
-Node: Symbol Table Access968900
-Node: Symbol table by name969414
-Node: Symbol table by cookie971434
-Ref: Symbol table by cookie-Footnote-1975579
-Node: Cached values975642
-Ref: Cached values-Footnote-1979138
-Node: Array Manipulation979229
-Ref: Array Manipulation-Footnote-1980327
-Node: Array Data Types980364
-Ref: Array Data Types-Footnote-1983019
-Node: Array Functions983111
-Node: Flattening Arrays986970
-Node: Creating Arrays993872
-Node: Extension API Variables998643
-Node: Extension Versioning999279
-Node: Extension API Informational Variables1001170
-Node: Extension API Boilerplate1002235
-Node: Finding Extensions1006044
-Node: Extension Example1006604
-Node: Internal File Description1007376
-Node: Internal File Ops1011443
-Ref: Internal File Ops-Footnote-11023194
-Node: Using Internal File Ops1023334
-Ref: Using Internal File Ops-Footnote-11025717
-Node: Extension Samples1025990
-Node: Extension Sample File Functions1027518
-Node: Extension Sample Fnmatch1035199
-Node: Extension Sample Fork1036687
-Node: Extension Sample Inplace1037902
-Node: Extension Sample Ord1039578
-Node: Extension Sample Readdir1040414
-Ref: table-readdir-file-types1041291
-Node: Extension Sample Revout1042102
-Node: Extension Sample Rev2way1042691
-Node: Extension Sample Read write array1043431
-Node: Extension Sample Readfile1045371
-Node: Extension Sample Time1046466
-Node: Extension Sample API Tests1047814
-Node: gawkextlib1048305
-Node: Extension summary1050983
-Node: Extension Exercises1054672
-Node: Language History1055394
-Node: V7/SVR3.11057050
-Node: SVR41059203
-Node: POSIX1060637
-Node: BTL1062018
-Node: POSIX/GNU1062749
-Node: Feature History1068494
-Node: Common Extensions1082220
-Node: Ranges and Locales1083592
-Ref: Ranges and Locales-Footnote-11088211
-Ref: Ranges and Locales-Footnote-21088238
-Ref: Ranges and Locales-Footnote-31088473
-Node: Contributors1088694
-Node: History summary1094234
-Node: Installation1095613
-Node: Gawk Distribution1096559
-Node: Getting1097043
-Node: Extracting1097866
-Node: Distribution contents1099503
-Node: Unix Installation1105605
-Node: Quick Installation1106288
-Node: Shell Startup Files1108699
-Node: Additional Configuration Options1109778
-Node: Configuration Philosophy1111582
-Node: Non-Unix Installation1113951
-Node: PC Installation1114409
-Node: PC Binary Installation1115729
-Node: PC Compiling1117577
-Ref: PC Compiling-Footnote-11120598
-Node: PC Testing1120707
-Node: PC Using1121883
-Node: Cygwin1125998
-Node: MSYS1126768
-Node: VMS Installation1127269
-Node: VMS Compilation1128061
-Ref: VMS Compilation-Footnote-11129290
-Node: VMS Dynamic Extensions1129348
-Node: VMS Installation Details1131032
-Node: VMS Running1133283
-Node: VMS GNV1136123
-Node: VMS Old Gawk1136858
-Node: Bugs1137328
-Node: Other Versions1141217
-Node: Installation summary1147651
-Node: Notes1148710
-Node: Compatibility Mode1149575
-Node: Additions1150357
-Node: Accessing The Source1151282
-Node: Adding Code1152717
-Node: New Ports1158874
-Node: Derived Files1163356
-Ref: Derived Files-Footnote-11168831
-Ref: Derived Files-Footnote-21168865
-Ref: Derived Files-Footnote-31169461
-Node: Future Extensions1169575
-Node: Implementation Limitations1170181
-Node: Extension Design1171429
-Node: Old Extension Problems1172583
-Ref: Old Extension Problems-Footnote-11174100
-Node: Extension New Mechanism Goals1174157
-Ref: Extension New Mechanism Goals-Footnote-11177517
-Node: Extension Other Design Decisions1177706
-Node: Extension Future Growth1179814
-Node: Old Extension Mechanism1180650
-Node: Notes summary1182412
-Node: Basic Concepts1183598
-Node: Basic High Level1184279
-Ref: figure-general-flow1184551
-Ref: figure-process-flow1185150
-Ref: Basic High Level-Footnote-11188379
-Node: Basic Data Typing1188564
-Node: Glossary1191892
-Node: Copying1223821
-Node: GNU Free Documentation License1261377
-Node: Index1286513
+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-155064
+Node: This Manual55210
+Ref: This Manual-Footnote-161710
+Node: Conventions61810
+Node: Manual History64147
+Ref: Manual History-Footnote-167140
+Ref: Manual History-Footnote-267181
+Node: How To Contribute67255
+Node: Acknowledgments68384
+Node: Getting Started73250
+Node: Running gawk75689
+Node: One-shot76879
+Node: Read Terminal78143
+Node: Long80174
+Node: Executable Scripts81687
+Ref: Executable Scripts-Footnote-184476
+Node: Comments84579
+Node: Quoting87061
+Node: DOS Quoting92579
+Node: Sample Data Files93254
+Node: Very Simple95849
+Node: Two Rules100748
+Node: More Complex102634
+Node: Statements/Lines105496
+Ref: Statements/Lines-Footnote-1109951
+Node: Other Features110216
+Node: When111152
+Ref: When-Footnote-1112906
+Node: Intro Summary112971
+Node: Invoking Gawk113855
+Node: Command Line115369
+Node: Options116167
+Ref: Options-Footnote-1131962
+Ref: Options-Footnote-2132191
+Node: Other Arguments132216
+Node: Naming Standard Input135164
+Node: Environment Variables136257
+Node: AWKPATH Variable136815
+Ref: AWKPATH Variable-Footnote-1140222
+Ref: AWKPATH Variable-Footnote-2140267
+Node: AWKLIBPATH Variable140527
+Node: Other Environment Variables141783
+Node: Exit Status145301
+Node: Include Files145977
+Node: Loading Shared Libraries149566
+Node: Obsolete150993
+Node: Undocumented151685
+Node: Invoking Summary151952
+Node: Regexp153615
+Node: Regexp Usage155069
+Node: Escape Sequences157106
+Node: Regexp Operators163335
+Ref: Regexp Operators-Footnote-1170745
+Ref: Regexp Operators-Footnote-2170892
+Node: Bracket Expressions170990
+Ref: table-char-classes173005
+Node: Leftmost Longest175947
+Node: Computed Regexps177249
+Node: GNU Regexp Operators180678
+Node: Case-sensitivity184350
+Ref: Case-sensitivity-Footnote-1187235
+Ref: Case-sensitivity-Footnote-2187470
+Node: Regexp Summary187578
+Node: Reading Files189045
+Node: Records191138
+Node: awk split records191871
+Node: gawk split records196800
+Ref: gawk split records-Footnote-1201339
+Node: Fields201376
+Ref: Fields-Footnote-1204154
+Node: Nonconstant Fields204240
+Ref: Nonconstant Fields-Footnote-1206478
+Node: Changing Fields206681
+Node: Field Separators212612
+Node: Default Field Splitting215316
+Node: Regexp Field Splitting216433
+Node: Single Character Fields219783
+Node: Command Line Field Separator220842
+Node: Full Line Fields224059
+Ref: Full Line Fields-Footnote-1225580
+Ref: Full Line Fields-Footnote-2225626
+Node: Field Splitting Summary225727
+Node: Constant Size227801
+Node: Splitting By Content232384
+Ref: Splitting By Content-Footnote-1236349
+Node: Multiple Line236512
+Ref: Multiple Line-Footnote-1242393
+Node: Getline242572
+Node: Plain Getline244779
+Node: Getline/Variable247419
+Node: Getline/File248568
+Node: Getline/Variable/File249953
+Ref: Getline/Variable/File-Footnote-1251556
+Node: Getline/Pipe251643
+Node: Getline/Variable/Pipe254321
+Node: Getline/Coprocess255452
+Node: Getline/Variable/Coprocess256716
+Node: Getline Notes257455
+Node: Getline Summary260249
+Ref: table-getline-variants260661
+Node: Read Timeout261490
+Ref: Read Timeout-Footnote-1265327
+Node: Command-line directories265385
+Node: Input Summary266290
+Node: Input Exercises269675
+Node: Printing270403
+Node: Print272238
+Node: Print Examples273695
+Node: Output Separators276474
+Node: OFMT278492
+Node: Printf279847
+Node: Basic Printf280632
+Node: Control Letters282204
+Node: Format Modifiers286189
+Node: Printf Examples292195
+Node: Redirection294681
+Node: Special FD301519
+Ref: Special FD-Footnote-1304685
+Node: Special Files304759
+Node: Other Inherited Files305376
+Node: Special Network306376
+Node: Special Caveats307238
+Node: Close Files And Pipes308187
+Ref: Close Files And Pipes-Footnote-1315372
+Ref: Close Files And Pipes-Footnote-2315520
+Node: Nonfatal315670
+Node: Output Summary317593
+Node: Output Exercises318814
+Node: Expressions319494
+Node: Values320683
+Node: Constants321360
+Node: Scalar Constants322051
+Ref: Scalar Constants-Footnote-1322913
+Node: Nondecimal-numbers323163
+Node: Regexp Constants326173
+Node: Using Constant Regexps326699
+Node: Variables329862
+Node: Using Variables330519
+Node: Assignment Options332430
+Node: Conversion334305
+Node: Strings And Numbers334829
+Ref: Strings And Numbers-Footnote-1337894
+Node: Locale influences conversions338003
+Ref: table-locale-affects340749
+Node: All Operators341341
+Node: Arithmetic Ops341970
+Node: Concatenation344475
+Ref: Concatenation-Footnote-1347294
+Node: Assignment Ops347401
+Ref: table-assign-ops352380
+Node: Increment Ops353690
+Node: Truth Values and Conditions357121
+Node: Truth Values358204
+Node: Typing and Comparison359253
+Node: Variable Typing360069
+Node: Comparison Operators363736
+Ref: table-relational-ops364146
+Node: POSIX String Comparison367641
+Ref: POSIX String Comparison-Footnote-1368713
+Node: Boolean Ops368852
+Ref: Boolean Ops-Footnote-1373330
+Node: Conditional Exp373421
+Node: Function Calls375159
+Node: Precedence379039
+Node: Locales382699
+Node: Expressions Summary384331
+Node: Patterns and Actions386902
+Node: Pattern Overview388022
+Node: Regexp Patterns389701
+Node: Expression Patterns390244
+Node: Ranges394024
+Node: BEGIN/END397131
+Node: Using BEGIN/END397892
+Ref: Using BEGIN/END-Footnote-1400628
+Node: I/O And BEGIN/END400734
+Node: BEGINFILE/ENDFILE403049
+Node: Empty405946
+Node: Using Shell Variables406263
+Node: Action Overview408536
+Node: Statements410862
+Node: If Statement412710
+Node: While Statement414205
+Node: Do Statement416233
+Node: For Statement417381
+Node: Switch Statement420539
+Node: Break Statement422921
+Node: Continue Statement425014
+Node: Next Statement426841
+Node: Nextfile Statement429222
+Node: Exit Statement431850
+Node: Built-in Variables434261
+Node: User-modified435394
+Ref: User-modified-Footnote-1443028
+Node: Auto-set443090
+Ref: Auto-set-Footnote-1456799
+Ref: Auto-set-Footnote-2457004
+Node: ARGC and ARGV457060
+Node: Pattern Action Summary461278
+Node: Arrays463711
+Node: Array Basics465040
+Node: Array Intro465884
+Ref: figure-array-elements467818
+Ref: Array Intro-Footnote-1470438
+Node: Reference to Elements470566
+Node: Assigning Elements473028
+Node: Array Example473519
+Node: Scanning an Array475278
+Node: Controlling Scanning478298
+Ref: Controlling Scanning-Footnote-1483692
+Node: Numeric Array Subscripts484008
+Node: Uninitialized Subscripts486193
+Node: Delete487810
+Ref: Delete-Footnote-1490559
+Node: Multidimensional490616
+Node: Multiscanning493713
+Node: Arrays of Arrays495302
+Node: Arrays Summary500056
+Node: Functions502147
+Node: Built-in503186
+Node: Calling Built-in504264
+Node: Numeric Functions506259
+Ref: Numeric Functions-Footnote-1511077
+Ref: Numeric Functions-Footnote-2511434
+Ref: Numeric Functions-Footnote-3511482
+Node: String Functions511754
+Ref: String Functions-Footnote-1535255
+Ref: String Functions-Footnote-2535384
+Ref: String Functions-Footnote-3535632
+Node: Gory Details535719
+Ref: table-sub-escapes537500
+Ref: table-sub-proposed539015
+Ref: table-posix-sub540377
+Ref: table-gensub-escapes541914
+Ref: Gory Details-Footnote-1542747
+Node: I/O Functions542898
+Ref: I/O Functions-Footnote-1550134
+Node: Time Functions550281
+Ref: Time Functions-Footnote-1560790
+Ref: Time Functions-Footnote-2560858
+Ref: Time Functions-Footnote-3561016
+Ref: Time Functions-Footnote-4561127
+Ref: Time Functions-Footnote-5561239
+Ref: Time Functions-Footnote-6561466
+Node: Bitwise Functions561732
+Ref: table-bitwise-ops562294
+Ref: Bitwise Functions-Footnote-1566622
+Node: Type Functions566794
+Node: I18N Functions567946
+Node: User-defined569593
+Node: Definition Syntax570398
+Ref: Definition Syntax-Footnote-1576057
+Node: Function Example576128
+Ref: Function Example-Footnote-1579049
+Node: Function Caveats579071
+Node: Calling A Function579589
+Node: Variable Scope580547
+Node: Pass By Value/Reference583540
+Node: Return Statement587037
+Node: Dynamic Typing590016
+Node: Indirect Calls590945
+Ref: Indirect Calls-Footnote-1600810
+Node: Functions Summary600938
+Node: Library Functions603640
+Ref: Library Functions-Footnote-1607248
+Ref: Library Functions-Footnote-2607391
+Node: Library Names607562
+Ref: Library Names-Footnote-1611020
+Ref: Library Names-Footnote-2611243
+Node: General Functions611329
+Node: Strtonum Function612432
+Node: Assert Function615454
+Node: Round Function618778
+Node: Cliff Random Function620319
+Node: Ordinal Functions621335
+Ref: Ordinal Functions-Footnote-1624398
+Ref: Ordinal Functions-Footnote-2624650
+Node: Join Function624861
+Ref: Join Function-Footnote-1626631
+Node: Getlocaltime Function626831
+Node: Readfile Function630575
+Node: Shell Quoting632547
+Node: Data File Management633948
+Node: Filetrans Function634580
+Node: Rewind Function638676
+Node: File Checking640062
+Ref: File Checking-Footnote-1641395
+Node: Empty Files641596
+Node: Ignoring Assigns643575
+Node: Getopt Function645125
+Ref: Getopt Function-Footnote-1656589
+Node: Passwd Functions656789
+Ref: Passwd Functions-Footnote-1665629
+Node: Group Functions665717
+Ref: Group Functions-Footnote-1673614
+Node: Walking Arrays673819
+Node: Library Functions Summary676825
+Node: Library Exercises678227
+Node: Sample Programs679507
+Node: Running Examples680277
+Node: Clones681005
+Node: Cut Program682229
+Node: Egrep Program691949
+Ref: Egrep Program-Footnote-1699452
+Node: Id Program699562
+Node: Split Program703238
+Ref: Split Program-Footnote-1706692
+Node: Tee Program706820
+Node: Uniq Program709609
+Node: Wc Program717028
+Ref: Wc Program-Footnote-1721278
+Node: Miscellaneous Programs721372
+Node: Dupword Program722585
+Node: Alarm Program724616
+Node: Translate Program729421
+Ref: Translate Program-Footnote-1733984
+Node: Labels Program734254
+Ref: Labels Program-Footnote-1737605
+Node: Word Sorting737689
+Node: History Sorting741759
+Node: Extract Program743594
+Node: Simple Sed751118
+Node: Igawk Program754188
+Ref: Igawk Program-Footnote-1768514
+Ref: Igawk Program-Footnote-2768715
+Ref: Igawk Program-Footnote-3768837
+Node: Anagram Program768952
+Node: Signature Program772013
+Node: Programs Summary773260
+Node: Programs Exercises774481
+Ref: Programs Exercises-Footnote-1778612
+Node: Advanced Features778703
+Node: Nondecimal Data780685
+Node: Array Sorting782275
+Node: Controlling Array Traversal782975
+Ref: Controlling Array Traversal-Footnote-1791341
+Node: Array Sorting Functions791459
+Ref: Array Sorting Functions-Footnote-1795345
+Node: Two-way I/O795541
+Ref: Two-way I/O-Footnote-1800486
+Ref: Two-way I/O-Footnote-2800672
+Node: TCP/IP Networking800754
+Node: Profiling803626
+Node: Advanced Features Summary811897
+Node: Internationalization813830
+Node: I18N and L10N815310
+Node: Explaining gettext815996
+Ref: Explaining gettext-Footnote-1821021
+Ref: Explaining gettext-Footnote-2821205
+Node: Programmer i18n821370
+Ref: Programmer i18n-Footnote-1826246
+Node: Translator i18n826295
+Node: String Extraction827089
+Ref: String Extraction-Footnote-1828220
+Node: Printf Ordering828306
+Ref: Printf Ordering-Footnote-1831092
+Node: I18N Portability831156
+Ref: I18N Portability-Footnote-1833612
+Node: I18N Example833675
+Ref: I18N Example-Footnote-1836478
+Node: Gawk I18N836550
+Node: I18N Summary837194
+Node: Debugger838534
+Node: Debugging839556
+Node: Debugging Concepts839997
+Node: Debugging Terms841807
+Node: Awk Debugging844379
+Node: Sample Debugging Session845285
+Node: Debugger Invocation845819
+Node: Finding The Bug847204
+Node: List of Debugger Commands853683
+Node: Breakpoint Control855015
+Node: Debugger Execution Control858692
+Node: Viewing And Changing Data862051
+Node: Execution Stack865427
+Node: Debugger Info867062
+Node: Miscellaneous Debugger Commands871107
+Node: Readline Support876108
+Node: Limitations877002
+Node: Debugging Summary879117
+Node: Arbitrary Precision Arithmetic880291
+Node: Computer Arithmetic881707
+Ref: table-numeric-ranges885306
+Ref: Computer Arithmetic-Footnote-1885830
+Node: Math Definitions885887
+Ref: table-ieee-formats889182
+Ref: Math Definitions-Footnote-1889786
+Node: MPFR features889891
+Node: FP Math Caution891562
+Ref: FP Math Caution-Footnote-1892612
+Node: Inexactness of computations892981
+Node: Inexact representation893940
+Node: Comparing FP Values895298
+Node: Errors accumulate896380
+Node: Getting Accuracy897812
+Node: Try To Round900516
+Node: Setting precision901415
+Ref: table-predefined-precision-strings902099
+Node: Setting the rounding mode903928
+Ref: table-gawk-rounding-modes904292
+Ref: Setting the rounding mode-Footnote-1907744
+Node: Arbitrary Precision Integers907923
+Ref: Arbitrary Precision Integers-Footnote-1912821
+Node: POSIX Floating Point Problems912970
+Ref: POSIX Floating Point Problems-Footnote-1916849
+Node: Floating point summary916887
+Node: Dynamic Extensions919074
+Node: Extension Intro920626
+Node: Plugin License921891
+Node: Extension Mechanism Outline922688
+Ref: figure-load-extension923116
+Ref: figure-register-new-function924596
+Ref: figure-call-new-function925600
+Node: Extension API Description927587
+Node: Extension API Functions Introduction929037
+Node: General Data Types933858
+Ref: General Data Types-Footnote-1939758
+Node: Memory Allocation Functions940057
+Ref: Memory Allocation Functions-Footnote-1942896
+Node: Constructor Functions942995
+Node: Registration Functions944734
+Node: Extension Functions945419
+Node: Exit Callback Functions947716
+Node: Extension Version String948964
+Node: Input Parsers949627
+Node: Output Wrappers959502
+Node: Two-way processors964015
+Node: Printing Messages966278
+Ref: Printing Messages-Footnote-1967354
+Node: Updating `ERRNO'967506
+Node: Requesting Values968246
+Ref: table-value-types-returned968973
+Node: Accessing Parameters969930
+Node: Symbol Table Access971164
+Node: Symbol table by name971678
+Node: Symbol table by cookie973698
+Ref: Symbol table by cookie-Footnote-1977843
+Node: Cached values977906
+Ref: Cached values-Footnote-1981402
+Node: Array Manipulation981493
+Ref: Array Manipulation-Footnote-1982591
+Node: Array Data Types982628
+Ref: Array Data Types-Footnote-1985283
+Node: Array Functions985375
+Node: Flattening Arrays989234
+Node: Creating Arrays996136
+Node: Extension API Variables1000907
+Node: Extension Versioning1001543
+Node: Extension API Informational Variables1003434
+Node: Extension API Boilerplate1004499
+Node: Finding Extensions1008308
+Node: Extension Example1008868
+Node: Internal File Description1009640
+Node: Internal File Ops1013707
+Ref: Internal File Ops-Footnote-11025458
+Node: Using Internal File Ops1025598
+Ref: Using Internal File Ops-Footnote-11027981
+Node: Extension Samples1028254
+Node: Extension Sample File Functions1029782
+Node: Extension Sample Fnmatch1037463
+Node: Extension Sample Fork1038951
+Node: Extension Sample Inplace1040166
+Node: Extension Sample Ord1041842
+Node: Extension Sample Readdir1042678
+Ref: table-readdir-file-types1043555
+Node: Extension Sample Revout1044366
+Node: Extension Sample Rev2way1044955
+Node: Extension Sample Read write array1045695
+Node: Extension Sample Readfile1047635
+Node: Extension Sample Time1048730
+Node: Extension Sample API Tests1050078
+Node: gawkextlib1050569
+Node: Extension summary1053247
+Node: Extension Exercises1056936
+Node: Language History1057658
+Node: V7/SVR3.11059314
+Node: SVR41061467
+Node: POSIX1062901
+Node: BTL1064282
+Node: POSIX/GNU1065013
+Node: Feature History1070849
+Node: Common Extensions1084643
+Node: Ranges and Locales1086015
+Ref: Ranges and Locales-Footnote-11090634
+Ref: Ranges and Locales-Footnote-21090661
+Ref: Ranges and Locales-Footnote-31090896
+Node: Contributors1091117
+Node: History summary1096657
+Node: Installation1098036
+Node: Gawk Distribution1098982
+Node: Getting1099466
+Node: Extracting1100289
+Node: Distribution contents1101926
+Node: Unix Installation1108028
+Node: Quick Installation1108711
+Node: Shell Startup Files1111122
+Node: Additional Configuration Options1112201
+Node: Configuration Philosophy1114005
+Node: Non-Unix Installation1116374
+Node: PC Installation1116832
+Node: PC Binary Installation1118152
+Node: PC Compiling1120000
+Ref: PC Compiling-Footnote-11123021
+Node: PC Testing1123130
+Node: PC Using1124306
+Node: Cygwin1128421
+Node: MSYS1129191
+Node: VMS Installation1129692
+Node: VMS Compilation1130484
+Ref: VMS Compilation-Footnote-11131713
+Node: VMS Dynamic Extensions1131771
+Node: VMS Installation Details1133455
+Node: VMS Running1135706
+Node: VMS GNV1138546
+Node: VMS Old Gawk1139281
+Node: Bugs1139751
+Node: Other Versions1143640
+Node: Installation summary1150074
+Node: Notes1151133
+Node: Compatibility Mode1151998
+Node: Additions1152780
+Node: Accessing The Source1153705
+Node: Adding Code1155140
+Node: New Ports1161297
+Node: Derived Files1165779
+Ref: Derived Files-Footnote-11171254
+Ref: Derived Files-Footnote-21171288
+Ref: Derived Files-Footnote-31171884
+Node: Future Extensions1171998
+Node: Implementation Limitations1172604
+Node: Extension Design1173852
+Node: Old Extension Problems1175006
+Ref: Old Extension Problems-Footnote-11176523
+Node: Extension New Mechanism Goals1176580
+Ref: Extension New Mechanism Goals-Footnote-11179940
+Node: Extension Other Design Decisions1180129
+Node: Extension Future Growth1182237
+Node: Old Extension Mechanism1183073
+Node: Notes summary1184835
+Node: Basic Concepts1186021
+Node: Basic High Level1186702
+Ref: figure-general-flow1186974
+Ref: figure-process-flow1187573
+Ref: Basic High Level-Footnote-11190802
+Node: Basic Data Typing1190987
+Node: Glossary1194315
+Node: Copying1226244
+Node: GNU Free Documentation License1263800
+Node: Index1288936

End Tag Table
diff --git a/doc/gawk.texi b/doc/gawk.texi
index 023f2719..9044c604 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
@@ -8935,6 +8936,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
@@ -10441,6 +10443,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
@@ -10469,6 +10528,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
@@ -35700,6 +35765,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
@@ -36579,6 +36648,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 ba65f9f6..61d5038e 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
@@ -8535,6 +8536,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
@@ -9937,6 +9939,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
@@ -9965,6 +10024,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
@@ -34791,6 +34856,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
@@ -35670,6 +35739,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..f975353e 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,36 @@ 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)
+{
+ static const char nonfatal[] = "NONFATAL";
+
+ 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 +2457,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 +3835,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 +3863,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 b0603e50..43482705 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -13,6 +13,16 @@
* Makefile.am (profile0): New test.
* profile0.awk, profile0.in, profile0.ok: New files.
+2015-02-08 Arnold D. Robbins <arnold@skeeve.com>
+
+ * nonfatal1.awk, nonfatal2.awk: String is now "NONFATAL".
+
+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 e752865a..1d652eca 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -599,6 +599,10 @@ EXTRA_DIST = \
nondec.ok \
nondec2.awk \
nondec2.ok \
+ nonfatal1.awk \
+ nonfatal1.ok \
+ nonfatal2.awk \
+ nonfatal2.ok \
nonl.awk \
nonl.ok \
noparms.awk \
@@ -1047,6 +1051,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 \
profile0 profile1 profile2 profile3 profile4 profile5 profile6 profile7 \
profile8 pty1 \
diff --git a/test/Makefile.in b/test/Makefile.in
index 0c00973c..65fd461a 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -856,6 +856,10 @@ EXTRA_DIST = \
nondec.ok \
nondec2.awk \
nondec2.ok \
+ nonfatal1.awk \
+ nonfatal1.ok \
+ nonfatal2.awk \
+ nonfatal2.ok \
nonl.awk \
nonl.ok \
noparms.awk \
@@ -1303,6 +1307,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 \
profile0 profile1 profile2 profile3 profile4 profile5 profile6 profile7 \
profile8 pty1 \
@@ -3636,6 +3641,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 adf95cc5..c9e6a840 100644
--- a/test/Maketests
+++ b/test/Maketests
@@ -1152,6 +1152,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..bf821d49
--- /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..fedbba43
--- /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