[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[SCM] gawk branch, gawk-5.1-stable, updated. gawk-4.1.0-4103-gab992f6
From: |
Arnold Robbins |
Subject: |
[SCM] gawk branch, gawk-5.1-stable, updated. gawk-4.1.0-4103-gab992f6 |
Date: |
Tue, 25 Aug 2020 03:00:12 -0400 (EDT) |
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gawk".
The branch, gawk-5.1-stable has been updated
via ab992f649d6e8b40f86eb0f31f4b04daf12c0c8d (commit)
from 0dcd39b002cff7785c38ce535f6e57d4208fefa6 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://git.sv.gnu.org/cgit/gawk.git/commit/?id=ab992f649d6e8b40f86eb0f31f4b04daf12c0c8d
commit ab992f649d6e8b40f86eb0f31f4b04daf12c0c8d
Author: Arnold D. Robbins <arnold@skeeve.com>
Date: Tue Aug 25 09:59:49 2020 +0300
Clear out the record and fields at start of BEGINFILE rule.
diff --git a/ChangeLog b/ChangeLog
index e2d20cf..f59f298 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2020-08-25 Arnold D. Robbins <arnold@skeeve.com>
+
+ * interpret.h (r_interpret): At Op_rule, check if in BEGINFILE. If so,
+ clear the record. Fixes an issue reported by Pat Rankin in May, 2011.
+
2020-08-24 Arnold D. Robbins <arnold@skeeve.com>
* awkgram.y, builtin.c, command.y, debug.c, gawkapi.c,
diff --git a/doc/ChangeLog b/doc/ChangeLog
index cdfd827..ef300e5 100644
--- a/doc/ChangeLog
+++ b/doc/ChangeLog
@@ -1,3 +1,10 @@
+2020-08-25 Arnold D. Robbins <arnold@skeeve.com>
+
+ * gawktexi.in (BEGINFILE/ENDFILE): Document that as of 5.1.1, in a
BEGINFILE,
+ the record and fields are cleared. Fixes an issue reported by Pat
Rankin
+ in May, 2011. Remove the related FIXME, as well as a FIXME later on
that
+ is no longer relevant. Clarify the prose in the whole section.
+
2020-08-24 Arnold D. Robbins <arnold@skeeve.com>
* gawktexi.in (Arithmetic Ops): Update text to fix a FIXME. Document
diff --git a/doc/gawk.info b/doc/gawk.info
index b7675b6..c478c0b 100644
--- a/doc/gawk.info
+++ b/doc/gawk.info
@@ -9998,14 +9998,15 @@ prints the value of 'n' at the end of the run.
with Boolean operators (indeed, they cannot be used with any operators).
An 'awk' program may have multiple 'BEGIN' and/or 'END' rules. They are
executed in the order in which they appear: all the 'BEGIN' rules at
-startup and all the 'END' rules at termination. 'BEGIN' and 'END' rules
-may be intermixed with other rules. This feature was added in the 1987
-version of 'awk' and is included in the POSIX standard. The original
-(1978) version of 'awk' required the 'BEGIN' rule to be placed at the
-beginning of the program, the 'END' rule to be placed at the end, and
-only allowed one of each. This is no longer required, but it is a good
-idea to follow this template in terms of program organization and
-readability.
+startup and all the 'END' rules at termination.
+
+ 'BEGIN' and 'END' rules may be intermixed with other rules. This
+feature was added in the 1987 version of 'awk' and is included in the
+POSIX standard. The original (1978) version of 'awk' required the
+'BEGIN' rule to be placed at the beginning of the program, the 'END'
+rule to be placed at the end, and only allowed one of each. This is no
+longer required, but it is a good idea to follow this template in terms
+of program organization and readability.
Multiple 'BEGIN' and 'END' rules are useful for writing library
functions, because each library file can have its own 'BEGIN' and/or
@@ -10021,7 +10022,7 @@ for a number of useful library functions.
the program exits after the 'BEGIN' rules are run.(1) However, if an
'END' rule exists, then the input is read, even if there are no other
rules in the program. This is necessary in case the 'END' rule checks
-the 'FNR' and 'NR' variables.
+the 'FNR' and 'NR' variables, or the fields.
---------- Footnotes ----------
@@ -10058,7 +10059,7 @@ many older versions of Unix 'awk' do not.
inside a 'BEGIN' or 'END' rule is the same as always: 'print $0'. If
'$0' is the null string, then this prints an empty record. Many
longtime 'awk' programmers use an unadorned 'print' in 'BEGIN' and 'END'
-rules, to mean 'print ""', relying on '$0' being null. Although one
+rules to mean 'print ""', relying on '$0' being null. Although one
might generally get away with this in 'BEGIN' rules, it is a very bad
idea in 'END' rules, at least in 'gawk'. It is also poor style, because
if an empty line is needed in the output, the program should print one
@@ -10081,13 +10082,19 @@ This minor node describes a 'gawk'-specific feature.
Two special kinds of rule, 'BEGINFILE' and 'ENDFILE', give you
"hooks" into 'gawk''s command-line file processing loop. As with the
-'BEGIN' and 'END' rules (*note BEGIN/END::), all 'BEGINFILE' rules in a
-program are merged, in the order they are read by 'gawk', and all
-'ENDFILE' rules are merged as well.
+'BEGIN' and 'END' rules (*note BEGIN/END::), 'BEGINFILE' rules in a
+program are exectured in the order they are read by 'gawk', and all
+'ENDFILE' rules are also executed in the order they are read, as well.
+
+ The bodies of the 'BEGINFILE' rules execute just before 'gawk' reads
+the first record from a file. 'FILENAME' is set to the name of the
+current file, and 'FNR' is set to zero.
- The body of the 'BEGINFILE' rules is executed just before 'gawk'
-reads the first record from a file. 'FILENAME' is set to the name of
-the current file, and 'FNR' is set to zero.
+ Prior to version 5.1.1 of 'gawk', as an accident of the
+implementation, '$0' and the fields retained any previous values they
+had in 'BEGINFILE' rules. Starting with version 5.1.1, '$0' and the
+fields are cleared, since no record has been read yet from the file that
+is about to be processed.
The 'BEGINFILE' rule provides you the opportunity to accomplish two
tasks that would otherwise be difficult or impossible to perform:
@@ -35339,7 +35346,7 @@ Index
* ERRNO variable, with getline command: Getline. (line 19)
* ERRNO variable, with close() function: Close Files And Pipes.
(line 140)
-* ERRNO variable, with BEGINFILE pattern: BEGINFILE/ENDFILE. (line 26)
+* ERRNO variable, with BEGINFILE pattern: BEGINFILE/ENDFILE. (line 32)
* ERRNO variable: Auto-set. (line 87)
* ERRNO variable <1>: TCP/IP Networking. (line 54)
* error handling: Special FD. (line 19)
@@ -35724,7 +35731,7 @@ Index
* gawk, regexp constants and: Standard Regexp Constants.
(line 28)
* gawk, line continuation in: Conditional Exp. (line 34)
-* gawk, ERRNO variable in <2>: BEGINFILE/ENDFILE. (line 26)
+* gawk, ERRNO variable in <2>: BEGINFILE/ENDFILE. (line 32)
* gawk, break statement in: Break Statement. (line 51)
* gawk, continue statement in: Continue Statement. (line 44)
* gawk, predefined variables and: Built-in Variables. (line 14)
@@ -35814,7 +35821,7 @@ Index
* getline command, coprocesses, using from <1>: Close Files And Pipes.
(line 6)
* getline command, BEGINFILE/ENDFILE patterns and: BEGINFILE/ENDFILE.
- (line 54)
+ (line 60)
* getline command, _pw_init() function: Passwd Functions. (line 154)
* getline command, _gr_init() user-defined function: Group Functions.
(line 83)
@@ -36266,13 +36273,13 @@ Index
* next statement: Boolean Ops. (line 95)
* next statement, BEGIN/END patterns and: I/O And BEGIN/END. (line 36)
* next statement, BEGINFILE/ENDFILE patterns and: BEGINFILE/ENDFILE.
- (line 50)
+ (line 56)
* next statement <1>: Next Statement. (line 6)
* next statement, user-defined functions and: Next Statement. (line 44)
* nextfile statement, BEGIN/END patterns and: I/O And BEGIN/END.
(line 36)
* nextfile statement, BEGINFILE/ENDFILE patterns and: BEGINFILE/ENDFILE.
- (line 26)
+ (line 32)
* nextfile statement: Nextfile Statement. (line 6)
* nextfile statement, user-defined functions and: Nextfile Statement.
(line 47)
@@ -37598,406 +37605,406 @@ Node: Expression Patterns420564
Node: Ranges424345
Node: BEGIN/END427453
Node: Using BEGIN/END428214
-Ref: Using BEGIN/END-Footnote-1430950
-Node: I/O And BEGIN/END431056
-Node: BEGINFILE/ENDFILE433370
-Node: Empty436283
-Node: Using Shell Variables436600
-Node: Action Overview438874
-Node: Statements441199
-Node: If Statement443047
-Node: While Statement444542
-Node: Do Statement446570
-Node: For Statement447718
-Node: Switch Statement450889
-Node: Break Statement453330
-Node: Continue Statement455422
-Node: Next Statement457249
-Node: Nextfile Statement459632
-Node: Exit Statement462284
-Node: Built-in Variables464687
-Node: User-modified465820
-Node: Auto-set473587
-Ref: Auto-set-Footnote-1490394
-Ref: Auto-set-Footnote-2490600
-Node: ARGC and ARGV490656
-Node: Pattern Action Summary494869
-Node: Arrays497299
-Node: Array Basics498628
-Node: Array Intro499472
-Ref: figure-array-elements501447
-Ref: Array Intro-Footnote-1504151
-Node: Reference to Elements504279
-Node: Assigning Elements506743
-Node: Array Example507234
-Node: Scanning an Array508993
-Node: Controlling Scanning512015
-Ref: Controlling Scanning-Footnote-1518471
-Node: Numeric Array Subscripts518787
-Node: Uninitialized Subscripts520971
-Node: Delete522590
-Ref: Delete-Footnote-1525342
-Node: Multidimensional525399
-Node: Multiscanning528494
-Node: Arrays of Arrays530085
-Node: Arrays Summary534853
-Node: Functions536946
-Node: Built-in537984
-Node: Calling Built-in539065
-Node: Numeric Functions541061
-Ref: Numeric Functions-Footnote-1545089
-Ref: Numeric Functions-Footnote-2545737
-Ref: Numeric Functions-Footnote-3545785
-Node: String Functions546057
-Ref: String Functions-Footnote-1570198
-Ref: String Functions-Footnote-2570326
-Ref: String Functions-Footnote-3570574
-Node: Gory Details570661
-Ref: table-sub-escapes572452
-Ref: table-sub-proposed573971
-Ref: table-posix-sub575334
-Ref: table-gensub-escapes576875
-Ref: Gory Details-Footnote-1577698
-Node: I/O Functions577852
-Ref: table-system-return-values584320
-Ref: I/O Functions-Footnote-1586400
-Ref: I/O Functions-Footnote-2586548
-Node: Time Functions586668
-Ref: Time Functions-Footnote-1597339
-Ref: Time Functions-Footnote-2597407
-Ref: Time Functions-Footnote-3597565
-Ref: Time Functions-Footnote-4597676
-Ref: Time Functions-Footnote-5597788
-Ref: Time Functions-Footnote-6598015
-Node: Bitwise Functions598281
-Ref: table-bitwise-ops598875
-Ref: Bitwise Functions-Footnote-1604938
-Ref: Bitwise Functions-Footnote-2605111
-Node: Type Functions605302
-Node: I18N Functions608165
-Node: User-defined609816
-Node: Definition Syntax610628
-Ref: Definition Syntax-Footnote-1616315
-Node: Function Example616386
-Ref: Function Example-Footnote-1619308
-Node: Function Calling619330
-Node: Calling A Function619918
-Node: Variable Scope620876
-Node: Pass By Value/Reference623870
-Node: Function Caveats626514
-Ref: Function Caveats-Footnote-1628561
-Node: Return Statement628681
-Node: Dynamic Typing631660
-Node: Indirect Calls632590
-Ref: Indirect Calls-Footnote-1642842
-Node: Functions Summary642970
-Node: Library Functions645675
-Ref: Library Functions-Footnote-1649282
-Ref: Library Functions-Footnote-2649425
-Node: Library Names649596
-Ref: Library Names-Footnote-1653263
-Ref: Library Names-Footnote-2653486
-Node: General Functions653572
-Node: Strtonum Function654675
-Node: Assert Function657697
-Node: Round Function661023
-Node: Cliff Random Function662563
-Node: Ordinal Functions663579
-Ref: Ordinal Functions-Footnote-1666642
-Ref: Ordinal Functions-Footnote-2666894
-Node: Join Function667104
-Ref: Join Function-Footnote-1668874
-Node: Getlocaltime Function669074
-Node: Readfile Function672816
-Node: Shell Quoting674793
-Node: Data File Management676194
-Node: Filetrans Function676826
-Node: Rewind Function680922
-Node: File Checking682831
-Ref: File Checking-Footnote-1684165
-Node: Empty Files684366
-Node: Ignoring Assigns686345
-Node: Getopt Function687895
-Ref: Getopt Function-Footnote-1703107
-Node: Passwd Functions703307
-Ref: Passwd Functions-Footnote-1712146
-Node: Group Functions712234
-Ref: Group Functions-Footnote-1720132
-Node: Walking Arrays720339
-Node: Library Functions Summary723347
-Node: Library Exercises724753
-Node: Sample Programs725218
-Node: Running Examples725988
-Node: Clones726716
-Node: Cut Program727940
-Node: Egrep Program737869
-Ref: Egrep Program-Footnote-1745381
-Node: Id Program745491
-Node: Split Program749171
-Ref: Split Program-Footnote-1752629
-Node: Tee Program752758
-Node: Uniq Program755548
-Node: Wc Program763169
-Ref: Wc Program-Footnote-1767424
-Node: Miscellaneous Programs767518
-Node: Dupword Program768731
-Node: Alarm Program770761
-Node: Translate Program775616
-Ref: Translate Program-Footnote-1780181
-Node: Labels Program780451
-Ref: Labels Program-Footnote-1783802
-Node: Word Sorting783886
-Node: History Sorting787958
-Node: Extract Program790183
-Node: Simple Sed798237
-Node: Igawk Program801311
-Ref: Igawk Program-Footnote-1815642
-Ref: Igawk Program-Footnote-2815844
-Ref: Igawk Program-Footnote-3815966
-Node: Anagram Program816081
-Node: Signature Program819143
-Node: Programs Summary820390
-Node: Programs Exercises821604
-Ref: Programs Exercises-Footnote-1825733
-Node: Advanced Features825824
-Node: Nondecimal Data827814
-Node: Array Sorting829405
-Node: Controlling Array Traversal830105
-Ref: Controlling Array Traversal-Footnote-1838473
-Node: Array Sorting Functions838591
-Ref: Array Sorting Functions-Footnote-1843682
-Node: Two-way I/O843878
-Ref: Two-way I/O-Footnote-1851599
-Ref: Two-way I/O-Footnote-2851786
-Node: TCP/IP Networking851868
-Node: Profiling854986
-Node: Advanced Features Summary864300
-Node: Internationalization866144
-Node: I18N and L10N867624
-Node: Explaining gettext868311
-Ref: Explaining gettext-Footnote-1874203
-Ref: Explaining gettext-Footnote-2874388
-Node: Programmer i18n874553
-Ref: Programmer i18n-Footnote-1879502
-Node: Translator i18n879551
-Node: String Extraction880345
-Ref: String Extraction-Footnote-1881477
-Node: Printf Ordering881563
-Ref: Printf Ordering-Footnote-1884349
-Node: I18N Portability884413
-Ref: I18N Portability-Footnote-1886869
-Node: I18N Example886932
-Ref: I18N Example-Footnote-1890207
-Ref: I18N Example-Footnote-2890280
-Node: Gawk I18N890389
-Node: I18N Summary891038
-Node: Debugger892379
-Node: Debugging893379
-Node: Debugging Concepts893820
-Node: Debugging Terms895629
-Node: Awk Debugging898204
-Ref: Awk Debugging-Footnote-1899149
-Node: Sample Debugging Session899281
-Node: Debugger Invocation899815
-Node: Finding The Bug901201
-Node: List of Debugger Commands907675
-Node: Breakpoint Control909008
-Node: Debugger Execution Control912702
-Node: Viewing And Changing Data916064
-Node: Execution Stack919605
-Node: Debugger Info921242
-Node: Miscellaneous Debugger Commands925313
-Node: Readline Support930375
-Node: Limitations931271
-Node: Debugging Summary933825
-Node: Namespaces935104
-Node: Global Namespace936215
-Node: Qualified Names937613
-Node: Default Namespace938612
-Node: Changing The Namespace939353
-Node: Naming Rules940967
-Node: Internal Name Management942815
-Node: Namespace Example943857
-Node: Namespace And Features946419
-Node: Namespace Summary947854
-Node: Arbitrary Precision Arithmetic949331
-Node: Computer Arithmetic950818
-Ref: table-numeric-ranges954584
-Ref: table-floating-point-ranges955077
-Ref: Computer Arithmetic-Footnote-1955735
-Node: Math Definitions955792
-Ref: table-ieee-formats959108
-Ref: Math Definitions-Footnote-1959711
-Node: MPFR features959816
-Node: FP Math Caution961534
-Ref: FP Math Caution-Footnote-1962606
-Node: Inexactness of computations962975
-Node: Inexact representation963935
-Node: Comparing FP Values965295
-Node: Errors accumulate966536
-Node: Getting Accuracy967969
-Node: Try To Round970679
-Node: Setting precision971578
-Ref: table-predefined-precision-strings972275
-Node: Setting the rounding mode974105
-Ref: table-gawk-rounding-modes974479
-Ref: Setting the rounding mode-Footnote-1978410
-Node: Arbitrary Precision Integers978589
-Ref: Arbitrary Precision Integers-Footnote-1981764
-Node: Checking for MPFR981913
-Node: POSIX Floating Point Problems983387
-Ref: POSIX Floating Point Problems-Footnote-1987672
-Node: Floating point summary987710
-Node: Dynamic Extensions989900
-Node: Extension Intro991453
-Node: Plugin License992719
-Node: Extension Mechanism Outline993516
-Ref: figure-load-extension993955
-Ref: figure-register-new-function995520
-Ref: figure-call-new-function996612
-Node: Extension API Description998674
-Node: Extension API Functions Introduction1000387
-Ref: table-api-std-headers1002223
-Node: General Data Types1006472
-Ref: General Data Types-Footnote-11015102
-Node: Memory Allocation Functions1015401
-Ref: Memory Allocation Functions-Footnote-11019902
-Node: Constructor Functions1020001
-Node: API Ownership of MPFR and GMP Values1023467
-Node: Registration Functions1024780
-Node: Extension Functions1025480
-Node: Exit Callback Functions1030802
-Node: Extension Version String1032052
-Node: Input Parsers1032715
-Node: Output Wrappers1045436
-Node: Two-way processors1049948
-Node: Printing Messages1052213
-Ref: Printing Messages-Footnote-11053384
-Node: Updating ERRNO1053537
-Node: Requesting Values1054276
-Ref: table-value-types-returned1055013
-Node: Accessing Parameters1055949
-Node: Symbol Table Access1057186
-Node: Symbol table by name1057698
-Ref: Symbol table by name-Footnote-11060722
-Node: Symbol table by cookie1060850
-Ref: Symbol table by cookie-Footnote-11065035
-Node: Cached values1065099
-Ref: Cached values-Footnote-11068635
-Node: Array Manipulation1068788
-Ref: Array Manipulation-Footnote-11069879
-Node: Array Data Types1069916
-Ref: Array Data Types-Footnote-11072574
-Node: Array Functions1072666
-Node: Flattening Arrays1077164
-Node: Creating Arrays1084140
-Node: Redirection API1088907
-Node: Extension API Variables1091740
-Node: Extension Versioning1092451
-Ref: gawk-api-version1092880
-Node: Extension GMP/MPFR Versioning1094611
-Node: Extension API Informational Variables1096239
-Node: Extension API Boilerplate1097312
-Node: Changes from API V11101286
-Node: Finding Extensions1102858
-Node: Extension Example1103417
-Node: Internal File Description1104215
-Node: Internal File Ops1108295
-Ref: Internal File Ops-Footnote-11119645
-Node: Using Internal File Ops1119785
-Ref: Using Internal File Ops-Footnote-11122168
-Node: Extension Samples1122442
-Node: Extension Sample File Functions1123971
-Node: Extension Sample Fnmatch1131620
-Node: Extension Sample Fork1133107
-Node: Extension Sample Inplace1134325
-Node: Extension Sample Ord1137950
-Node: Extension Sample Readdir1138786
-Ref: table-readdir-file-types1139675
-Node: Extension Sample Revout1140742
-Node: Extension Sample Rev2way1141331
-Node: Extension Sample Read write array1142071
-Node: Extension Sample Readfile1144013
-Node: Extension Sample Time1145108
-Node: Extension Sample API Tests1146860
-Node: gawkextlib1147352
-Node: Extension summary1150270
-Node: Extension Exercises1153972
-Node: Language History1155214
-Node: V7/SVR3.11156870
-Node: SVR41159022
-Node: POSIX1160456
-Node: BTL1161837
-Node: POSIX/GNU1162566
-Node: Feature History1168344
-Node: Common Extensions1184663
-Node: Ranges and Locales1185946
-Ref: Ranges and Locales-Footnote-11190562
-Ref: Ranges and Locales-Footnote-21190589
-Ref: Ranges and Locales-Footnote-31190824
-Node: Contributors1191047
-Node: History summary1197044
-Node: Installation1198424
-Node: Gawk Distribution1199368
-Node: Getting1199852
-Node: Extracting1200815
-Node: Distribution contents1202453
-Node: Unix Installation1208933
-Node: Quick Installation1209615
-Node: Shell Startup Files1212029
-Node: Additional Configuration Options1213118
-Node: Configuration Philosophy1215433
-Node: Non-Unix Installation1217802
-Node: PC Installation1218262
-Node: PC Binary Installation1219100
-Node: PC Compiling1219535
-Node: PC Using1220652
-Node: Cygwin1224205
-Node: MSYS1225429
-Node: VMS Installation1226031
-Node: VMS Compilation1226822
-Ref: VMS Compilation-Footnote-11228051
-Node: VMS Dynamic Extensions1228109
-Node: VMS Installation Details1229794
-Node: VMS Running1232047
-Node: VMS GNV1236326
-Node: VMS Old Gawk1237061
-Node: Bugs1237532
-Node: Bug address1238195
-Node: Usenet1241177
-Node: Maintainers1242181
-Node: Other Versions1243366
-Node: Installation summary1250454
-Node: Notes1251663
-Node: Compatibility Mode1252457
-Node: Additions1253239
-Node: Accessing The Source1254164
-Node: Adding Code1255601
-Node: New Ports1261820
-Node: Derived Files1266195
-Ref: Derived Files-Footnote-11271855
-Ref: Derived Files-Footnote-21271890
-Ref: Derived Files-Footnote-31272488
-Node: Future Extensions1272602
-Node: Implementation Limitations1273260
-Node: Extension Design1274470
-Node: Old Extension Problems1275614
-Ref: Old Extension Problems-Footnote-11277132
-Node: Extension New Mechanism Goals1277189
-Ref: Extension New Mechanism Goals-Footnote-11280553
-Node: Extension Other Design Decisions1280742
-Node: Extension Future Growth1282855
-Node: Notes summary1283461
-Node: Basic Concepts1284619
-Node: Basic High Level1285300
-Ref: figure-general-flow1285582
-Ref: figure-process-flow1286267
-Ref: Basic High Level-Footnote-11289568
-Node: Basic Data Typing1289753
-Node: Glossary1293081
-Node: Copying1324966
-Node: GNU Free Documentation License1362509
-Node: Index1387629
+Ref: Using BEGIN/END-Footnote-1430968
+Node: I/O And BEGIN/END431074
+Node: BEGINFILE/ENDFILE433387
+Node: Empty436629
+Node: Using Shell Variables436946
+Node: Action Overview439220
+Node: Statements441545
+Node: If Statement443393
+Node: While Statement444888
+Node: Do Statement446916
+Node: For Statement448064
+Node: Switch Statement451235
+Node: Break Statement453676
+Node: Continue Statement455768
+Node: Next Statement457595
+Node: Nextfile Statement459978
+Node: Exit Statement462630
+Node: Built-in Variables465033
+Node: User-modified466166
+Node: Auto-set473933
+Ref: Auto-set-Footnote-1490740
+Ref: Auto-set-Footnote-2490946
+Node: ARGC and ARGV491002
+Node: Pattern Action Summary495215
+Node: Arrays497645
+Node: Array Basics498974
+Node: Array Intro499818
+Ref: figure-array-elements501793
+Ref: Array Intro-Footnote-1504497
+Node: Reference to Elements504625
+Node: Assigning Elements507089
+Node: Array Example507580
+Node: Scanning an Array509339
+Node: Controlling Scanning512361
+Ref: Controlling Scanning-Footnote-1518817
+Node: Numeric Array Subscripts519133
+Node: Uninitialized Subscripts521317
+Node: Delete522936
+Ref: Delete-Footnote-1525688
+Node: Multidimensional525745
+Node: Multiscanning528840
+Node: Arrays of Arrays530431
+Node: Arrays Summary535199
+Node: Functions537292
+Node: Built-in538330
+Node: Calling Built-in539411
+Node: Numeric Functions541407
+Ref: Numeric Functions-Footnote-1545435
+Ref: Numeric Functions-Footnote-2546083
+Ref: Numeric Functions-Footnote-3546131
+Node: String Functions546403
+Ref: String Functions-Footnote-1570544
+Ref: String Functions-Footnote-2570672
+Ref: String Functions-Footnote-3570920
+Node: Gory Details571007
+Ref: table-sub-escapes572798
+Ref: table-sub-proposed574317
+Ref: table-posix-sub575680
+Ref: table-gensub-escapes577221
+Ref: Gory Details-Footnote-1578044
+Node: I/O Functions578198
+Ref: table-system-return-values584666
+Ref: I/O Functions-Footnote-1586746
+Ref: I/O Functions-Footnote-2586894
+Node: Time Functions587014
+Ref: Time Functions-Footnote-1597685
+Ref: Time Functions-Footnote-2597753
+Ref: Time Functions-Footnote-3597911
+Ref: Time Functions-Footnote-4598022
+Ref: Time Functions-Footnote-5598134
+Ref: Time Functions-Footnote-6598361
+Node: Bitwise Functions598627
+Ref: table-bitwise-ops599221
+Ref: Bitwise Functions-Footnote-1605284
+Ref: Bitwise Functions-Footnote-2605457
+Node: Type Functions605648
+Node: I18N Functions608511
+Node: User-defined610162
+Node: Definition Syntax610974
+Ref: Definition Syntax-Footnote-1616661
+Node: Function Example616732
+Ref: Function Example-Footnote-1619654
+Node: Function Calling619676
+Node: Calling A Function620264
+Node: Variable Scope621222
+Node: Pass By Value/Reference624216
+Node: Function Caveats626860
+Ref: Function Caveats-Footnote-1628907
+Node: Return Statement629027
+Node: Dynamic Typing632006
+Node: Indirect Calls632936
+Ref: Indirect Calls-Footnote-1643188
+Node: Functions Summary643316
+Node: Library Functions646021
+Ref: Library Functions-Footnote-1649628
+Ref: Library Functions-Footnote-2649771
+Node: Library Names649942
+Ref: Library Names-Footnote-1653609
+Ref: Library Names-Footnote-2653832
+Node: General Functions653918
+Node: Strtonum Function655021
+Node: Assert Function658043
+Node: Round Function661369
+Node: Cliff Random Function662909
+Node: Ordinal Functions663925
+Ref: Ordinal Functions-Footnote-1666988
+Ref: Ordinal Functions-Footnote-2667240
+Node: Join Function667450
+Ref: Join Function-Footnote-1669220
+Node: Getlocaltime Function669420
+Node: Readfile Function673162
+Node: Shell Quoting675139
+Node: Data File Management676540
+Node: Filetrans Function677172
+Node: Rewind Function681268
+Node: File Checking683177
+Ref: File Checking-Footnote-1684511
+Node: Empty Files684712
+Node: Ignoring Assigns686691
+Node: Getopt Function688241
+Ref: Getopt Function-Footnote-1703453
+Node: Passwd Functions703653
+Ref: Passwd Functions-Footnote-1712492
+Node: Group Functions712580
+Ref: Group Functions-Footnote-1720478
+Node: Walking Arrays720685
+Node: Library Functions Summary723693
+Node: Library Exercises725099
+Node: Sample Programs725564
+Node: Running Examples726334
+Node: Clones727062
+Node: Cut Program728286
+Node: Egrep Program738215
+Ref: Egrep Program-Footnote-1745727
+Node: Id Program745837
+Node: Split Program749517
+Ref: Split Program-Footnote-1752975
+Node: Tee Program753104
+Node: Uniq Program755894
+Node: Wc Program763515
+Ref: Wc Program-Footnote-1767770
+Node: Miscellaneous Programs767864
+Node: Dupword Program769077
+Node: Alarm Program771107
+Node: Translate Program775962
+Ref: Translate Program-Footnote-1780527
+Node: Labels Program780797
+Ref: Labels Program-Footnote-1784148
+Node: Word Sorting784232
+Node: History Sorting788304
+Node: Extract Program790529
+Node: Simple Sed798583
+Node: Igawk Program801657
+Ref: Igawk Program-Footnote-1815988
+Ref: Igawk Program-Footnote-2816190
+Ref: Igawk Program-Footnote-3816312
+Node: Anagram Program816427
+Node: Signature Program819489
+Node: Programs Summary820736
+Node: Programs Exercises821950
+Ref: Programs Exercises-Footnote-1826079
+Node: Advanced Features826170
+Node: Nondecimal Data828160
+Node: Array Sorting829751
+Node: Controlling Array Traversal830451
+Ref: Controlling Array Traversal-Footnote-1838819
+Node: Array Sorting Functions838937
+Ref: Array Sorting Functions-Footnote-1844028
+Node: Two-way I/O844224
+Ref: Two-way I/O-Footnote-1851945
+Ref: Two-way I/O-Footnote-2852132
+Node: TCP/IP Networking852214
+Node: Profiling855332
+Node: Advanced Features Summary864646
+Node: Internationalization866490
+Node: I18N and L10N867970
+Node: Explaining gettext868657
+Ref: Explaining gettext-Footnote-1874549
+Ref: Explaining gettext-Footnote-2874734
+Node: Programmer i18n874899
+Ref: Programmer i18n-Footnote-1879848
+Node: Translator i18n879897
+Node: String Extraction880691
+Ref: String Extraction-Footnote-1881823
+Node: Printf Ordering881909
+Ref: Printf Ordering-Footnote-1884695
+Node: I18N Portability884759
+Ref: I18N Portability-Footnote-1887215
+Node: I18N Example887278
+Ref: I18N Example-Footnote-1890553
+Ref: I18N Example-Footnote-2890626
+Node: Gawk I18N890735
+Node: I18N Summary891384
+Node: Debugger892725
+Node: Debugging893725
+Node: Debugging Concepts894166
+Node: Debugging Terms895975
+Node: Awk Debugging898550
+Ref: Awk Debugging-Footnote-1899495
+Node: Sample Debugging Session899627
+Node: Debugger Invocation900161
+Node: Finding The Bug901547
+Node: List of Debugger Commands908021
+Node: Breakpoint Control909354
+Node: Debugger Execution Control913048
+Node: Viewing And Changing Data916410
+Node: Execution Stack919951
+Node: Debugger Info921588
+Node: Miscellaneous Debugger Commands925659
+Node: Readline Support930721
+Node: Limitations931617
+Node: Debugging Summary934171
+Node: Namespaces935450
+Node: Global Namespace936561
+Node: Qualified Names937959
+Node: Default Namespace938958
+Node: Changing The Namespace939699
+Node: Naming Rules941313
+Node: Internal Name Management943161
+Node: Namespace Example944203
+Node: Namespace And Features946765
+Node: Namespace Summary948200
+Node: Arbitrary Precision Arithmetic949677
+Node: Computer Arithmetic951164
+Ref: table-numeric-ranges954930
+Ref: table-floating-point-ranges955423
+Ref: Computer Arithmetic-Footnote-1956081
+Node: Math Definitions956138
+Ref: table-ieee-formats959454
+Ref: Math Definitions-Footnote-1960057
+Node: MPFR features960162
+Node: FP Math Caution961880
+Ref: FP Math Caution-Footnote-1962952
+Node: Inexactness of computations963321
+Node: Inexact representation964281
+Node: Comparing FP Values965641
+Node: Errors accumulate966882
+Node: Getting Accuracy968315
+Node: Try To Round971025
+Node: Setting precision971924
+Ref: table-predefined-precision-strings972621
+Node: Setting the rounding mode974451
+Ref: table-gawk-rounding-modes974825
+Ref: Setting the rounding mode-Footnote-1978756
+Node: Arbitrary Precision Integers978935
+Ref: Arbitrary Precision Integers-Footnote-1982110
+Node: Checking for MPFR982259
+Node: POSIX Floating Point Problems983733
+Ref: POSIX Floating Point Problems-Footnote-1988018
+Node: Floating point summary988056
+Node: Dynamic Extensions990246
+Node: Extension Intro991799
+Node: Plugin License993065
+Node: Extension Mechanism Outline993862
+Ref: figure-load-extension994301
+Ref: figure-register-new-function995866
+Ref: figure-call-new-function996958
+Node: Extension API Description999020
+Node: Extension API Functions Introduction1000733
+Ref: table-api-std-headers1002569
+Node: General Data Types1006818
+Ref: General Data Types-Footnote-11015448
+Node: Memory Allocation Functions1015747
+Ref: Memory Allocation Functions-Footnote-11020248
+Node: Constructor Functions1020347
+Node: API Ownership of MPFR and GMP Values1023813
+Node: Registration Functions1025126
+Node: Extension Functions1025826
+Node: Exit Callback Functions1031148
+Node: Extension Version String1032398
+Node: Input Parsers1033061
+Node: Output Wrappers1045782
+Node: Two-way processors1050294
+Node: Printing Messages1052559
+Ref: Printing Messages-Footnote-11053730
+Node: Updating ERRNO1053883
+Node: Requesting Values1054622
+Ref: table-value-types-returned1055359
+Node: Accessing Parameters1056295
+Node: Symbol Table Access1057532
+Node: Symbol table by name1058044
+Ref: Symbol table by name-Footnote-11061068
+Node: Symbol table by cookie1061196
+Ref: Symbol table by cookie-Footnote-11065381
+Node: Cached values1065445
+Ref: Cached values-Footnote-11068981
+Node: Array Manipulation1069134
+Ref: Array Manipulation-Footnote-11070225
+Node: Array Data Types1070262
+Ref: Array Data Types-Footnote-11072920
+Node: Array Functions1073012
+Node: Flattening Arrays1077510
+Node: Creating Arrays1084486
+Node: Redirection API1089253
+Node: Extension API Variables1092086
+Node: Extension Versioning1092797
+Ref: gawk-api-version1093226
+Node: Extension GMP/MPFR Versioning1094957
+Node: Extension API Informational Variables1096585
+Node: Extension API Boilerplate1097658
+Node: Changes from API V11101632
+Node: Finding Extensions1103204
+Node: Extension Example1103763
+Node: Internal File Description1104561
+Node: Internal File Ops1108641
+Ref: Internal File Ops-Footnote-11119991
+Node: Using Internal File Ops1120131
+Ref: Using Internal File Ops-Footnote-11122514
+Node: Extension Samples1122788
+Node: Extension Sample File Functions1124317
+Node: Extension Sample Fnmatch1131966
+Node: Extension Sample Fork1133453
+Node: Extension Sample Inplace1134671
+Node: Extension Sample Ord1138296
+Node: Extension Sample Readdir1139132
+Ref: table-readdir-file-types1140021
+Node: Extension Sample Revout1141088
+Node: Extension Sample Rev2way1141677
+Node: Extension Sample Read write array1142417
+Node: Extension Sample Readfile1144359
+Node: Extension Sample Time1145454
+Node: Extension Sample API Tests1147206
+Node: gawkextlib1147698
+Node: Extension summary1150616
+Node: Extension Exercises1154318
+Node: Language History1155560
+Node: V7/SVR3.11157216
+Node: SVR41159368
+Node: POSIX1160802
+Node: BTL1162183
+Node: POSIX/GNU1162912
+Node: Feature History1168690
+Node: Common Extensions1185009
+Node: Ranges and Locales1186292
+Ref: Ranges and Locales-Footnote-11190908
+Ref: Ranges and Locales-Footnote-21190935
+Ref: Ranges and Locales-Footnote-31191170
+Node: Contributors1191393
+Node: History summary1197390
+Node: Installation1198770
+Node: Gawk Distribution1199714
+Node: Getting1200198
+Node: Extracting1201161
+Node: Distribution contents1202799
+Node: Unix Installation1209279
+Node: Quick Installation1209961
+Node: Shell Startup Files1212375
+Node: Additional Configuration Options1213464
+Node: Configuration Philosophy1215779
+Node: Non-Unix Installation1218148
+Node: PC Installation1218608
+Node: PC Binary Installation1219446
+Node: PC Compiling1219881
+Node: PC Using1220998
+Node: Cygwin1224551
+Node: MSYS1225775
+Node: VMS Installation1226377
+Node: VMS Compilation1227168
+Ref: VMS Compilation-Footnote-11228397
+Node: VMS Dynamic Extensions1228455
+Node: VMS Installation Details1230140
+Node: VMS Running1232393
+Node: VMS GNV1236672
+Node: VMS Old Gawk1237407
+Node: Bugs1237878
+Node: Bug address1238541
+Node: Usenet1241523
+Node: Maintainers1242527
+Node: Other Versions1243712
+Node: Installation summary1250800
+Node: Notes1252009
+Node: Compatibility Mode1252803
+Node: Additions1253585
+Node: Accessing The Source1254510
+Node: Adding Code1255947
+Node: New Ports1262166
+Node: Derived Files1266541
+Ref: Derived Files-Footnote-11272201
+Ref: Derived Files-Footnote-21272236
+Ref: Derived Files-Footnote-31272834
+Node: Future Extensions1272948
+Node: Implementation Limitations1273606
+Node: Extension Design1274816
+Node: Old Extension Problems1275960
+Ref: Old Extension Problems-Footnote-11277478
+Node: Extension New Mechanism Goals1277535
+Ref: Extension New Mechanism Goals-Footnote-11280899
+Node: Extension Other Design Decisions1281088
+Node: Extension Future Growth1283201
+Node: Notes summary1283807
+Node: Basic Concepts1284965
+Node: Basic High Level1285646
+Ref: figure-general-flow1285928
+Ref: figure-process-flow1286613
+Ref: Basic High Level-Footnote-11289914
+Node: Basic Data Typing1290099
+Node: Glossary1293427
+Node: Copying1325312
+Node: GNU Free Documentation License1362855
+Node: Index1387975
End Tag Table
diff --git a/doc/gawk.texi b/doc/gawk.texi
index e16b8ae..b2a083d 100644
--- a/doc/gawk.texi
+++ b/doc/gawk.texi
@@ -14443,6 +14443,7 @@ or with Boolean operators (indeed, they cannot be used
with any operators).
An @command{awk} program may have multiple @code{BEGIN} and/or @code{END}
rules. They are executed in the order in which they appear: all the
@code{BEGIN}
rules at startup and all the @code{END} rules at termination.
+
@code{BEGIN} and @code{END} rules may be intermixed with other rules.
This feature was added in the 1987 version of @command{awk} and is included
in the POSIX standard.
@@ -14471,7 +14472,7 @@ run.@footnote{The original version of @command{awk} kept
reading and ignoring input until the end of the file was seen.} However, if an
@code{END} rule exists, then the input is read, even if there are
no other rules in the program. This is necessary in case the @code{END}
-rule checks the @code{FNR} and @code{NR} variables.
+rule checks the @code{FNR} and @code{NR} variables, or the fields.
@node I/O And BEGIN/END
@subsubsection Input/Output from @code{BEGIN} and @code{END} Rules
@@ -14499,6 +14500,7 @@ Traditionally, due largely to implementation issues,
@code{$0} and
@code{NF} were @emph{undefined} inside an @code{END} rule.
The POSIX standard specifies that @code{NF} is available in an @code{END}
rule. It contains the number of fields from the last input record.
+@c FIXME: Update this if POSIX is ever fixed.
Most probably due to an oversight, the standard does not say that @code{$0}
is also preserved, although logically one would think that it should be.
In fact, all of BWK @command{awk}, @command{mawk}, and @command{gawk}
@@ -14510,7 +14512,7 @@ The third point follows from the first two. The
meaning of @samp{print}
inside a @code{BEGIN} or @code{END} rule is the same as always:
@samp{print $0}. If @code{$0} is the null string, then this prints an
empty record. Many longtime @command{awk} programmers use an unadorned
-@samp{print} in @code{BEGIN} and @code{END} rules, to mean @samp{@w{print ""}},
+@samp{print} in @code{BEGIN} and @code{END} rules to mean @samp{@w{print ""}},
relying on @code{$0} being null. Although one might generally get away with
this in @code{BEGIN} rules, it is a very bad idea in @code{END} rules,
at least in @command{gawk}. It is also poor style, because if an empty
@@ -14554,13 +14556,20 @@ As with the @code{BEGIN} and @code{END} rules
@ifdocbook
(see the previous @value{SECTION}),
@end ifdocbook
-all @code{BEGINFILE} rules in a program are merged, in the order they are
-read by @command{gawk}, and all @code{ENDFILE} rules are merged as well.
+@code{BEGINFILE} rules in a program are exectured in the order they are
+read by @command{gawk}, and all @code{ENDFILE} rules are also executed in
+the order they are read, as well.
-The body of the @code{BEGINFILE} rules is executed just before
+The bodies of the @code{BEGINFILE} rules execute just before
@command{gawk} reads the first record from a file. @code{FILENAME}
is set to the name of the current file, and @code{FNR} is set to zero.
+Prior to @value{PVERSION} 5.1.1 of @command{gawk}, as an accident of the
+implementation, @code{$0} and the fields retained any previous values
+they had in @code{BEGINFILE} rules. Starting with @value{PVERSION}
+5.1.1, @code{$0} and the fields are cleared, since no record has been
+read yet from the file that is about to be processed.
+
The @code{BEGINFILE} rule provides you the opportunity to accomplish two tasks
that would otherwise be difficult or impossible to perform:
@@ -14615,28 +14624,6 @@ forms of @code{getline} are allowed.
In most other @command{awk} implementations, or if @command{gawk} is in
compatibility mode (@pxref{Options}), they are not special.
-@c FIXME: For 4.2 maybe deal with this?
-@ignore
-Date: Tue, 17 May 2011 02:06:10 PDT
-From: rankin@pactechdata.com (Pat Rankin)
-Message-Id: <110517015127.20240f4a@pactechdata.com>
-Subject: BEGINFILE
-To: arnold@skeeve.com
-
- The documentation for BEGINFILE states that FNR is 0, which seems
-pretty obvious. It doesn't mention what the value of $0 is, and that's
-not obvious. I think setting it to null before starting the BEGINFILE
-action would be preferable to leaving whatever was there in the last
-record of the previous file.
-
- ENDFILE can retain the last record in $0. I guess it has to if
-the END rule's actions see that value too. But the beginning of a new
-file doesn't just mean that the old one has been closed; the old file
-is being superseded, so leaving the old data around feels wrong to me.
-[If the user wants to keep it on hand, he or she can use an ENDFILE
-rule to grab it before moving on to the next file.]
-@end ignore
-
@node Empty
@subsection The Empty Pattern
@@ -31974,7 +31961,6 @@ commands in a program. This can be very enlightening,
as the following
partial dump of Davide Brini's obfuscated code
(@pxref{Signature Program}) demonstrates:
-@c FIXME: This will need updating if num-handler branch is ever merged in.
@smallexample
@group
gawk> @kbd{dump}
diff --git a/doc/gawktexi.in b/doc/gawktexi.in
index 0ec9741..f7fca2e 100644
--- a/doc/gawktexi.in
+++ b/doc/gawktexi.in
@@ -13758,6 +13758,7 @@ or with Boolean operators (indeed, they cannot be used
with any operators).
An @command{awk} program may have multiple @code{BEGIN} and/or @code{END}
rules. They are executed in the order in which they appear: all the
@code{BEGIN}
rules at startup and all the @code{END} rules at termination.
+
@code{BEGIN} and @code{END} rules may be intermixed with other rules.
This feature was added in the 1987 version of @command{awk} and is included
in the POSIX standard.
@@ -13786,7 +13787,7 @@ run.@footnote{The original version of @command{awk} kept
reading and ignoring input until the end of the file was seen.} However, if an
@code{END} rule exists, then the input is read, even if there are
no other rules in the program. This is necessary in case the @code{END}
-rule checks the @code{FNR} and @code{NR} variables.
+rule checks the @code{FNR} and @code{NR} variables, or the fields.
@node I/O And BEGIN/END
@subsubsection Input/Output from @code{BEGIN} and @code{END} Rules
@@ -13814,6 +13815,7 @@ Traditionally, due largely to implementation issues,
@code{$0} and
@code{NF} were @emph{undefined} inside an @code{END} rule.
The POSIX standard specifies that @code{NF} is available in an @code{END}
rule. It contains the number of fields from the last input record.
+@c FIXME: Update this if POSIX is ever fixed.
Most probably due to an oversight, the standard does not say that @code{$0}
is also preserved, although logically one would think that it should be.
In fact, all of BWK @command{awk}, @command{mawk}, and @command{gawk}
@@ -13825,7 +13827,7 @@ The third point follows from the first two. The
meaning of @samp{print}
inside a @code{BEGIN} or @code{END} rule is the same as always:
@samp{print $0}. If @code{$0} is the null string, then this prints an
empty record. Many longtime @command{awk} programmers use an unadorned
-@samp{print} in @code{BEGIN} and @code{END} rules, to mean @samp{@w{print ""}},
+@samp{print} in @code{BEGIN} and @code{END} rules to mean @samp{@w{print ""}},
relying on @code{$0} being null. Although one might generally get away with
this in @code{BEGIN} rules, it is a very bad idea in @code{END} rules,
at least in @command{gawk}. It is also poor style, because if an empty
@@ -13869,13 +13871,20 @@ As with the @code{BEGIN} and @code{END} rules
@ifdocbook
(see the previous @value{SECTION}),
@end ifdocbook
-all @code{BEGINFILE} rules in a program are merged, in the order they are
-read by @command{gawk}, and all @code{ENDFILE} rules are merged as well.
+@code{BEGINFILE} rules in a program are exectured in the order they are
+read by @command{gawk}, and all @code{ENDFILE} rules are also executed in
+the order they are read, as well.
-The body of the @code{BEGINFILE} rules is executed just before
+The bodies of the @code{BEGINFILE} rules execute just before
@command{gawk} reads the first record from a file. @code{FILENAME}
is set to the name of the current file, and @code{FNR} is set to zero.
+Prior to @value{PVERSION} 5.1.1 of @command{gawk}, as an accident of the
+implementation, @code{$0} and the fields retained any previous values
+they had in @code{BEGINFILE} rules. Starting with @value{PVERSION}
+5.1.1, @code{$0} and the fields are cleared, since no record has been
+read yet from the file that is about to be processed.
+
The @code{BEGINFILE} rule provides you the opportunity to accomplish two tasks
that would otherwise be difficult or impossible to perform:
@@ -13930,28 +13939,6 @@ forms of @code{getline} are allowed.
In most other @command{awk} implementations, or if @command{gawk} is in
compatibility mode (@pxref{Options}), they are not special.
-@c FIXME: For 4.2 maybe deal with this?
-@ignore
-Date: Tue, 17 May 2011 02:06:10 PDT
-From: rankin@pactechdata.com (Pat Rankin)
-Message-Id: <110517015127.20240f4a@pactechdata.com>
-Subject: BEGINFILE
-To: arnold@skeeve.com
-
- The documentation for BEGINFILE states that FNR is 0, which seems
-pretty obvious. It doesn't mention what the value of $0 is, and that's
-not obvious. I think setting it to null before starting the BEGINFILE
-action would be preferable to leaving whatever was there in the last
-record of the previous file.
-
- ENDFILE can retain the last record in $0. I guess it has to if
-the END rule's actions see that value too. But the beginning of a new
-file doesn't just mean that the old one has been closed; the old file
-is being superseded, so leaving the old data around feels wrong to me.
-[If the user wants to keep it on hand, he or she can use an ENDFILE
-rule to grab it before moving on to the next file.]
-@end ignore
-
@node Empty
@subsection The Empty Pattern
@@ -30984,7 +30971,6 @@ commands in a program. This can be very enlightening,
as the following
partial dump of Davide Brini's obfuscated code
(@pxref{Signature Program}) demonstrates:
-@c FIXME: This will need updating if num-handler branch is ever merged in.
@smallexample
@group
gawk> @kbd{dump}
diff --git a/interpret.h b/interpret.h
index efbf9b2..fedf525 100644
--- a/interpret.h
+++ b/interpret.h
@@ -108,7 +108,13 @@ top:
switch (op) {
case Op_rule:
- currule = pc->in_rule; /* for sole use in Op_K_next,
Op_K_nextfile, Op_K_getline */
+ currule = pc->in_rule; /* for use in Op_K_next,
Op_K_nextfile, Op_K_getline */
+ // 8/2020: See node BEGINFILE/ENDFILE in the manual.
We clear the record
+ // since conceptually we are before reading a new
record from the
+ // upcoming file but haven't read it yet.
+ if (currule == BEGINFILE)
+ set_record("", 0, NULL);
+
/* fall through */
case Op_func:
source = pc->source_file;
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 5 +
doc/ChangeLog | 7 +
doc/gawk.info | 849 ++++++++++++++++++++++++++++----------------------------
doc/gawk.texi | 42 +--
doc/gawktexi.in | 42 +--
interpret.h | 8 +-
6 files changed, 475 insertions(+), 478 deletions(-)
hooks/post-receive
--
gawk
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [SCM] gawk branch, gawk-5.1-stable, updated. gawk-4.1.0-4103-gab992f6,
Arnold Robbins <=