avoid crash if certain operations are done before an input record is read, ie in a BEGIN rulediff -r1.3 -r1.4 src/external/historical/nawk/dist/lib.c
(drochner)
--- src/external/historical/nawk/dist/lib.c 2010/11/07 22:55:26 1.3
+++ src/external/historical/nawk/dist/lib.c 2011/01/20 21:23:11 1.4
@@ -328,7 +328,9 @@
}
fr = fields;
i = 0; /* number of fields accumulated here */
- if (inputFS[0] && inputFS[1]) { /* it's a regular expression */
+ if (!inputFS) {
+ /* do nothing */
+ } else if (inputFS[0] && inputFS[1]) { /* it's a regular expression */
i = refldbld(r, inputFS);
} else if ((sep = *inputFS) == ' ') { /* default whitespace */
for (i = 0; ; ) {