diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2012-09-25 12:30:29 +0200 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2012-09-25 12:30:29 +0200 |
commit | 07e825ba195cc9778bcdb75a831d11f26f99ef5a (patch) | |
tree | da339264f11ed16a4299f1f7e669ace2370e1ffb /doc | |
parent | b84831d5a75556aa732cfa3552b90b9c804d9991 (diff) | |
parent | cf1aa2d743d3f6d94ed6cbd3fae97889913c5d75 (diff) | |
download | egawk-07e825ba195cc9778bcdb75a831d11f26f99ef5a.tar.gz egawk-07e825ba195cc9778bcdb75a831d11f26f99ef5a.tar.bz2 egawk-07e825ba195cc9778bcdb75a831d11f26f99ef5a.zip |
Update some things that are now POSIX.
Diffstat (limited to 'doc')
-rw-r--r-- | doc/ChangeLog | 7 | ||||
-rw-r--r-- | doc/awkcard.in | 10 | ||||
-rw-r--r-- | doc/gawk.info | 605 | ||||
-rw-r--r-- | doc/gawk.texi | 62 |
4 files changed, 357 insertions, 327 deletions
diff --git a/doc/ChangeLog b/doc/ChangeLog index 7582e096..f84622d7 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,10 @@ +2012-09-23 Arnold D. Robbins <arnold@skeeve.com> + + * gawk.texi (Nextfile Statement): Document that it's now part of POSIX + and update the title. + (Delete): Document that `delete array' is now part of POSIX. + * awkcard.in: Adjust coloring for nextfile and delete array. + 2012-09-07 Arnold D. Robbins <arnold@skeeve.com> * texinfo.tex: Updated to version 2012-09-05.06. diff --git a/doc/awkcard.in b/doc/awkcard.in index 9f9f304a..372d5587 100644 --- a/doc/awkcard.in +++ b/doc/awkcard.in @@ -700,7 +700,7 @@ loop to iterate over all the elements of an array. .sp .5 Use the \*(FCdelete\fP statement to delete an element from an array. -\*(CLSpecifying just the array name without a subscript in +Specifying just the array name without a subscript in the \*(FCdelete\fP statement deletes the entire contents of an array. .sp .5 @@ -914,7 +914,7 @@ matches the closest \*(FCif\*(FR. .ti -.2i \*(FCnext\*(FR See \fHInput Control.\fP .ti -.2i -\*(CL\*(FCnextfile\*(FR See \fHInput Control.\fP\*(CD +\*(FCnextfile\*(FR See \fHInput Control.\fP .in -.2i .\" --- Start switch statement \*(CB\*(FCswitch (\*(FIexpression\*(FC) { @@ -1306,15 +1306,15 @@ program. Upon end of the input data, execute any \*(FCEND\fP rule(s). .br .ti -.2i -\*(CL\*(FCnextfile\fP +\*(FCnextfile\fP .br Stop processing the current input file. The next input record comes from the next input file. \*(FCFILENAME\fP \*(CBand -\*(FCARGIND\fP\*(CL are updated, \*(FCFNR\fP is reset to 1, +\*(FCARGIND\fP\*(CD are updated, \*(FCFNR\fP is reset to 1, and processing starts over with the first pattern in the AWK program. Upon end -of input data, execute any \*(FCEND\fP rule(s).\*(CD +of input data, execute any \*(FCEND\fP rule(s). .in -.2i .sp .5 .fi diff --git a/doc/gawk.info b/doc/gawk.info index 7f67d45c..2d75333d 100644 --- a/doc/gawk.info +++ b/doc/gawk.info @@ -9171,37 +9171,35 @@ starts processing it with the first rule in the program. File: gawk.info, Node: Nextfile Statement, Next: Exit Statement, Prev: Next Statement, Up: Statements -7.4.9 Using `gawk''s `nextfile' Statement ------------------------------------------ +7.4.9 The `nextfile' Statement +------------------------------ -`gawk' provides the `nextfile' statement, which is similar to the -`next' statement. (c.e.) However, instead of abandoning processing of -the current record, the `nextfile' statement instructs `gawk' to stop -processing the current data file. - - The `nextfile' statement is a `gawk' extension. In most other `awk' -implementations, or if `gawk' is in compatibility mode (*note -Options::), `nextfile' is not special. - - Upon execution of the `nextfile' statement, any `ENDFILE' rules are -executed except in the case as mentioned below, `FILENAME' is updated -to the name of the next data file listed on the command line, `FNR' is -reset to one, `ARGIND' is incremented, any `BEGINFILE' rules are -executed, and processing starts over with the first rule in the program. -(`ARGIND' hasn't been introduced yet. *Note Built-in Variables::.) If -the `nextfile' statement causes the end of the input to be reached, -then the code in any `END' rules is executed. An exception to this is -when the `nextfile' is invoked during execution of any statement in an -`END' rule; In this case, it causes the program to stop immediately. +The `nextfile' statement is similar to the `next' statement. However, +instead of abandoning processing of the current record, the `nextfile' +statement instructs `awk' to stop processing the current data file. + + Upon execution of the `nextfile' statement, `FILENAME' is updated to +the name of the next data file listed on the command line, `FNR' is +reset to one, and processing starts over with the first rule in the +program. If the `nextfile' statement causes the end of the input to be +reached, then the code in any `END' rules is executed. An exception to +this is when `nextfile' is invoked during execution of any statement in +an `END' rule; In this case, it causes the program to stop immediately. *Note BEGIN/END::. The `nextfile' statement is useful when there are many data files to process but it isn't necessary to process every record in every file. -Normally, in order to move on to the next data file, a program has to -continue scanning the unwanted records. The `nextfile' statement -accomplishes this much more efficiently. +Without `nextfile', in order to move on to the next data file, a program +would have to continue scanning the unwanted records. The `nextfile' +statement accomplishes this much more efficiently. + + In `gawk', execution of `nextfile' causes additional things to +happen: any `ENDFILE' rules are executed except in the case as +mentioned below, `ARGIND' is incremented, and any `BEGINFILE' rules are +executed (`ARGIND' hasn't been introduced yet. *Note Built-in +Variables::.) - In addition, `nextfile' is useful inside a `BEGINFILE' rule to skip + With `gawk', `nextfile' is useful inside a `BEGINFILE' rule to skip over a file that would otherwise cause `gawk' to exit with a fatal error. In this case, `ENDFILE' rules are not executed. *Note BEGINFILE/ENDFILE::. @@ -9212,6 +9210,11 @@ files, pipes, and coprocesses that are opened with redirections. It is not related to the main processing that `awk' does with the files listed in `ARGV'. + NOTE: For many years, `nextfile' was a `gawk' extension. As of + September, 2012, it was accepted for inclusion into the POSIX + standard. See the Austin Group website + (http://austingroupbugs.net/view.php?id=607). + The current version of the Brian Kernighan's `awk' (*note Other Versions::) also supports `nextfile'. However, it doesn't allow the `nextfile' statement inside function bodies (*note User-defined::). @@ -10355,18 +10358,22 @@ However, if `--lint' is provided on the command line (*note Options::), array is deleted. All the elements of an array may be deleted with a single statement -(c.e.) by leaving off the subscript in the `delete' statement, as -follows: +by leaving off the subscript in the `delete' statement, as follows: delete ARRAY - This ability is a `gawk' extension; it is not available in -compatibility mode (*note Options::). - Using this version of the `delete' statement is about three times more efficient than the equivalent loop that deletes each element one at a time. + NOTE: For many years, using `delete' without a subscript was a + `gawk' extension. As of September, 2012, it was accepted for + inclusion into the POSIX standard. See the Austin Group website + (http://austingroupbugs.net/view.php?id=544). This form of the + `delete' statement is also supported by Brian Kernighan's `awk' + and `mawk', as well as by a number of other implementations (*note + Other Versions::). + The following statement provides a portable but nonobvious way to clear out an array:(1) @@ -26255,7 +26262,7 @@ Index * Brennan, Michael <1>: Other Versions. (line 6) * Brennan, Michael <2>: Simple Sed. (line 25) * Brennan, Michael <3>: Two-way I/O. (line 6) -* Brennan, Michael: Delete. (line 52) +* Brennan, Michael: Delete. (line 56) * Brian Kernighan's awk, extensions <1>: Other Versions. (line 13) * Brian Kernighan's awk, extensions: BTL. (line 6) * Broder, Alan J.: Contributors. (line 88) @@ -27031,7 +27038,7 @@ Index * functions, user-defined, counts: Profiling. (line 129) * functions, user-defined, library of: Library Functions. (line 6) * functions, user-defined, next/nextfile statements and <1>: Nextfile Statement. - (line 44) + (line 47) * functions, user-defined, next/nextfile statements and: Next Statement. (line 45) * G-d: Acknowledgments. (line 83) @@ -27515,7 +27522,7 @@ Index * nextfile statement, BEGINFILE/ENDFILE patterns and: BEGINFILE/ENDFILE. (line 26) * nextfile statement, user-defined functions and: Nextfile Statement. - (line 44) + (line 47) * nexti debugger command: Debugger Execution Control. (line 49) * NF variable <1>: Auto-set. (line 108) @@ -27694,7 +27701,7 @@ Index * portability, close() function and: Close Files And Pipes. (line 81) * portability, data files as single record: Records. (line 180) -* portability, deleting array elements: Delete. (line 52) +* portability, deleting array elements: Delete. (line 56) * portability, example programs: Library Functions. (line 31) * portability, fflush() function and: I/O Functions. (line 29) * portability, functions, defining: Definition Syntax. (line 99) @@ -28103,7 +28110,7 @@ Index * Spencer, Henry: Glossary. (line 12) * split utility: Split Program. (line 6) * split() function: String Functions. (line 315) -* split() function, array elements, deleting: Delete. (line 57) +* split() function, array elements, deleting: Delete. (line 61) * split.awk program: Split Program. (line 30) * sprintf() function <1>: String Functions. (line 380) * sprintf() function: OFMT. (line 15) @@ -28601,269 +28608,269 @@ Node: Break Statement382649 Node: Continue Statement384639 Node: Next Statement386432 Node: Nextfile Statement388822 -Node: Exit Statement391367 -Node: Built-in Variables393783 -Node: User-modified394878 -Ref: User-modified-Footnote-1403233 -Node: Auto-set403295 -Ref: Auto-set-Footnote-1413203 -Node: ARGC and ARGV413408 -Node: Arrays417259 -Node: Array Basics418764 -Node: Array Intro419590 -Node: Reference to Elements423908 -Node: Assigning Elements426178 -Node: Array Example426669 -Node: Scanning an Array428401 -Node: Controlling Scanning430715 -Ref: Controlling Scanning-Footnote-1435648 -Node: Delete435964 -Ref: Delete-Footnote-1438399 -Node: Numeric Array Subscripts438456 -Node: Uninitialized Subscripts440639 -Node: Multi-dimensional442267 -Node: Multi-scanning445361 -Node: Arrays of Arrays446952 -Node: Functions451597 -Node: Built-in452419 -Node: Calling Built-in453497 -Node: Numeric Functions455485 -Ref: Numeric Functions-Footnote-1459317 -Ref: Numeric Functions-Footnote-2459674 -Ref: Numeric Functions-Footnote-3459722 -Node: String Functions459991 -Ref: String Functions-Footnote-1483488 -Ref: String Functions-Footnote-2483617 -Ref: String Functions-Footnote-3483865 -Node: Gory Details483952 -Ref: table-sub-escapes485631 -Ref: table-sub-posix-92486985 -Ref: table-sub-proposed488328 -Ref: table-posix-sub489678 -Ref: table-gensub-escapes491224 -Ref: Gory Details-Footnote-1492431 -Ref: Gory Details-Footnote-2492482 -Node: I/O Functions492633 -Ref: I/O Functions-Footnote-1499288 -Node: Time Functions499435 -Ref: Time Functions-Footnote-1510327 -Ref: Time Functions-Footnote-2510395 -Ref: Time Functions-Footnote-3510553 -Ref: Time Functions-Footnote-4510664 -Ref: Time Functions-Footnote-5510776 -Ref: Time Functions-Footnote-6511003 -Node: Bitwise Functions511269 -Ref: table-bitwise-ops511827 -Ref: Bitwise Functions-Footnote-1516048 -Node: Type Functions516232 -Node: I18N Functions516702 -Node: User-defined518329 -Node: Definition Syntax519133 -Ref: Definition Syntax-Footnote-1524043 -Node: Function Example524112 -Node: Function Caveats526706 -Node: Calling A Function527127 -Node: Variable Scope528242 -Node: Pass By Value/Reference530217 -Node: Return Statement533657 -Node: Dynamic Typing536638 -Node: Indirect Calls537373 -Node: Internationalization547058 -Node: I18N and L10N548484 -Node: Explaining gettext549170 -Ref: Explaining gettext-Footnote-1554236 -Ref: Explaining gettext-Footnote-2554420 -Node: Programmer i18n554585 -Node: Translator i18n558785 -Node: String Extraction559578 -Ref: String Extraction-Footnote-1560539 -Node: Printf Ordering560625 -Ref: Printf Ordering-Footnote-1563409 -Node: I18N Portability563473 -Ref: I18N Portability-Footnote-1565922 -Node: I18N Example565985 -Ref: I18N Example-Footnote-1568620 -Node: Gawk I18N568692 -Node: Advanced Features569309 -Node: Nondecimal Data570822 -Node: Array Sorting572405 -Node: Controlling Array Traversal573102 -Node: Array Sorting Functions581340 -Ref: Array Sorting Functions-Footnote-1585014 -Ref: Array Sorting Functions-Footnote-2585107 -Node: Two-way I/O585301 -Ref: Two-way I/O-Footnote-1590733 -Node: TCP/IP Networking590803 -Node: Profiling593647 -Node: Library Functions601101 -Ref: Library Functions-Footnote-1604108 -Node: Library Names604279 -Ref: Library Names-Footnote-1607750 -Ref: Library Names-Footnote-2607970 -Node: General Functions608056 -Node: Strtonum Function609009 -Node: Assert Function611939 -Node: Round Function615265 -Node: Cliff Random Function616808 -Node: Ordinal Functions617824 -Ref: Ordinal Functions-Footnote-1620894 -Ref: Ordinal Functions-Footnote-2621146 -Node: Join Function621355 -Ref: Join Function-Footnote-1623126 -Node: Getlocaltime Function623326 -Node: Data File Management627041 -Node: Filetrans Function627673 -Node: Rewind Function631812 -Node: File Checking633199 -Node: Empty Files634293 -Node: Ignoring Assigns636523 -Node: Getopt Function638076 -Ref: Getopt Function-Footnote-1649380 -Node: Passwd Functions649583 -Ref: Passwd Functions-Footnote-1658558 -Node: Group Functions658646 -Node: Walking Arrays666730 -Node: Sample Programs668299 -Node: Running Examples668964 -Node: Clones669692 -Node: Cut Program670916 -Node: Egrep Program680761 -Ref: Egrep Program-Footnote-1688534 -Node: Id Program688644 -Node: Split Program692260 -Ref: Split Program-Footnote-1695779 -Node: Tee Program695907 -Node: Uniq Program698710 -Node: Wc Program706139 -Ref: Wc Program-Footnote-1710405 -Ref: Wc Program-Footnote-2710605 -Node: Miscellaneous Programs710697 -Node: Dupword Program711885 -Node: Alarm Program713916 -Node: Translate Program718665 -Ref: Translate Program-Footnote-1723052 -Ref: Translate Program-Footnote-2723280 -Node: Labels Program723414 -Ref: Labels Program-Footnote-1726785 -Node: Word Sorting726869 -Node: History Sorting730753 -Node: Extract Program732592 -Ref: Extract Program-Footnote-1740075 -Node: Simple Sed740203 -Node: Igawk Program743265 -Ref: Igawk Program-Footnote-1758422 -Ref: Igawk Program-Footnote-2758623 -Node: Anagram Program758761 -Node: Signature Program761829 -Node: Debugger762929 -Node: Debugging763895 -Node: Debugging Concepts764328 -Node: Debugging Terms766184 -Node: Awk Debugging768781 -Node: Sample Debugging Session769673 -Node: Debugger Invocation770193 -Node: Finding The Bug771522 -Node: List of Debugger Commands778010 -Node: Breakpoint Control779344 -Node: Debugger Execution Control783008 -Node: Viewing And Changing Data786368 -Node: Execution Stack789724 -Node: Debugger Info791191 -Node: Miscellaneous Debugger Commands795172 -Node: Readline Support800617 -Node: Limitations801448 -Node: Arbitrary Precision Arithmetic803700 -Ref: Arbitrary Precision Arithmetic-Footnote-1805342 -Node: General Arithmetic805490 -Node: Floating Point Issues807210 -Node: String Conversion Precision808091 -Ref: String Conversion Precision-Footnote-1809797 -Node: Unexpected Results809906 -Node: POSIX Floating Point Problems812059 -Ref: POSIX Floating Point Problems-Footnote-1815884 -Node: Integer Programming815922 -Node: Floating-point Programming817675 -Ref: Floating-point Programming-Footnote-1823984 -Node: Floating-point Representation824248 -Node: Floating-point Context825413 -Ref: table-ieee-formats826255 -Node: Rounding Mode827639 -Ref: table-rounding-modes828118 -Ref: Rounding Mode-Footnote-1831122 -Node: Gawk and MPFR831303 -Node: Arbitrary Precision Floats832545 -Ref: Arbitrary Precision Floats-Footnote-1834974 -Node: Setting Precision835285 -Node: Setting Rounding Mode838018 -Ref: table-gawk-rounding-modes838422 -Node: Floating-point Constants839602 -Node: Changing Precision841026 -Ref: Changing Precision-Footnote-1842426 -Node: Exact Arithmetic842600 -Node: Arbitrary Precision Integers845708 -Ref: Arbitrary Precision Integers-Footnote-1848708 -Node: Dynamic Extensions848855 -Node: Plugin License849773 -Node: Sample Library850387 -Node: Internal File Description851071 -Node: Internal File Ops854784 -Ref: Internal File Ops-Footnote-1859347 -Node: Using Internal File Ops859487 -Node: Language History861863 -Node: V7/SVR3.1863385 -Node: SVR4865706 -Node: POSIX867148 -Node: BTL868156 -Node: POSIX/GNU868890 -Node: Common Extensions874425 -Node: Ranges and Locales875532 -Ref: Ranges and Locales-Footnote-1880150 -Ref: Ranges and Locales-Footnote-2880177 -Ref: Ranges and Locales-Footnote-3880437 -Node: Contributors880658 -Node: Installation884954 -Node: Gawk Distribution885848 -Node: Getting886332 -Node: Extracting887158 -Node: Distribution contents888850 -Node: Unix Installation894072 -Node: Quick Installation894689 -Node: Additional Configuration Options896651 -Node: Configuration Philosophy898128 -Node: Non-Unix Installation900470 -Node: PC Installation900928 -Node: PC Binary Installation902227 -Node: PC Compiling904075 -Node: PC Testing907019 -Node: PC Using908195 -Node: Cygwin912380 -Node: MSYS913380 -Node: VMS Installation913894 -Node: VMS Compilation914497 -Ref: VMS Compilation-Footnote-1915504 -Node: VMS Installation Details915562 -Node: VMS Running917197 -Node: VMS Old Gawk918804 -Node: Bugs919278 -Node: Other Versions923130 -Node: Notes928445 -Node: Compatibility Mode929032 -Node: Additions929815 -Node: Accessing The Source930742 -Node: Adding Code932168 -Node: New Ports938210 -Node: Derived Files942345 -Ref: Derived Files-Footnote-1947650 -Ref: Derived Files-Footnote-2947684 -Ref: Derived Files-Footnote-3948284 -Node: Future Extensions948382 -Node: Basic Concepts949869 -Node: Basic High Level950550 -Ref: Basic High Level-Footnote-1954585 -Node: Basic Data Typing954770 -Node: Glossary958125 -Node: Copying983101 -Node: GNU Free Documentation License1020658 -Node: Index1045795 +Node: Exit Statement391463 +Node: Built-in Variables393879 +Node: User-modified394974 +Ref: User-modified-Footnote-1403329 +Node: Auto-set403391 +Ref: Auto-set-Footnote-1413299 +Node: ARGC and ARGV413504 +Node: Arrays417355 +Node: Array Basics418860 +Node: Array Intro419686 +Node: Reference to Elements424004 +Node: Assigning Elements426274 +Node: Array Example426765 +Node: Scanning an Array428497 +Node: Controlling Scanning430811 +Ref: Controlling Scanning-Footnote-1435744 +Node: Delete436060 +Ref: Delete-Footnote-1438825 +Node: Numeric Array Subscripts438882 +Node: Uninitialized Subscripts441065 +Node: Multi-dimensional442693 +Node: Multi-scanning445787 +Node: Arrays of Arrays447378 +Node: Functions452023 +Node: Built-in452845 +Node: Calling Built-in453923 +Node: Numeric Functions455911 +Ref: Numeric Functions-Footnote-1459743 +Ref: Numeric Functions-Footnote-2460100 +Ref: Numeric Functions-Footnote-3460148 +Node: String Functions460417 +Ref: String Functions-Footnote-1483914 +Ref: String Functions-Footnote-2484043 +Ref: String Functions-Footnote-3484291 +Node: Gory Details484378 +Ref: table-sub-escapes486057 +Ref: table-sub-posix-92487411 +Ref: table-sub-proposed488754 +Ref: table-posix-sub490104 +Ref: table-gensub-escapes491650 +Ref: Gory Details-Footnote-1492857 +Ref: Gory Details-Footnote-2492908 +Node: I/O Functions493059 +Ref: I/O Functions-Footnote-1499714 +Node: Time Functions499861 +Ref: Time Functions-Footnote-1510753 +Ref: Time Functions-Footnote-2510821 +Ref: Time Functions-Footnote-3510979 +Ref: Time Functions-Footnote-4511090 +Ref: Time Functions-Footnote-5511202 +Ref: Time Functions-Footnote-6511429 +Node: Bitwise Functions511695 +Ref: table-bitwise-ops512253 +Ref: Bitwise Functions-Footnote-1516474 +Node: Type Functions516658 +Node: I18N Functions517128 +Node: User-defined518755 +Node: Definition Syntax519559 +Ref: Definition Syntax-Footnote-1524469 +Node: Function Example524538 +Node: Function Caveats527132 +Node: Calling A Function527553 +Node: Variable Scope528668 +Node: Pass By Value/Reference530643 +Node: Return Statement534083 +Node: Dynamic Typing537064 +Node: Indirect Calls537799 +Node: Internationalization547484 +Node: I18N and L10N548910 +Node: Explaining gettext549596 +Ref: Explaining gettext-Footnote-1554662 +Ref: Explaining gettext-Footnote-2554846 +Node: Programmer i18n555011 +Node: Translator i18n559211 +Node: String Extraction560004 +Ref: String Extraction-Footnote-1560965 +Node: Printf Ordering561051 +Ref: Printf Ordering-Footnote-1563835 +Node: I18N Portability563899 +Ref: I18N Portability-Footnote-1566348 +Node: I18N Example566411 +Ref: I18N Example-Footnote-1569046 +Node: Gawk I18N569118 +Node: Advanced Features569735 +Node: Nondecimal Data571248 +Node: Array Sorting572831 +Node: Controlling Array Traversal573528 +Node: Array Sorting Functions581766 +Ref: Array Sorting Functions-Footnote-1585440 +Ref: Array Sorting Functions-Footnote-2585533 +Node: Two-way I/O585727 +Ref: Two-way I/O-Footnote-1591159 +Node: TCP/IP Networking591229 +Node: Profiling594073 +Node: Library Functions601527 +Ref: Library Functions-Footnote-1604534 +Node: Library Names604705 +Ref: Library Names-Footnote-1608176 +Ref: Library Names-Footnote-2608396 +Node: General Functions608482 +Node: Strtonum Function609435 +Node: Assert Function612365 +Node: Round Function615691 +Node: Cliff Random Function617234 +Node: Ordinal Functions618250 +Ref: Ordinal Functions-Footnote-1621320 +Ref: Ordinal Functions-Footnote-2621572 +Node: Join Function621781 +Ref: Join Function-Footnote-1623552 +Node: Getlocaltime Function623752 +Node: Data File Management627467 +Node: Filetrans Function628099 +Node: Rewind Function632238 +Node: File Checking633625 +Node: Empty Files634719 +Node: Ignoring Assigns636949 +Node: Getopt Function638502 +Ref: Getopt Function-Footnote-1649806 +Node: Passwd Functions650009 +Ref: Passwd Functions-Footnote-1658984 +Node: Group Functions659072 +Node: Walking Arrays667156 +Node: Sample Programs668725 +Node: Running Examples669390 +Node: Clones670118 +Node: Cut Program671342 +Node: Egrep Program681187 +Ref: Egrep Program-Footnote-1688960 +Node: Id Program689070 +Node: Split Program692686 +Ref: Split Program-Footnote-1696205 +Node: Tee Program696333 +Node: Uniq Program699136 +Node: Wc Program706565 +Ref: Wc Program-Footnote-1710831 +Ref: Wc Program-Footnote-2711031 +Node: Miscellaneous Programs711123 +Node: Dupword Program712311 +Node: Alarm Program714342 +Node: Translate Program719091 +Ref: Translate Program-Footnote-1723478 +Ref: Translate Program-Footnote-2723706 +Node: Labels Program723840 +Ref: Labels Program-Footnote-1727211 +Node: Word Sorting727295 +Node: History Sorting731179 +Node: Extract Program733018 +Ref: Extract Program-Footnote-1740501 +Node: Simple Sed740629 +Node: Igawk Program743691 +Ref: Igawk Program-Footnote-1758848 +Ref: Igawk Program-Footnote-2759049 +Node: Anagram Program759187 +Node: Signature Program762255 +Node: Debugger763355 +Node: Debugging764321 +Node: Debugging Concepts764754 +Node: Debugging Terms766610 +Node: Awk Debugging769207 +Node: Sample Debugging Session770099 +Node: Debugger Invocation770619 +Node: Finding The Bug771948 +Node: List of Debugger Commands778436 +Node: Breakpoint Control779770 +Node: Debugger Execution Control783434 +Node: Viewing And Changing Data786794 +Node: Execution Stack790150 +Node: Debugger Info791617 +Node: Miscellaneous Debugger Commands795598 +Node: Readline Support801043 +Node: Limitations801874 +Node: Arbitrary Precision Arithmetic804126 +Ref: Arbitrary Precision Arithmetic-Footnote-1805768 +Node: General Arithmetic805916 +Node: Floating Point Issues807636 +Node: String Conversion Precision808517 +Ref: String Conversion Precision-Footnote-1810223 +Node: Unexpected Results810332 +Node: POSIX Floating Point Problems812485 +Ref: POSIX Floating Point Problems-Footnote-1816310 +Node: Integer Programming816348 +Node: Floating-point Programming818101 +Ref: Floating-point Programming-Footnote-1824410 +Node: Floating-point Representation824674 +Node: Floating-point Context825839 +Ref: table-ieee-formats826681 +Node: Rounding Mode828065 +Ref: table-rounding-modes828544 +Ref: Rounding Mode-Footnote-1831548 +Node: Gawk and MPFR831729 +Node: Arbitrary Precision Floats832971 +Ref: Arbitrary Precision Floats-Footnote-1835400 +Node: Setting Precision835711 +Node: Setting Rounding Mode838444 +Ref: table-gawk-rounding-modes838848 +Node: Floating-point Constants840028 +Node: Changing Precision841452 +Ref: Changing Precision-Footnote-1842852 +Node: Exact Arithmetic843026 +Node: Arbitrary Precision Integers846134 +Ref: Arbitrary Precision Integers-Footnote-1849134 +Node: Dynamic Extensions849281 +Node: Plugin License850199 +Node: Sample Library850813 +Node: Internal File Description851497 +Node: Internal File Ops855210 +Ref: Internal File Ops-Footnote-1859773 +Node: Using Internal File Ops859913 +Node: Language History862289 +Node: V7/SVR3.1863811 +Node: SVR4866132 +Node: POSIX867574 +Node: BTL868582 +Node: POSIX/GNU869316 +Node: Common Extensions874851 +Node: Ranges and Locales875958 +Ref: Ranges and Locales-Footnote-1880576 +Ref: Ranges and Locales-Footnote-2880603 +Ref: Ranges and Locales-Footnote-3880863 +Node: Contributors881084 +Node: Installation885380 +Node: Gawk Distribution886274 +Node: Getting886758 +Node: Extracting887584 +Node: Distribution contents889276 +Node: Unix Installation894498 +Node: Quick Installation895115 +Node: Additional Configuration Options897077 +Node: Configuration Philosophy898554 +Node: Non-Unix Installation900896 +Node: PC Installation901354 +Node: PC Binary Installation902653 +Node: PC Compiling904501 +Node: PC Testing907445 +Node: PC Using908621 +Node: Cygwin912806 +Node: MSYS913806 +Node: VMS Installation914320 +Node: VMS Compilation914923 +Ref: VMS Compilation-Footnote-1915930 +Node: VMS Installation Details915988 +Node: VMS Running917623 +Node: VMS Old Gawk919230 +Node: Bugs919704 +Node: Other Versions923556 +Node: Notes928871 +Node: Compatibility Mode929458 +Node: Additions930241 +Node: Accessing The Source931168 +Node: Adding Code932594 +Node: New Ports938636 +Node: Derived Files942771 +Ref: Derived Files-Footnote-1948076 +Ref: Derived Files-Footnote-2948110 +Ref: Derived Files-Footnote-3948710 +Node: Future Extensions948808 +Node: Basic Concepts950295 +Node: Basic High Level950976 +Ref: Basic High Level-Footnote-1955011 +Node: Basic Data Typing955196 +Node: Glossary958551 +Node: Copying983527 +Node: GNU Free Documentation License1021084 +Node: Index1046221 End Tag Table diff --git a/doc/gawk.texi b/doc/gawk.texi index 9519060e..d9c20831 100644 --- a/doc/gawk.texi +++ b/doc/gawk.texi @@ -12409,44 +12409,46 @@ function body reads the next record and starts processing it with the first rule in the program. @node Nextfile Statement -@subsection Using @command{gawk}'s @code{nextfile} Statement +@subsection The @code{nextfile} Statement @cindex @code{nextfile} statement @cindex differences in @command{awk} and @command{gawk}, @code{next}/@code{nextfile} statements @cindex common extensions, @code{nextfile} statement @cindex extensions, common@comma{} @code{nextfile} statement -@command{gawk} provides the @code{nextfile} statement, -which is similar to the @code{next} statement. @value{COMMONEXT} +The @code{nextfile} statement +is similar to the @code{next} statement. However, instead of abandoning processing of the current record, the -@code{nextfile} statement instructs @command{gawk} to stop processing the +@code{nextfile} statement instructs @command{awk} to stop processing the current @value{DF}. -The @code{nextfile} statement is a @command{gawk} extension. -In most other @command{awk} implementations, -or if @command{gawk} is in compatibility mode -(@pxref{Options}), -@code{nextfile} is not special. - Upon execution of the @code{nextfile} statement, -any @code{ENDFILE} rules are executed except in the case as -mentioned below, @code{FILENAME} is +@code{FILENAME} is updated to the name of the next @value{DF} listed on the command line, -@code{FNR} is reset to one, @code{ARGIND} is incremented, -any @code{BEGINFILE} rules are executed, and processing +@code{FNR} is reset to one, +and processing starts over with the first rule in the program. -(@code{ARGIND} hasn't been introduced yet. @xref{Built-in Variables}.) If the @code{nextfile} statement causes the end of the input to be reached, then the code in any @code{END} rules is executed. An exception to this is -when the @code{nextfile} is invoked during execution of any statement in an +when @code{nextfile} is invoked during execution of any statement in an @code{END} rule; In this case, it causes the program to stop immediately. @xref{BEGIN/END}. The @code{nextfile} statement is useful when there are many @value{DF}s to process but it isn't necessary to process every record in every file. -Normally, in order to move on to the next @value{DF}, a program -has to continue scanning the unwanted records. The @code{nextfile} +Without @code{nextfile}, +in order to move on to the next @value{DF}, a program +would have to continue scanning the unwanted records. The @code{nextfile} statement accomplishes this much more efficiently. -In addition, @code{nextfile} is useful inside a @code{BEGINFILE} +In @command{gawk}, execution of @code{nextfile} causes additional things +to happen: +any @code{ENDFILE} rules are executed except in the case as +mentioned below, +@code{ARGIND} is incremented, +and +any @code{BEGINFILE} rules are executed +(@code{ARGIND} hasn't been introduced yet. @xref{Built-in Variables}.) + +With @command{gawk}, @code{nextfile} is useful inside a @code{BEGINFILE} rule to skip over a file that would otherwise cause @command{gawk} to exit with a fatal error. In this case, @code{ENDFILE} rules are not executed. @xref{BEGINFILE/ENDFILE}. @@ -12457,6 +12459,13 @@ reserved for closing files, pipes, and coprocesses that are opened with redirections. It is not related to the main processing that @command{awk} does with the files listed in @code{ARGV}. +@quotation NOTE +For many years, @code{nextfile} was a +@command{gawk} extension. As of September, 2012, it was accepted for +inclusion into the POSIX standard. +See @uref{http://austingroupbugs.net/view.php?id=607, the Austin Group website}. +@end quotation + @cindex functions, user-defined, @code{next}/@code{nextfile} statements and @cindex @code{nextfile} statement, user-defined functions and The current version of the Brian Kernighan's @command{awk} (@pxref{Other @@ -13951,21 +13960,28 @@ is not in the array is deleted. @cindex deleting entire arrays @cindex differences in @command{awk} and @command{gawk}, array elements, deleting All the elements of an array may be deleted with a single statement -@value{COMMONEXT} by leaving off the subscript in the @code{delete} statement, as follows: + @example delete @var{array} @end example -This ability is a @command{gawk} extension; it is not available in -compatibility mode (@pxref{Options}). - Using this version of the @code{delete} statement is about three times more efficient than the equivalent loop that deletes each element one at a time. +@quotation NOTE +For many years, +using @code{delete} without a subscript was a @command{gawk} extension. +As of September, 2012, it was accepted for +inclusion into the POSIX standard. See @uref{http://austingroupbugs.net/view.php?id=544, +the Austin Group website}. This form of the @code{delete} statement is also supported +by Brian Kernighan's @command{awk} and @command{mawk}, as well as +by a number of other implementations (@pxref{Other Versions}). +@end quotation + @cindex portability, deleting array elements @cindex Brennan, Michael The following statement provides a portable but nonobvious way to clear |