diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | doc/ChangeLog | 5 | ||||
-rw-r--r-- | doc/gawk.info | 1270 | ||||
-rw-r--r-- | doc/gawk.texi | 121 | ||||
-rw-r--r-- | doc/gawktexi.in | 121 | ||||
-rw-r--r-- | io.c | 17 |
6 files changed, 815 insertions, 724 deletions
@@ -3,6 +3,11 @@ * awkgram.y (yylex): Don't check for junk characters inside quoted strings. Caused issues on DJGPP and Solaris. + Unrelated + + * io.c (devopen): Straighten things out with respect to + compatibility with BWK awk. + 2014-09-19 Arnold D. Robbins <arnold@skeeve.com> * awkgram.y: Further commentary as to the treacherousness diff --git a/doc/ChangeLog b/doc/ChangeLog index 0c68e072..cacaf940 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,8 @@ +2014-09-23 Arnold D. Robbins <arnold@skeeve.com> + + * gawktex.in: Rework the documentation of special files in + Chapter 5; some reordering as well as rewriting. + 2014-09-22 Arnold D. Robbins <arnold@skeeve.com> * gawktex.in: Continue fixes after reading through the MS. diff --git a/doc/gawk.info b/doc/gawk.info index fa77321b..547bee90 100644 --- a/doc/gawk.info +++ b/doc/gawk.info @@ -189,8 +189,8 @@ entitled "GNU Free Documentation License". * Regexp Field Splitting:: Using regexps as the field separator. * Single Character Fields:: Making each character a separate field. -* Command Line Field Separator:: Setting `FS' from the - command line. +* Command Line Field Separator:: Setting `FS' from the command + line. * Full Line Fields:: Making the full line be a single field. * Field Splitting Summary:: Some final points and a summary table. @@ -234,10 +234,12 @@ entitled "GNU Free Documentation License". * Printf Examples:: Several examples. * Redirection:: How to redirect output to multiple files and pipes. +* Special FD:: Special files for I/O. * Special Files:: File name interpretation in `gawk'. `gawk' allows access to inherited file descriptors. -* Special FD:: Special files for I/O. +* Other Inherited Files:: Accessing other open files with + `gawk'. * Special Network:: Special files for network communications. * Special Caveats:: Things to watch out for. @@ -6043,6 +6045,7 @@ function. * Printf:: The `printf' statement. * Redirection:: How to redirect output to multiple files and pipes. +* Special FD:: Special files for I/O. * Special Files:: File name interpretation in `gawk'. `gawk' allows access to inherited file descriptors. @@ -6644,7 +6647,7 @@ be emphasized by storing it in a variable, like this: { printf format, $1, $2 }' mail-list -File: gawk.info, Node: Redirection, Next: Special Files, Prev: Printf, Up: Printing +File: gawk.info, Node: Redirection, Next: Special FD, Prev: Printf, Up: Printing 5.6 Redirecting Output of `print' and `printf' ============================================== @@ -6795,39 +6798,26 @@ The program builds up a list of command lines, using the `mv' utility to rename the files. It then sends the list to the shell for execution. -File: gawk.info, Node: Special Files, Next: Close Files And Pipes, Prev: Redirection, Up: Printing - -5.7 Special File Names in `gawk' -================================ - -`gawk' provides a number of special file names that it interprets -internally. These file names provide access to standard pre-opened -files and TCP/IP networking. +File: gawk.info, Node: Special FD, Next: Special Files, Prev: Redirection, Up: Printing -* Menu: - -* Special FD:: Special files for I/O. -* Special Network:: Special files for network communications. -* Special Caveats:: Things to watch out for. - - -File: gawk.info, Node: Special FD, Next: Special Network, Up: Special Files - -5.7.1 Special Files for Standard Pre-Opened Files -------------------------------------------------- +5.7 Special Files for Standard Pre-Opened Data Streams +====================================================== Running programs conventionally have three input and output streams already available to them for reading and writing. These are known as the "standard input", "standard output", and "standard error output". -These streams are, by default, connected to your keyboard and screen, -but they are often redirected with the shell, via the `<', `<<', `>', -`>>', `>&', and `|' operators. Standard error is typically used for -writing error messages; the reason there are two separate streams, +These open streams (and any other open file or pipe) are often referred +to by the technical term "file descriptors". + + These streams are, by default, connected to your keyboard and +screen, but they are often redirected with the shell, via the `<', `<<', +`>', `>>', `>&', and `|' operators. Standard error is typically used +for writing error messages; the reason there are two separate streams, standard output and standard error, is so that they can be redirected separately. - In other implementations of `awk', the only way to write an error -message to standard error in an `awk' program is as follows: + In traditional implementations of `awk', the only way to write an +error message to standard error in an `awk' program is as follows: print "Serious error detected!" | "cat 1>&2" @@ -6848,14 +6838,12 @@ that happens, writing to the screen is not correct. In fact, if `awk' is run from a background job, it may not have a terminal at all. Then opening `/dev/tty' fails. - `gawk' provides special file names for accessing the three standard -streams. (c.e.) It also provides syntax for accessing any other -inherited open files. These open files are often referred to by the -technical term "file descriptor". If the file name matches one of -these special names when `gawk' redirects input or output, then it -directly uses the descriptor that the file name stands for. These -special file names work for all operating systems that `gawk' has been -ported to, not just those that are POSIX-compliant: + `gawk', BWK `awk' and `mawk' provide special file names for +accessing the three standard streams. If the file name matches one of +these special names when `gawk' (or one of the others) redirects input +or output, then it directly uses the descriptor that the file name +stands for. These special file names work for all operating systems +that `gawk' has been ported to, not just those that are POSIX-compliant: `/dev/stdin' The standard input (file descriptor 0). @@ -6866,16 +6854,8 @@ ported to, not just those that are POSIX-compliant: `/dev/stderr' The standard error output (file descriptor 2). -`/dev/fd/N' - The file associated with file descriptor N. Such a file must be - opened by the program initiating the `awk' execution (typically - the shell). Unless special pains are taken in the shell from which - `gawk' is invoked, only descriptors 0, 1, and 2 are available. - - The file names `/dev/stdin', `/dev/stdout', and `/dev/stderr' are -aliases for `/dev/fd/0', `/dev/fd/1', and `/dev/fd/2', respectively. -However, they are more self-explanatory. The proper way to write an -error message in a `gawk' program is to use `/dev/stderr', like this: + With these facilities, the proper way to write an error message then +becomes: print "Serious error detected!" > "/dev/stderr" @@ -6883,21 +6863,60 @@ error message in a `gawk' program is to use `/dev/stderr', like this: redirection, the value must be a string. It is a common error to omit the quotes, which leads to confusing results. - Finally, using the `close()' function on a file name of the form -`"/dev/fd/N"', for file descriptor numbers above two, does actually -close the given file descriptor. - - The `/dev/stdin', `/dev/stdout', and `/dev/stderr' special files are -also recognized internally by several other versions of `awk'. + `gawk' does not treat these file names as special when in POSIX +compatibility mode. However, since BWK `awk' supports them, `gawk' does +support them even when invoked with the `--traditional' option (*note +Options::). ---------- Footnotes ---------- (1) The "tty" in `/dev/tty' stands for "Teletype," a serial terminal. -File: gawk.info, Node: Special Network, Next: Special Caveats, Prev: Special FD, Up: Special Files +File: gawk.info, Node: Special Files, Next: Close Files And Pipes, Prev: Special FD, Up: Printing + +5.8 Special File Names in `gawk' +================================ + +Besides access to standard input, stanard output, and standard error, +`gawk' provides access to any open file descriptor. Additionally, +there are special file names reserved for TCP/IP networking. + +* Menu: + +* Other Inherited Files:: Accessing other open files with + `gawk'. +* Special Network:: Special files for network communications. +* Special Caveats:: Things to watch out for. + + +File: gawk.info, Node: Other Inherited Files, Next: Special Network, Up: Special Files -5.7.2 Special Files for Network Communications +5.8.1 Accessing Other Open Files With `gawk' +-------------------------------------------- + +Besides the `/dev/stdin', `/dev/stdout', and `/dev/stderr' special file +names mentioned earlier, `gawk' provides syntax for accessing any other +inherited open file: + +`/dev/fd/N' + The file associated with file descriptor N. Such a file must be + opened by the program initiating the `awk' execution (typically + the shell). Unless special pains are taken in the shell from which + `gawk' is invoked, only descriptors 0, 1, and 2 are available. + + The file names `/dev/stdin', `/dev/stdout', and `/dev/stderr' are +essentially aliases for `/dev/fd/0', `/dev/fd/1', and `/dev/fd/2', +respectively. However, those names are more self-explanatory. + + Note that using `close()' on a file name of the form `"/dev/fd/N"', +for file descriptor numbers above two, does actually close the given +file descriptor. + + +File: gawk.info, Node: Special Network, Next: Special Caveats, Prev: Other Inherited Files, Up: Special Files + +5.8.2 Special Files for Network Communications ---------------------------------------------- `gawk' programs can open a two-way TCP/IP connection, acting as either @@ -6917,14 +6936,18 @@ mentioned here only for completeness. Full discussion is delayed until File: gawk.info, Node: Special Caveats, Prev: Special Network, Up: Special Files -5.7.3 Special File Name Caveats +5.8.3 Special File Name Caveats ------------------------------- Here are some things to bear in mind when using the special file names that `gawk' provides: - * Recognition of these special file names is disabled if `gawk' is in - compatibility mode (*note Options::). + * Recognition of the file names for the three standard pre-opened + files is disabled only in POSIX mode. + + * Recognition of the other special file names is disabled if `gawk' + is in compatibility mode (either `--traditional' or `--posix'; + *note Options::). * `gawk' _always_ interprets these special file names. For example, using `/dev/fd/4' for output actually writes on file descriptor 4, @@ -6937,7 +6960,7 @@ that `gawk' provides: File: gawk.info, Node: Close Files And Pipes, Next: Output Summary, Prev: Special Files, Up: Printing -5.8 Closing Input and Output Redirections +5.9 Closing Input and Output Redirections ========================================= If the same file name or the same shell command is used with `getline' @@ -7105,8 +7128,8 @@ value. File: gawk.info, Node: Output Summary, Next: Output Exercises, Prev: Close Files And Pipes, Up: Printing -5.9 Summary -=========== +5.10 Summary +============ * The `print' statement prints comma-separated expressions. Each expression is separated by the value of `OFS' and terminated by @@ -7131,7 +7154,7 @@ File: gawk.info, Node: Output Summary, Next: Output Exercises, Prev: Close Fi File: gawk.info, Node: Output Exercises, Prev: Output Summary, Up: Printing -5.10 Exercises +5.11 Exercises ============== 1. Rewrite the program: @@ -31191,8 +31214,8 @@ Index (line 148) * / (forward slash), patterns and: Expression Patterns. (line 24) * /= operator vs. /=.../ regexp constant: Assignment Ops. (line 148) -* /dev/... special files: Special FD. (line 47) -* /dev/fd/N special files (gawk): Special FD. (line 47) +* /dev/... special files: Special FD. (line 48) +* /dev/fd/N special files (gawk): Special FD. (line 48) * /inet/... special files (gawk): TCP/IP Networking. (line 6) * /inet4/... special files (gawk): TCP/IP Networking. (line 6) * /inet6/... special files (gawk): TCP/IP Networking. (line 6) @@ -31767,9 +31790,9 @@ Index * commenting, backslash continuation and: Statements/Lines. (line 76) * common extensions, ** operator: Arithmetic Ops. (line 30) * common extensions, **= operator: Assignment Ops. (line 137) -* common extensions, /dev/stderr special file: Special FD. (line 47) -* common extensions, /dev/stdin special file: Special FD. (line 47) -* common extensions, /dev/stdout special file: Special FD. (line 47) +* common extensions, /dev/stderr special file: Special FD. (line 48) +* common extensions, /dev/stdin special file: Special FD. (line 48) +* common extensions, /dev/stdout special file: Special FD. (line 48) * common extensions, \x escape sequence: Escape Sequences. (line 61) * common extensions, BINMODE variable: PC Using. (line 33) * common extensions, delete to delete entire arrays: Delete. (line 39) @@ -32072,7 +32095,7 @@ Index * differences in awk and gawk, command-line directories: Command-line directories. (line 6) * differences in awk and gawk, ERRNO variable: Auto-set. (line 74) -* differences in awk and gawk, error messages: Special FD. (line 16) +* differences in awk and gawk, error messages: Special FD. (line 19) * differences in awk and gawk, FIELDWIDTHS variable: User-modified. (line 37) * differences in awk and gawk, FPAT variable: User-modified. (line 43) @@ -32217,7 +32240,7 @@ Index * ERRNO variable, with close() function: Close Files And Pipes. (line 140) * ERRNO variable, with getline command: Getline. (line 19) -* error handling: Special FD. (line 16) +* error handling: Special FD. (line 19) * error handling, ERRNO variable and: Auto-set. (line 74) * error output: Special FD. (line 6) * escape processing, gsub()/gensub()/sub() functions: Gory Details. @@ -32284,9 +32307,9 @@ Index * extensions, Brian Kernighan's awk: BTL. (line 6) * extensions, common, ** operator: Arithmetic Ops. (line 30) * extensions, common, **= operator: Assignment Ops. (line 137) -* extensions, common, /dev/stderr special file: Special FD. (line 47) -* extensions, common, /dev/stdin special file: Special FD. (line 47) -* extensions, common, /dev/stdout special file: Special FD. (line 47) +* extensions, common, /dev/stderr special file: Special FD. (line 48) +* extensions, common, /dev/stdin special file: Special FD. (line 48) +* extensions, common, /dev/stdout special file: Special FD. (line 48) * extensions, common, \x escape sequence: Escape Sequences. (line 61) * extensions, common, BINMODE variable: PC Using. (line 33) * extensions, common, delete to delete entire arrays: Delete. (line 39) @@ -32353,7 +32376,7 @@ Index * file inclusion, @include directive: Include Files. (line 8) * file names, distinguishing: Auto-set. (line 56) * file names, in compatibility mode: Special Caveats. (line 9) -* file names, standard streams in gawk: Special FD. (line 47) +* file names, standard streams in gawk: Special FD. (line 48) * FILENAME variable <1>: Auto-set. (line 90) * FILENAME variable: Reading Files. (line 6) * FILENAME variable, getline, setting with: Getline Notes. (line 19) @@ -32366,7 +32389,7 @@ Index * files, .po: Explaining gettext. (line 37) * files, .po, converting to .mo: I18N Example. (line 63) * files, .pot: Explaining gettext. (line 31) -* files, /dev/... special files: Special FD. (line 47) +* files, /dev/... special files: Special FD. (line 48) * files, /inet/... (gawk): TCP/IP Networking. (line 6) * files, /inet4/... (gawk): TCP/IP Networking. (line 6) * files, /inet6/... (gawk): TCP/IP Networking. (line 6) @@ -33894,7 +33917,7 @@ Index * troubleshooting, print statement, omitting commas: Print Examples. (line 31) * troubleshooting, printing: Redirection. (line 112) -* troubleshooting, quotes with file names: Special FD. (line 69) +* troubleshooting, quotes with file names: Special FD. (line 62) * troubleshooting, readable data files: File Checking. (line 6) * troubleshooting, regexp constants vs. string constants: Computed Regexps. (line 39) @@ -34076,553 +34099,554 @@ Index Tag Table: Node: Top1204 -Node: Foreword41858 -Node: Preface46205 -Ref: Preface-Footnote-149100 -Ref: Preface-Footnote-249207 -Ref: Preface-Footnote-349440 -Node: History49582 -Node: Names51956 -Ref: Names-Footnote-153050 -Node: This Manual53196 -Ref: This Manual-Footnote-159031 -Node: Conventions59131 -Node: Manual History61476 -Ref: Manual History-Footnote-164552 -Ref: Manual History-Footnote-264593 -Node: How To Contribute64667 -Node: Acknowledgments65906 -Node: Getting Started70654 -Node: Running gawk73088 -Node: One-shot74278 -Node: Read Terminal75503 -Node: Long77530 -Node: Executable Scripts79046 -Ref: Executable Scripts-Footnote-181835 -Node: Comments81937 -Node: Quoting84410 -Node: DOS Quoting89920 -Node: Sample Data Files90595 -Node: Very Simple93188 -Node: Two Rules98079 -Node: More Complex99965 -Node: Statements/Lines102827 -Ref: Statements/Lines-Footnote-1107283 -Node: Other Features107548 -Node: When108479 -Ref: When-Footnote-1110235 -Node: Intro Summary110300 -Node: Invoking Gawk111183 -Node: Command Line112698 -Node: Options113489 -Ref: Options-Footnote-1129316 -Node: Other Arguments129341 -Node: Naming Standard Input132302 -Node: Environment Variables133395 -Node: AWKPATH Variable133953 -Ref: AWKPATH Variable-Footnote-1136805 -Ref: AWKPATH Variable-Footnote-2136850 -Node: AWKLIBPATH Variable137110 -Node: Other Environment Variables137869 -Node: Exit Status141571 -Node: Include Files142246 -Node: Loading Shared Libraries145824 -Node: Obsolete147251 -Node: Undocumented147948 -Node: Invoking Summary148215 -Node: Regexp149881 -Node: Regexp Usage151340 -Node: Escape Sequences153373 -Node: Regexp Operators159390 -Ref: Regexp Operators-Footnote-1166825 -Ref: Regexp Operators-Footnote-2166972 -Node: Bracket Expressions167070 -Ref: table-char-classes169087 -Node: Leftmost Longest172027 -Node: Computed Regexps173329 -Node: GNU Regexp Operators176726 -Node: Case-sensitivity180432 -Ref: Case-sensitivity-Footnote-1183322 -Ref: Case-sensitivity-Footnote-2183557 -Node: Regexp Summary183665 -Node: Reading Files185134 -Node: Records187226 -Node: awk split records187954 -Node: gawk split records192866 -Ref: gawk split records-Footnote-1197405 -Node: Fields197442 -Ref: Fields-Footnote-1200238 -Node: Nonconstant Fields200324 -Ref: Nonconstant Fields-Footnote-1202554 -Node: Changing Fields202756 -Node: Field Separators208688 -Node: Default Field Splitting211390 -Node: Regexp Field Splitting212507 -Node: Single Character Fields215857 -Node: Command Line Field Separator216916 -Node: Full Line Fields220126 -Ref: Full Line Fields-Footnote-1220634 -Node: Field Splitting Summary220680 -Ref: Field Splitting Summary-Footnote-1223811 -Node: Constant Size223912 -Node: Splitting By Content228518 -Ref: Splitting By Content-Footnote-1232591 -Node: Multiple Line232631 -Ref: Multiple Line-Footnote-1238520 -Node: Getline238699 -Node: Plain Getline240910 -Node: Getline/Variable243550 -Node: Getline/File244697 -Node: Getline/Variable/File246081 -Ref: Getline/Variable/File-Footnote-1247680 -Node: Getline/Pipe247767 -Node: Getline/Variable/Pipe250450 -Node: Getline/Coprocess251579 -Node: Getline/Variable/Coprocess252831 -Node: Getline Notes253568 -Node: Getline Summary256360 -Ref: table-getline-variants256768 -Node: Read Timeout257597 -Ref: Read Timeout-Footnote-1261411 -Node: Command-line directories261469 -Node: Input Summary262373 -Node: Input Exercises265625 -Node: Printing266353 -Node: Print268075 -Node: Print Examples269532 -Node: Output Separators272311 -Node: OFMT274327 -Node: Printf275679 -Node: Basic Printf276464 -Node: Control Letters278035 -Node: Format Modifiers282019 -Node: Printf Examples288026 -Node: Redirection290508 -Node: Special Files297242 -Node: Special FD297775 -Ref: Special FD-Footnote-1301469 -Node: Special Network301543 -Node: Special Caveats302393 -Node: Close Files And Pipes303185 -Ref: Close Files And Pipes-Footnote-1310362 -Ref: Close Files And Pipes-Footnote-2310510 -Node: Output Summary310660 -Node: Output Exercises311654 -Node: Expressions312334 -Node: Values313519 -Node: Constants314195 -Node: Scalar Constants314875 -Ref: Scalar Constants-Footnote-1315734 -Node: Nondecimal-numbers315984 -Node: Regexp Constants318984 -Node: Using Constant Regexps319509 -Node: Variables322647 -Node: Using Variables323302 -Node: Assignment Options325206 -Node: Conversion327081 -Node: Strings And Numbers327605 -Ref: Strings And Numbers-Footnote-1330667 -Node: Locale influences conversions330776 -Ref: table-locale-affects333491 -Node: All Operators334079 -Node: Arithmetic Ops334709 -Node: Concatenation337214 -Ref: Concatenation-Footnote-1340033 -Node: Assignment Ops340139 -Ref: table-assign-ops345122 -Node: Increment Ops346400 -Node: Truth Values and Conditions349838 -Node: Truth Values350921 -Node: Typing and Comparison351970 -Node: Variable Typing352763 -Node: Comparison Operators356415 -Ref: table-relational-ops356825 -Node: POSIX String Comparison360340 -Ref: POSIX String Comparison-Footnote-1361412 -Node: Boolean Ops361550 -Ref: Boolean Ops-Footnote-1366029 -Node: Conditional Exp366120 -Node: Function Calls367847 -Node: Precedence371727 -Node: Locales375395 -Node: Expressions Summary377026 -Node: Patterns and Actions379600 -Node: Pattern Overview380716 -Node: Regexp Patterns382395 -Node: Expression Patterns382938 -Node: Ranges386718 -Node: BEGIN/END389824 -Node: Using BEGIN/END390586 -Ref: Using BEGIN/END-Footnote-1393323 -Node: I/O And BEGIN/END393429 -Node: BEGINFILE/ENDFILE395743 -Node: Empty398644 -Node: Using Shell Variables398961 -Node: Action Overview401237 -Node: Statements403564 -Node: If Statement405412 -Node: While Statement406910 -Node: Do Statement408938 -Node: For Statement410080 -Node: Switch Statement413235 -Node: Break Statement415623 -Node: Continue Statement417664 -Node: Next Statement419489 -Node: Nextfile Statement421869 -Node: Exit Statement424499 -Node: Built-in Variables426902 -Node: User-modified428029 -Ref: User-modified-Footnote-1435709 -Node: Auto-set435771 -Ref: Auto-set-Footnote-1448628 -Ref: Auto-set-Footnote-2448833 -Node: ARGC and ARGV448889 -Node: Pattern Action Summary453093 -Node: Arrays455512 -Node: Array Basics456841 -Node: Array Intro457685 -Ref: figure-array-elements459658 -Ref: Array Intro-Footnote-1462182 -Node: Reference to Elements462310 -Node: Assigning Elements464760 -Node: Array Example465251 -Node: Scanning an Array467009 -Node: Controlling Scanning470025 -Ref: Controlling Scanning-Footnote-1475214 -Node: Numeric Array Subscripts475530 -Node: Uninitialized Subscripts477713 -Node: Delete479330 -Ref: Delete-Footnote-1482074 -Node: Multidimensional482131 -Node: Multiscanning485226 -Node: Arrays of Arrays486815 -Node: Arrays Summary491576 -Node: Functions493681 -Node: Built-in494554 -Node: Calling Built-in495632 -Node: Numeric Functions497620 -Ref: Numeric Functions-Footnote-1501642 -Ref: Numeric Functions-Footnote-2501999 -Ref: Numeric Functions-Footnote-3502047 -Node: String Functions502316 -Ref: String Functions-Footnote-1525776 -Ref: String Functions-Footnote-2525905 -Ref: String Functions-Footnote-3526153 -Node: Gory Details526240 -Ref: table-sub-escapes528021 -Ref: table-sub-proposed529541 -Ref: table-posix-sub530905 -Ref: table-gensub-escapes532445 -Ref: Gory Details-Footnote-1533277 -Node: I/O Functions533428 -Ref: I/O Functions-Footnote-1540529 -Node: Time Functions540676 -Ref: Time Functions-Footnote-1551145 -Ref: Time Functions-Footnote-2551213 -Ref: Time Functions-Footnote-3551371 -Ref: Time Functions-Footnote-4551482 -Ref: Time Functions-Footnote-5551594 -Ref: Time Functions-Footnote-6551821 -Node: Bitwise Functions552087 -Ref: table-bitwise-ops552649 -Ref: Bitwise Functions-Footnote-1556957 -Node: Type Functions557126 -Node: I18N Functions558275 -Node: User-defined559920 -Node: Definition Syntax560724 -Ref: Definition Syntax-Footnote-1566128 -Node: Function Example566197 -Ref: Function Example-Footnote-1569114 -Node: Function Caveats569136 -Node: Calling A Function569654 -Node: Variable Scope570609 -Node: Pass By Value/Reference573597 -Node: Return Statement577107 -Node: Dynamic Typing580091 -Node: Indirect Calls581020 -Ref: Indirect Calls-Footnote-1590741 -Node: Functions Summary590869 -Node: Library Functions593568 -Ref: Library Functions-Footnote-1597186 -Ref: Library Functions-Footnote-2597329 -Node: Library Names597500 -Ref: Library Names-Footnote-1600958 -Ref: Library Names-Footnote-2601178 -Node: General Functions601264 -Node: Strtonum Function602292 -Node: Assert Function605312 -Node: Round Function608636 -Node: Cliff Random Function610177 -Node: Ordinal Functions611193 -Ref: Ordinal Functions-Footnote-1614258 -Ref: Ordinal Functions-Footnote-2614510 -Node: Join Function614721 -Ref: Join Function-Footnote-1616492 -Node: Getlocaltime Function616692 -Node: Readfile Function620433 -Node: Data File Management622381 -Node: Filetrans Function623013 -Node: Rewind Function627072 -Node: File Checking628630 -Ref: File Checking-Footnote-1629762 -Node: Empty Files629963 -Node: Ignoring Assigns631942 -Node: Getopt Function633496 -Ref: Getopt Function-Footnote-1644760 -Node: Passwd Functions644963 -Ref: Passwd Functions-Footnote-1653942 -Node: Group Functions654030 -Ref: Group Functions-Footnote-1661961 -Node: Walking Arrays662174 -Node: Library Functions Summary663777 -Node: Library Exercises665165 -Node: Sample Programs666445 -Node: Running Examples667215 -Node: Clones667943 -Node: Cut Program669167 -Node: Egrep Program679025 -Ref: Egrep Program-Footnote-1686612 -Node: Id Program686722 -Node: Split Program690376 -Ref: Split Program-Footnote-1693914 -Node: Tee Program694042 -Node: Uniq Program696829 -Node: Wc Program704252 -Ref: Wc Program-Footnote-1708517 -Node: Miscellaneous Programs708609 -Node: Dupword Program709822 -Node: Alarm Program711853 -Node: Translate Program716657 -Ref: Translate Program-Footnote-1721230 -Ref: Translate Program-Footnote-2721500 -Node: Labels Program721639 -Ref: Labels Program-Footnote-1725000 -Node: Word Sorting725084 -Node: History Sorting729127 -Node: Extract Program730963 -Node: Simple Sed738499 -Node: Igawk Program741561 -Ref: Igawk Program-Footnote-1755865 -Ref: Igawk Program-Footnote-2756066 -Node: Anagram Program756188 -Node: Signature Program759256 -Node: Programs Summary760503 -Node: Programs Exercises761718 -Ref: Programs Exercises-Footnote-1765849 -Node: Advanced Features765940 -Node: Nondecimal Data767888 -Node: Array Sorting769465 -Node: Controlling Array Traversal770162 -Node: Array Sorting Functions778442 -Ref: Array Sorting Functions-Footnote-1782334 -Node: Two-way I/O782528 -Ref: Two-way I/O-Footnote-1787472 -Ref: Two-way I/O-Footnote-2787651 -Node: TCP/IP Networking787733 -Node: Profiling790575 -Node: Advanced Features Summary798117 -Node: Internationalization799978 -Node: I18N and L10N801458 -Node: Explaining gettext802144 -Ref: Explaining gettext-Footnote-1807170 -Ref: Explaining gettext-Footnote-2807354 -Node: Programmer i18n807519 -Ref: Programmer i18n-Footnote-1812313 -Node: Translator i18n812362 -Node: String Extraction813156 -Ref: String Extraction-Footnote-1814289 -Node: Printf Ordering814375 -Ref: Printf Ordering-Footnote-1817157 -Node: I18N Portability817221 -Ref: I18N Portability-Footnote-1819670 -Node: I18N Example819733 -Ref: I18N Example-Footnote-1822439 -Node: Gawk I18N822511 -Node: I18N Summary823149 -Node: Debugger824488 -Node: Debugging825510 -Node: Debugging Concepts825951 -Node: Debugging Terms827807 -Node: Awk Debugging830404 -Node: Sample Debugging Session831296 -Node: Debugger Invocation831816 -Node: Finding The Bug833152 -Node: List of Debugger Commands839631 -Node: Breakpoint Control840963 -Node: Debugger Execution Control844627 -Node: Viewing And Changing Data847987 -Node: Execution Stack851345 -Node: Debugger Info852858 -Node: Miscellaneous Debugger Commands856852 -Node: Readline Support862036 -Node: Limitations862928 -Node: Debugging Summary865201 -Node: Arbitrary Precision Arithmetic866369 -Node: Computer Arithmetic867856 -Ref: Computer Arithmetic-Footnote-1872243 -Node: Math Definitions872300 -Ref: table-ieee-formats875589 -Ref: Math Definitions-Footnote-1876129 -Node: MPFR features876232 -Node: FP Math Caution877849 -Ref: FP Math Caution-Footnote-1878899 -Node: Inexactness of computations879268 -Node: Inexact representation880216 -Node: Comparing FP Values881571 -Node: Errors accumulate882535 -Node: Getting Accuracy883968 -Node: Try To Round886627 -Node: Setting precision887526 -Ref: table-predefined-precision-strings888208 -Node: Setting the rounding mode890001 -Ref: table-gawk-rounding-modes890365 -Ref: Setting the rounding mode-Footnote-1893819 -Node: Arbitrary Precision Integers893998 -Ref: Arbitrary Precision Integers-Footnote-1896979 -Node: POSIX Floating Point Problems897128 -Ref: POSIX Floating Point Problems-Footnote-1901004 -Node: Floating point summary901042 -Node: Dynamic Extensions903246 -Node: Extension Intro904798 -Node: Plugin License906063 -Node: Extension Mechanism Outline906748 -Ref: figure-load-extension907172 -Ref: figure-load-new-function908657 -Ref: figure-call-new-function909659 -Node: Extension API Description911643 -Node: Extension API Functions Introduction913093 -Node: General Data Types917960 -Ref: General Data Types-Footnote-1923653 -Node: Requesting Values923952 -Ref: table-value-types-returned924689 -Node: Memory Allocation Functions925647 -Ref: Memory Allocation Functions-Footnote-1928394 -Node: Constructor Functions928490 -Node: Registration Functions930248 -Node: Extension Functions930933 -Node: Exit Callback Functions933235 -Node: Extension Version String934483 -Node: Input Parsers935133 -Node: Output Wrappers944947 -Node: Two-way processors949463 -Node: Printing Messages951667 -Ref: Printing Messages-Footnote-1952744 -Node: Updating `ERRNO'952896 -Node: Accessing Parameters953635 -Node: Symbol Table Access954865 -Node: Symbol table by name955379 -Node: Symbol table by cookie957355 -Ref: Symbol table by cookie-Footnote-1961488 -Node: Cached values961551 -Ref: Cached values-Footnote-1965055 -Node: Array Manipulation965146 -Ref: Array Manipulation-Footnote-1966244 -Node: Array Data Types966283 -Ref: Array Data Types-Footnote-1968986 -Node: Array Functions969078 -Node: Flattening Arrays972952 -Node: Creating Arrays979804 -Node: Extension API Variables984535 -Node: Extension Versioning985171 -Node: Extension API Informational Variables987072 -Node: Extension API Boilerplate988158 -Node: Finding Extensions991962 -Node: Extension Example992522 -Node: Internal File Description993252 -Node: Internal File Ops997343 -Ref: Internal File Ops-Footnote-11008775 -Node: Using Internal File Ops1008915 -Ref: Using Internal File Ops-Footnote-11011262 -Node: Extension Samples1011530 -Node: Extension Sample File Functions1013054 -Node: Extension Sample Fnmatch1020622 -Node: Extension Sample Fork1022104 -Node: Extension Sample Inplace1023317 -Node: Extension Sample Ord1024992 -Node: Extension Sample Readdir1025828 -Ref: table-readdir-file-types1026684 -Node: Extension Sample Revout1027483 -Node: Extension Sample Rev2way1028074 -Node: Extension Sample Read write array1028815 -Node: Extension Sample Readfile1030694 -Node: Extension Sample API Tests1031794 -Node: Extension Sample Time1032319 -Node: gawkextlib1033634 -Node: Extension summary1036447 -Node: Extension Exercises1040140 -Node: Language History1040862 -Node: V7/SVR3.11042505 -Node: SVR41044825 -Node: POSIX1046267 -Node: BTL1047653 -Node: POSIX/GNU1048387 -Node: Feature History1054103 -Node: Common Extensions1067194 -Node: Ranges and Locales1068506 -Ref: Ranges and Locales-Footnote-11073123 -Ref: Ranges and Locales-Footnote-21073150 -Ref: Ranges and Locales-Footnote-31073384 -Node: Contributors1073605 -Node: History summary1079030 -Node: Installation1080399 -Node: Gawk Distribution1081350 -Node: Getting1081834 -Node: Extracting1082658 -Node: Distribution contents1084300 -Node: Unix Installation1090017 -Node: Quick Installation1090634 -Node: Additional Configuration Options1093076 -Node: Configuration Philosophy1094814 -Node: Non-Unix Installation1097165 -Node: PC Installation1097623 -Node: PC Binary Installation1098934 -Node: PC Compiling1100782 -Ref: PC Compiling-Footnote-11103781 -Node: PC Testing1103886 -Node: PC Using1105062 -Node: Cygwin1109214 -Node: MSYS1110023 -Node: VMS Installation1110521 -Node: VMS Compilation1111317 -Ref: VMS Compilation-Footnote-11112539 -Node: VMS Dynamic Extensions1112597 -Node: VMS Installation Details1113970 -Node: VMS Running1116222 -Node: VMS GNV1119056 -Node: VMS Old Gawk1119779 -Node: Bugs1120249 -Node: Other Versions1124253 -Node: Installation summary1130477 -Node: Notes1131533 -Node: Compatibility Mode1132398 -Node: Additions1133180 -Node: Accessing The Source1134105 -Node: Adding Code1135541 -Node: New Ports1141719 -Node: Derived Files1146200 -Ref: Derived Files-Footnote-11151675 -Ref: Derived Files-Footnote-21151709 -Ref: Derived Files-Footnote-31152305 -Node: Future Extensions1152419 -Node: Implementation Limitations1153025 -Node: Extension Design1154273 -Node: Old Extension Problems1155427 -Ref: Old Extension Problems-Footnote-11156944 -Node: Extension New Mechanism Goals1157001 -Ref: Extension New Mechanism Goals-Footnote-11160361 -Node: Extension Other Design Decisions1160550 -Node: Extension Future Growth1162656 -Node: Old Extension Mechanism1163492 -Node: Notes summary1165254 -Node: Basic Concepts1166440 -Node: Basic High Level1167121 -Ref: figure-general-flow1167393 -Ref: figure-process-flow1167992 -Ref: Basic High Level-Footnote-11171221 -Node: Basic Data Typing1171406 -Node: Glossary1174734 -Node: Copying1199886 -Node: GNU Free Documentation License1237442 -Node: Index1262578 +Node: Foreword41978 +Node: Preface46325 +Ref: Preface-Footnote-149220 +Ref: Preface-Footnote-249327 +Ref: Preface-Footnote-349560 +Node: History49702 +Node: Names52076 +Ref: Names-Footnote-153170 +Node: This Manual53316 +Ref: This Manual-Footnote-159151 +Node: Conventions59251 +Node: Manual History61596 +Ref: Manual History-Footnote-164672 +Ref: Manual History-Footnote-264713 +Node: How To Contribute64787 +Node: Acknowledgments66026 +Node: Getting Started70774 +Node: Running gawk73208 +Node: One-shot74398 +Node: Read Terminal75623 +Node: Long77650 +Node: Executable Scripts79166 +Ref: Executable Scripts-Footnote-181955 +Node: Comments82057 +Node: Quoting84530 +Node: DOS Quoting90040 +Node: Sample Data Files90715 +Node: Very Simple93308 +Node: Two Rules98199 +Node: More Complex100085 +Node: Statements/Lines102947 +Ref: Statements/Lines-Footnote-1107403 +Node: Other Features107668 +Node: When108599 +Ref: When-Footnote-1110355 +Node: Intro Summary110420 +Node: Invoking Gawk111303 +Node: Command Line112818 +Node: Options113609 +Ref: Options-Footnote-1129436 +Node: Other Arguments129461 +Node: Naming Standard Input132422 +Node: Environment Variables133515 +Node: AWKPATH Variable134073 +Ref: AWKPATH Variable-Footnote-1136925 +Ref: AWKPATH Variable-Footnote-2136970 +Node: AWKLIBPATH Variable137230 +Node: Other Environment Variables137989 +Node: Exit Status141691 +Node: Include Files142366 +Node: Loading Shared Libraries145944 +Node: Obsolete147371 +Node: Undocumented148068 +Node: Invoking Summary148335 +Node: Regexp150001 +Node: Regexp Usage151460 +Node: Escape Sequences153493 +Node: Regexp Operators159510 +Ref: Regexp Operators-Footnote-1166945 +Ref: Regexp Operators-Footnote-2167092 +Node: Bracket Expressions167190 +Ref: table-char-classes169207 +Node: Leftmost Longest172147 +Node: Computed Regexps173449 +Node: GNU Regexp Operators176846 +Node: Case-sensitivity180552 +Ref: Case-sensitivity-Footnote-1183442 +Ref: Case-sensitivity-Footnote-2183677 +Node: Regexp Summary183785 +Node: Reading Files185254 +Node: Records187346 +Node: awk split records188074 +Node: gawk split records192986 +Ref: gawk split records-Footnote-1197525 +Node: Fields197562 +Ref: Fields-Footnote-1200358 +Node: Nonconstant Fields200444 +Ref: Nonconstant Fields-Footnote-1202674 +Node: Changing Fields202876 +Node: Field Separators208808 +Node: Default Field Splitting211510 +Node: Regexp Field Splitting212627 +Node: Single Character Fields215977 +Node: Command Line Field Separator217036 +Node: Full Line Fields220246 +Ref: Full Line Fields-Footnote-1220754 +Node: Field Splitting Summary220800 +Ref: Field Splitting Summary-Footnote-1223931 +Node: Constant Size224032 +Node: Splitting By Content228638 +Ref: Splitting By Content-Footnote-1232711 +Node: Multiple Line232751 +Ref: Multiple Line-Footnote-1238640 +Node: Getline238819 +Node: Plain Getline241030 +Node: Getline/Variable243670 +Node: Getline/File244817 +Node: Getline/Variable/File246201 +Ref: Getline/Variable/File-Footnote-1247800 +Node: Getline/Pipe247887 +Node: Getline/Variable/Pipe250570 +Node: Getline/Coprocess251699 +Node: Getline/Variable/Coprocess252951 +Node: Getline Notes253688 +Node: Getline Summary256480 +Ref: table-getline-variants256888 +Node: Read Timeout257717 +Ref: Read Timeout-Footnote-1261531 +Node: Command-line directories261589 +Node: Input Summary262493 +Node: Input Exercises265745 +Node: Printing266473 +Node: Print268250 +Node: Print Examples269707 +Node: Output Separators272486 +Node: OFMT274502 +Node: Printf275854 +Node: Basic Printf276639 +Node: Control Letters278210 +Node: Format Modifiers282194 +Node: Printf Examples288201 +Node: Redirection290683 +Node: Special FD297414 +Ref: Special FD-Footnote-1300571 +Node: Special Files300645 +Node: Other Inherited Files301261 +Node: Special Network302261 +Node: Special Caveats303122 +Node: Close Files And Pipes304073 +Ref: Close Files And Pipes-Footnote-1311250 +Ref: Close Files And Pipes-Footnote-2311398 +Node: Output Summary311548 +Node: Output Exercises312544 +Node: Expressions313224 +Node: Values314409 +Node: Constants315085 +Node: Scalar Constants315765 +Ref: Scalar Constants-Footnote-1316624 +Node: Nondecimal-numbers316874 +Node: Regexp Constants319874 +Node: Using Constant Regexps320399 +Node: Variables323537 +Node: Using Variables324192 +Node: Assignment Options326096 +Node: Conversion327971 +Node: Strings And Numbers328495 +Ref: Strings And Numbers-Footnote-1331557 +Node: Locale influences conversions331666 +Ref: table-locale-affects334381 +Node: All Operators334969 +Node: Arithmetic Ops335599 +Node: Concatenation338104 +Ref: Concatenation-Footnote-1340923 +Node: Assignment Ops341029 +Ref: table-assign-ops346012 +Node: Increment Ops347290 +Node: Truth Values and Conditions350728 +Node: Truth Values351811 +Node: Typing and Comparison352860 +Node: Variable Typing353653 +Node: Comparison Operators357305 +Ref: table-relational-ops357715 +Node: POSIX String Comparison361230 +Ref: POSIX String Comparison-Footnote-1362302 +Node: Boolean Ops362440 +Ref: Boolean Ops-Footnote-1366919 +Node: Conditional Exp367010 +Node: Function Calls368737 +Node: Precedence372617 +Node: Locales376285 +Node: Expressions Summary377916 +Node: Patterns and Actions380490 +Node: Pattern Overview381606 +Node: Regexp Patterns383285 +Node: Expression Patterns383828 +Node: Ranges387608 +Node: BEGIN/END390714 +Node: Using BEGIN/END391476 +Ref: Using BEGIN/END-Footnote-1394213 +Node: I/O And BEGIN/END394319 +Node: BEGINFILE/ENDFILE396633 +Node: Empty399534 +Node: Using Shell Variables399851 +Node: Action Overview402127 +Node: Statements404454 +Node: If Statement406302 +Node: While Statement407800 +Node: Do Statement409828 +Node: For Statement410970 +Node: Switch Statement414125 +Node: Break Statement416513 +Node: Continue Statement418554 +Node: Next Statement420379 +Node: Nextfile Statement422759 +Node: Exit Statement425389 +Node: Built-in Variables427792 +Node: User-modified428919 +Ref: User-modified-Footnote-1436599 +Node: Auto-set436661 +Ref: Auto-set-Footnote-1449518 +Ref: Auto-set-Footnote-2449723 +Node: ARGC and ARGV449779 +Node: Pattern Action Summary453983 +Node: Arrays456402 +Node: Array Basics457731 +Node: Array Intro458575 +Ref: figure-array-elements460548 +Ref: Array Intro-Footnote-1463072 +Node: Reference to Elements463200 +Node: Assigning Elements465650 +Node: Array Example466141 +Node: Scanning an Array467899 +Node: Controlling Scanning470915 +Ref: Controlling Scanning-Footnote-1476104 +Node: Numeric Array Subscripts476420 +Node: Uninitialized Subscripts478603 +Node: Delete480220 +Ref: Delete-Footnote-1482964 +Node: Multidimensional483021 +Node: Multiscanning486116 +Node: Arrays of Arrays487705 +Node: Arrays Summary492466 +Node: Functions494571 +Node: Built-in495444 +Node: Calling Built-in496522 +Node: Numeric Functions498510 +Ref: Numeric Functions-Footnote-1502532 +Ref: Numeric Functions-Footnote-2502889 +Ref: Numeric Functions-Footnote-3502937 +Node: String Functions503206 +Ref: String Functions-Footnote-1526666 +Ref: String Functions-Footnote-2526795 +Ref: String Functions-Footnote-3527043 +Node: Gory Details527130 +Ref: table-sub-escapes528911 +Ref: table-sub-proposed530431 +Ref: table-posix-sub531795 +Ref: table-gensub-escapes533335 +Ref: Gory Details-Footnote-1534167 +Node: I/O Functions534318 +Ref: I/O Functions-Footnote-1541419 +Node: Time Functions541566 +Ref: Time Functions-Footnote-1552035 +Ref: Time Functions-Footnote-2552103 +Ref: Time Functions-Footnote-3552261 +Ref: Time Functions-Footnote-4552372 +Ref: Time Functions-Footnote-5552484 +Ref: Time Functions-Footnote-6552711 +Node: Bitwise Functions552977 +Ref: table-bitwise-ops553539 +Ref: Bitwise Functions-Footnote-1557847 +Node: Type Functions558016 +Node: I18N Functions559165 +Node: User-defined560810 +Node: Definition Syntax561614 +Ref: Definition Syntax-Footnote-1567018 +Node: Function Example567087 +Ref: Function Example-Footnote-1570004 +Node: Function Caveats570026 +Node: Calling A Function570544 +Node: Variable Scope571499 +Node: Pass By Value/Reference574487 +Node: Return Statement577997 +Node: Dynamic Typing580981 +Node: Indirect Calls581910 +Ref: Indirect Calls-Footnote-1591631 +Node: Functions Summary591759 +Node: Library Functions594458 +Ref: Library Functions-Footnote-1598076 +Ref: Library Functions-Footnote-2598219 +Node: Library Names598390 +Ref: Library Names-Footnote-1601848 +Ref: Library Names-Footnote-2602068 +Node: General Functions602154 +Node: Strtonum Function603182 +Node: Assert Function606202 +Node: Round Function609526 +Node: Cliff Random Function611067 +Node: Ordinal Functions612083 +Ref: Ordinal Functions-Footnote-1615148 +Ref: Ordinal Functions-Footnote-2615400 +Node: Join Function615611 +Ref: Join Function-Footnote-1617382 +Node: Getlocaltime Function617582 +Node: Readfile Function621323 +Node: Data File Management623271 +Node: Filetrans Function623903 +Node: Rewind Function627962 +Node: File Checking629520 +Ref: File Checking-Footnote-1630652 +Node: Empty Files630853 +Node: Ignoring Assigns632832 +Node: Getopt Function634386 +Ref: Getopt Function-Footnote-1645650 +Node: Passwd Functions645853 +Ref: Passwd Functions-Footnote-1654832 +Node: Group Functions654920 +Ref: Group Functions-Footnote-1662851 +Node: Walking Arrays663064 +Node: Library Functions Summary664667 +Node: Library Exercises666055 +Node: Sample Programs667335 +Node: Running Examples668105 +Node: Clones668833 +Node: Cut Program670057 +Node: Egrep Program679915 +Ref: Egrep Program-Footnote-1687502 +Node: Id Program687612 +Node: Split Program691266 +Ref: Split Program-Footnote-1694804 +Node: Tee Program694932 +Node: Uniq Program697719 +Node: Wc Program705142 +Ref: Wc Program-Footnote-1709407 +Node: Miscellaneous Programs709499 +Node: Dupword Program710712 +Node: Alarm Program712743 +Node: Translate Program717547 +Ref: Translate Program-Footnote-1722120 +Ref: Translate Program-Footnote-2722390 +Node: Labels Program722529 +Ref: Labels Program-Footnote-1725890 +Node: Word Sorting725974 +Node: History Sorting730017 +Node: Extract Program731853 +Node: Simple Sed739389 +Node: Igawk Program742451 +Ref: Igawk Program-Footnote-1756755 +Ref: Igawk Program-Footnote-2756956 +Node: Anagram Program757078 +Node: Signature Program760146 +Node: Programs Summary761393 +Node: Programs Exercises762608 +Ref: Programs Exercises-Footnote-1766739 +Node: Advanced Features766830 +Node: Nondecimal Data768778 +Node: Array Sorting770355 +Node: Controlling Array Traversal771052 +Node: Array Sorting Functions779332 +Ref: Array Sorting Functions-Footnote-1783224 +Node: Two-way I/O783418 +Ref: Two-way I/O-Footnote-1788362 +Ref: Two-way I/O-Footnote-2788541 +Node: TCP/IP Networking788623 +Node: Profiling791465 +Node: Advanced Features Summary799007 +Node: Internationalization800868 +Node: I18N and L10N802348 +Node: Explaining gettext803034 +Ref: Explaining gettext-Footnote-1808060 +Ref: Explaining gettext-Footnote-2808244 +Node: Programmer i18n808409 +Ref: Programmer i18n-Footnote-1813203 +Node: Translator i18n813252 +Node: String Extraction814046 +Ref: String Extraction-Footnote-1815179 +Node: Printf Ordering815265 +Ref: Printf Ordering-Footnote-1818047 +Node: I18N Portability818111 +Ref: I18N Portability-Footnote-1820560 +Node: I18N Example820623 +Ref: I18N Example-Footnote-1823329 +Node: Gawk I18N823401 +Node: I18N Summary824039 +Node: Debugger825378 +Node: Debugging826400 +Node: Debugging Concepts826841 +Node: Debugging Terms828697 +Node: Awk Debugging831294 +Node: Sample Debugging Session832186 +Node: Debugger Invocation832706 +Node: Finding The Bug834042 +Node: List of Debugger Commands840521 +Node: Breakpoint Control841853 +Node: Debugger Execution Control845517 +Node: Viewing And Changing Data848877 +Node: Execution Stack852235 +Node: Debugger Info853748 +Node: Miscellaneous Debugger Commands857742 +Node: Readline Support862926 +Node: Limitations863818 +Node: Debugging Summary866091 +Node: Arbitrary Precision Arithmetic867259 +Node: Computer Arithmetic868746 +Ref: Computer Arithmetic-Footnote-1873133 +Node: Math Definitions873190 +Ref: table-ieee-formats876479 +Ref: Math Definitions-Footnote-1877019 +Node: MPFR features877122 +Node: FP Math Caution878739 +Ref: FP Math Caution-Footnote-1879789 +Node: Inexactness of computations880158 +Node: Inexact representation881106 +Node: Comparing FP Values882461 +Node: Errors accumulate883425 +Node: Getting Accuracy884858 +Node: Try To Round887517 +Node: Setting precision888416 +Ref: table-predefined-precision-strings889098 +Node: Setting the rounding mode890891 +Ref: table-gawk-rounding-modes891255 +Ref: Setting the rounding mode-Footnote-1894709 +Node: Arbitrary Precision Integers894888 +Ref: Arbitrary Precision Integers-Footnote-1897869 +Node: POSIX Floating Point Problems898018 +Ref: POSIX Floating Point Problems-Footnote-1901894 +Node: Floating point summary901932 +Node: Dynamic Extensions904136 +Node: Extension Intro905688 +Node: Plugin License906953 +Node: Extension Mechanism Outline907638 +Ref: figure-load-extension908062 +Ref: figure-load-new-function909547 +Ref: figure-call-new-function910549 +Node: Extension API Description912533 +Node: Extension API Functions Introduction913983 +Node: General Data Types918850 +Ref: General Data Types-Footnote-1924543 +Node: Requesting Values924842 +Ref: table-value-types-returned925579 +Node: Memory Allocation Functions926537 +Ref: Memory Allocation Functions-Footnote-1929284 +Node: Constructor Functions929380 +Node: Registration Functions931138 +Node: Extension Functions931823 +Node: Exit Callback Functions934125 +Node: Extension Version String935373 +Node: Input Parsers936023 +Node: Output Wrappers945837 +Node: Two-way processors950353 +Node: Printing Messages952557 +Ref: Printing Messages-Footnote-1953634 +Node: Updating `ERRNO'953786 +Node: Accessing Parameters954525 +Node: Symbol Table Access955755 +Node: Symbol table by name956269 +Node: Symbol table by cookie958245 +Ref: Symbol table by cookie-Footnote-1962378 +Node: Cached values962441 +Ref: Cached values-Footnote-1965945 +Node: Array Manipulation966036 +Ref: Array Manipulation-Footnote-1967134 +Node: Array Data Types967173 +Ref: Array Data Types-Footnote-1969876 +Node: Array Functions969968 +Node: Flattening Arrays973842 +Node: Creating Arrays980694 +Node: Extension API Variables985425 +Node: Extension Versioning986061 +Node: Extension API Informational Variables987962 +Node: Extension API Boilerplate989048 +Node: Finding Extensions992852 +Node: Extension Example993412 +Node: Internal File Description994142 +Node: Internal File Ops998233 +Ref: Internal File Ops-Footnote-11009665 +Node: Using Internal File Ops1009805 +Ref: Using Internal File Ops-Footnote-11012152 +Node: Extension Samples1012420 +Node: Extension Sample File Functions1013944 +Node: Extension Sample Fnmatch1021512 +Node: Extension Sample Fork1022994 +Node: Extension Sample Inplace1024207 +Node: Extension Sample Ord1025882 +Node: Extension Sample Readdir1026718 +Ref: table-readdir-file-types1027574 +Node: Extension Sample Revout1028373 +Node: Extension Sample Rev2way1028964 +Node: Extension Sample Read write array1029705 +Node: Extension Sample Readfile1031584 +Node: Extension Sample API Tests1032684 +Node: Extension Sample Time1033209 +Node: gawkextlib1034524 +Node: Extension summary1037337 +Node: Extension Exercises1041030 +Node: Language History1041752 +Node: V7/SVR3.11043395 +Node: SVR41045715 +Node: POSIX1047157 +Node: BTL1048543 +Node: POSIX/GNU1049277 +Node: Feature History1054993 +Node: Common Extensions1068084 +Node: Ranges and Locales1069396 +Ref: Ranges and Locales-Footnote-11074013 +Ref: Ranges and Locales-Footnote-21074040 +Ref: Ranges and Locales-Footnote-31074274 +Node: Contributors1074495 +Node: History summary1079920 +Node: Installation1081289 +Node: Gawk Distribution1082240 +Node: Getting1082724 +Node: Extracting1083548 +Node: Distribution contents1085190 +Node: Unix Installation1090907 +Node: Quick Installation1091524 +Node: Additional Configuration Options1093966 +Node: Configuration Philosophy1095704 +Node: Non-Unix Installation1098055 +Node: PC Installation1098513 +Node: PC Binary Installation1099824 +Node: PC Compiling1101672 +Ref: PC Compiling-Footnote-11104671 +Node: PC Testing1104776 +Node: PC Using1105952 +Node: Cygwin1110104 +Node: MSYS1110913 +Node: VMS Installation1111411 +Node: VMS Compilation1112207 +Ref: VMS Compilation-Footnote-11113429 +Node: VMS Dynamic Extensions1113487 +Node: VMS Installation Details1114860 +Node: VMS Running1117112 +Node: VMS GNV1119946 +Node: VMS Old Gawk1120669 +Node: Bugs1121139 +Node: Other Versions1125143 +Node: Installation summary1131367 +Node: Notes1132423 +Node: Compatibility Mode1133288 +Node: Additions1134070 +Node: Accessing The Source1134995 +Node: Adding Code1136431 +Node: New Ports1142609 +Node: Derived Files1147090 +Ref: Derived Files-Footnote-11152565 +Ref: Derived Files-Footnote-21152599 +Ref: Derived Files-Footnote-31153195 +Node: Future Extensions1153309 +Node: Implementation Limitations1153915 +Node: Extension Design1155163 +Node: Old Extension Problems1156317 +Ref: Old Extension Problems-Footnote-11157834 +Node: Extension New Mechanism Goals1157891 +Ref: Extension New Mechanism Goals-Footnote-11161251 +Node: Extension Other Design Decisions1161440 +Node: Extension Future Growth1163546 +Node: Old Extension Mechanism1164382 +Node: Notes summary1166144 +Node: Basic Concepts1167330 +Node: Basic High Level1168011 +Ref: figure-general-flow1168283 +Ref: figure-process-flow1168882 +Ref: Basic High Level-Footnote-11172111 +Node: Basic Data Typing1172296 +Node: Glossary1175624 +Node: Copying1200776 +Node: GNU Free Documentation License1238332 +Node: Index1263468 End Tag Table diff --git a/doc/gawk.texi b/doc/gawk.texi index 492d5cd6..bec627a4 100644 --- a/doc/gawk.texi +++ b/doc/gawk.texi @@ -565,8 +565,8 @@ particular records in a file and perform operations upon them. * Regexp Field Splitting:: Using regexps as the field separator. * Single Character Fields:: Making each character a separate field. -* Command Line Field Separator:: Setting @code{FS} from the - command line. +* Command Line Field Separator:: Setting @code{FS} from the command + line. * Full Line Fields:: Making the full line be a single field. * Field Splitting Summary:: Some final points and a summary table. @@ -610,10 +610,12 @@ particular records in a file and perform operations upon them. * Printf Examples:: Several examples. * Redirection:: How to redirect output to multiple files and pipes. +* Special FD:: Special files for I/O. * Special Files:: File name interpretation in @command{gawk}. @command{gawk} allows access to inherited file descriptors. -* Special FD:: Special files for I/O. +* Other Inherited Files:: Accessing other open files with + @command{gawk}. * Special Network:: Special files for network communications. * Special Caveats:: Things to watch out for. @@ -8804,6 +8806,7 @@ and discusses the @code{close()} built-in function. * Printf:: The @code{printf} statement. * Redirection:: How to redirect output to multiple files and pipes. +* Special FD:: Special files for I/O. * Special Files:: File name interpretation in @command{gawk}. @command{gawk} allows access to inherited file descriptors. @@ -9827,23 +9830,8 @@ It then sends the list to the shell for execution. @c ENDOFRANGE outre @c ENDOFRANGE reout -@node Special Files -@section Special @value{FFN}s in @command{gawk} -@c STARTOFRANGE gfn -@cindex @command{gawk}, file names in - -@command{gawk} provides a number of special @value{FN}s that it interprets -internally. These @value{FN}s provide access to standard pre-opened files -and TCP/IP networking. - -@menu -* Special FD:: Special files for I/O. -* Special Network:: Special files for network communications. -* Special Caveats:: Things to watch out for. -@end menu - @node Special FD -@subsection Special Files for Standard Pre-Opened Files +@section Special Files for Standard Pre-Opened Data Streams @cindex standard input @cindex input, standard @cindex standard output @@ -9854,9 +9842,12 @@ and TCP/IP networking. @cindex files, descriptors, See file descriptors Running programs conventionally have three input and output streams -already available to them for reading and writing. These are known as -the @dfn{standard input}, @dfn{standard output}, and @dfn{standard error -output}. These streams are, by default, connected to your keyboard and screen, but +already available to them for reading and writing. These are known +as the @dfn{standard input}, @dfn{standard output}, and @dfn{standard +error output}. These open streams (and any other open file or pipe) +are often referred to by the technical term @dfn{file descriptors}. + +These streams are, by default, connected to your keyboard and screen, but they are often redirected with the shell, via the @samp{<}, @samp{<<}, @samp{>}, @samp{>>}, @samp{>&}, and @samp{|} operators. Standard error is typically used for writing error messages; the reason there are two separate @@ -9865,7 +9856,7 @@ redirected separately. @cindex differences in @command{awk} and @command{gawk}, error messages @cindex error handling -In other implementations of @command{awk}, the only way to write an error +In traditional implementations of @command{awk}, the only way to write an error message to standard error in an @command{awk} program is as follows: @example @@ -9898,15 +9889,12 @@ that happens, writing to the screen is not correct. In fact, if terminal at all. Then opening @file{/dev/tty} fails. -@command{gawk} provides special @value{FN}s for accessing the three standard -streams. @value{COMMONEXT} It also provides syntax for accessing -any other inherited open files. -These open files are often referred to by the technical term -@dfn{file descriptor}. -If the @value{FN} matches -one of these special names when @command{gawk} redirects input or output, -then it directly uses the descriptor that the @value{FN} stands for. -These special @value{FN}s work for all operating systems that @command{gawk} +@command{gawk}, BWK @command{awk} and @command{mawk} provide +special @value{FN}s for accessing the three standard streams. +If the @value{FN} matches one of these special names when @command{gawk} +(or one of the others) redirects input or output, then it directly uses +the descriptor that the @value{FN} stands for. These special +@value{FN}s work for all operating systems that @command{gawk} has been ported to, not just those that are POSIX-compliant: @cindex common extensions, @code{/dev/stdin} special file @@ -9928,19 +9916,10 @@ The standard output (file descriptor 1). @item /dev/stderr The standard error output (file descriptor 2). - -@item /dev/fd/@var{N} -The file associated with file descriptor @var{N}. Such a file must -be opened by the program initiating the @command{awk} execution (typically -the shell). Unless special pains are taken in the shell from which -@command{gawk} is invoked, only descriptors 0, 1, and 2 are available. @end table -The @value{FN}s @file{/dev/stdin}, @file{/dev/stdout}, and @file{/dev/stderr} -are aliases for @file{/dev/fd/0}, @file{/dev/fd/1}, and @file{/dev/fd/2}, -respectively. However, they are more self-explanatory. -The proper way to write an error message in a @command{gawk} program -is to use @file{/dev/stderr}, like this: +With these facilities, +the proper way to write an error message then becomes: @example print "Serious error detected!" > "/dev/stderr" @@ -9952,14 +9931,51 @@ Like any other redirection, the value must be a string. It is a common error to omit the quotes, which leads to confusing results. -Finally, using the @code{close()} function on a @value{FN} of the +@command{gawk} does not treat these @value{FN}s as special when +in POSIX compatibility mode. However, since BWK @command{awk} +supports them, @command{gawk} does support them even when +invoked with the @option{--traditional} option (@pxref{Options}). + +@node Special Files +@section Special @value{FFN}s in @command{gawk} +@c STARTOFRANGE gfn +@cindex @command{gawk}, file names in + +Besides access to standard input, stanard output, and standard error, +@command{gawk} provides access to any open file descriptor. +Additionally, there are special @value{FN}s reserved for +TCP/IP networking. + +@menu +* Other Inherited Files:: Accessing other open files with + @command{gawk}. +* Special Network:: Special files for network communications. +* Special Caveats:: Things to watch out for. +@end menu + +@node Other Inherited Files +@subsection Accessing Other Open Files With @command{gawk} + +Besides the @code{/dev/stdin}, @code{/dev/stdout}, and @code{/dev/stderr} +special @value{FN}s mentioned earlier, @command{gawk} provides syntax +for accessing any other inherited open file: + +@table @file +@item /dev/fd/@var{N} +The file associated with file descriptor @var{N}. Such a file must +be opened by the program initiating the @command{awk} execution (typically +the shell). Unless special pains are taken in the shell from which +@command{gawk} is invoked, only descriptors 0, 1, and 2 are available. +@end table + +The @value{FN}s @file{/dev/stdin}, @file{/dev/stdout}, and @file{/dev/stderr} +are essentially aliases for @file{/dev/fd/0}, @file{/dev/fd/1}, and +@file{/dev/fd/2}, respectively. However, those names are more self-explanatory. + +Note that using @code{close()} on a @value{FN} of the form @code{"/dev/fd/@var{N}"}, for file descriptor numbers above two, does actually close the given file descriptor. -The @file{/dev/stdin}, @file{/dev/stdout}, and @file{/dev/stderr} -special files are also recognized internally by several other -versions of @command{awk}. - @node Special Network @subsection Special Files for Network Communications @cindex networks, support for @@ -9995,8 +10011,13 @@ special @value{FN}s that @command{gawk} provides: @cindex compatibility mode (@command{gawk}), file names @cindex file names, in compatibility mode @item -Recognition of these special @value{FN}s is disabled if @command{gawk} is in -compatibility mode (@pxref{Options}). +Recognition of the @value{FN}s for the three standard pre-opened +files is disabled only in POSIX mode. + +@item +Recognition of the other special @value{FN}s is disabled if @command{gawk} is in +compatibility mode (either @option{--traditional} or @option{--posix}; +@pxref{Options}). @item @command{gawk} @emph{always} diff --git a/doc/gawktexi.in b/doc/gawktexi.in index ecd6a972..1acd1a99 100644 --- a/doc/gawktexi.in +++ b/doc/gawktexi.in @@ -560,8 +560,8 @@ particular records in a file and perform operations upon them. * Regexp Field Splitting:: Using regexps as the field separator. * Single Character Fields:: Making each character a separate field. -* Command Line Field Separator:: Setting @code{FS} from the - command line. +* Command Line Field Separator:: Setting @code{FS} from the command + line. * Full Line Fields:: Making the full line be a single field. * Field Splitting Summary:: Some final points and a summary table. @@ -605,10 +605,12 @@ particular records in a file and perform operations upon them. * Printf Examples:: Several examples. * Redirection:: How to redirect output to multiple files and pipes. +* Special FD:: Special files for I/O. * Special Files:: File name interpretation in @command{gawk}. @command{gawk} allows access to inherited file descriptors. -* Special FD:: Special files for I/O. +* Other Inherited Files:: Accessing other open files with + @command{gawk}. * Special Network:: Special files for network communications. * Special Caveats:: Things to watch out for. @@ -8405,6 +8407,7 @@ and discusses the @code{close()} built-in function. * Printf:: The @code{printf} statement. * Redirection:: How to redirect output to multiple files and pipes. +* Special FD:: Special files for I/O. * Special Files:: File name interpretation in @command{gawk}. @command{gawk} allows access to inherited file descriptors. @@ -9390,23 +9393,8 @@ It then sends the list to the shell for execution. @c ENDOFRANGE outre @c ENDOFRANGE reout -@node Special Files -@section Special @value{FFN}s in @command{gawk} -@c STARTOFRANGE gfn -@cindex @command{gawk}, file names in - -@command{gawk} provides a number of special @value{FN}s that it interprets -internally. These @value{FN}s provide access to standard pre-opened files -and TCP/IP networking. - -@menu -* Special FD:: Special files for I/O. -* Special Network:: Special files for network communications. -* Special Caveats:: Things to watch out for. -@end menu - @node Special FD -@subsection Special Files for Standard Pre-Opened Files +@section Special Files for Standard Pre-Opened Data Streams @cindex standard input @cindex input, standard @cindex standard output @@ -9417,9 +9405,12 @@ and TCP/IP networking. @cindex files, descriptors, See file descriptors Running programs conventionally have three input and output streams -already available to them for reading and writing. These are known as -the @dfn{standard input}, @dfn{standard output}, and @dfn{standard error -output}. These streams are, by default, connected to your keyboard and screen, but +already available to them for reading and writing. These are known +as the @dfn{standard input}, @dfn{standard output}, and @dfn{standard +error output}. These open streams (and any other open file or pipe) +are often referred to by the technical term @dfn{file descriptors}. + +These streams are, by default, connected to your keyboard and screen, but they are often redirected with the shell, via the @samp{<}, @samp{<<}, @samp{>}, @samp{>>}, @samp{>&}, and @samp{|} operators. Standard error is typically used for writing error messages; the reason there are two separate @@ -9428,7 +9419,7 @@ redirected separately. @cindex differences in @command{awk} and @command{gawk}, error messages @cindex error handling -In other implementations of @command{awk}, the only way to write an error +In traditional implementations of @command{awk}, the only way to write an error message to standard error in an @command{awk} program is as follows: @example @@ -9461,15 +9452,12 @@ that happens, writing to the screen is not correct. In fact, if terminal at all. Then opening @file{/dev/tty} fails. -@command{gawk} provides special @value{FN}s for accessing the three standard -streams. @value{COMMONEXT} It also provides syntax for accessing -any other inherited open files. -These open files are often referred to by the technical term -@dfn{file descriptor}. -If the @value{FN} matches -one of these special names when @command{gawk} redirects input or output, -then it directly uses the descriptor that the @value{FN} stands for. -These special @value{FN}s work for all operating systems that @command{gawk} +@command{gawk}, BWK @command{awk} and @command{mawk} provide +special @value{FN}s for accessing the three standard streams. +If the @value{FN} matches one of these special names when @command{gawk} +(or one of the others) redirects input or output, then it directly uses +the descriptor that the @value{FN} stands for. These special +@value{FN}s work for all operating systems that @command{gawk} has been ported to, not just those that are POSIX-compliant: @cindex common extensions, @code{/dev/stdin} special file @@ -9491,19 +9479,10 @@ The standard output (file descriptor 1). @item /dev/stderr The standard error output (file descriptor 2). - -@item /dev/fd/@var{N} -The file associated with file descriptor @var{N}. Such a file must -be opened by the program initiating the @command{awk} execution (typically -the shell). Unless special pains are taken in the shell from which -@command{gawk} is invoked, only descriptors 0, 1, and 2 are available. @end table -The @value{FN}s @file{/dev/stdin}, @file{/dev/stdout}, and @file{/dev/stderr} -are aliases for @file{/dev/fd/0}, @file{/dev/fd/1}, and @file{/dev/fd/2}, -respectively. However, they are more self-explanatory. -The proper way to write an error message in a @command{gawk} program -is to use @file{/dev/stderr}, like this: +With these facilities, +the proper way to write an error message then becomes: @example print "Serious error detected!" > "/dev/stderr" @@ -9515,14 +9494,51 @@ Like any other redirection, the value must be a string. It is a common error to omit the quotes, which leads to confusing results. -Finally, using the @code{close()} function on a @value{FN} of the +@command{gawk} does not treat these @value{FN}s as special when +in POSIX compatibility mode. However, since BWK @command{awk} +supports them, @command{gawk} does support them even when +invoked with the @option{--traditional} option (@pxref{Options}). + +@node Special Files +@section Special @value{FFN}s in @command{gawk} +@c STARTOFRANGE gfn +@cindex @command{gawk}, file names in + +Besides access to standard input, stanard output, and standard error, +@command{gawk} provides access to any open file descriptor. +Additionally, there are special @value{FN}s reserved for +TCP/IP networking. + +@menu +* Other Inherited Files:: Accessing other open files with + @command{gawk}. +* Special Network:: Special files for network communications. +* Special Caveats:: Things to watch out for. +@end menu + +@node Other Inherited Files +@subsection Accessing Other Open Files With @command{gawk} + +Besides the @code{/dev/stdin}, @code{/dev/stdout}, and @code{/dev/stderr} +special @value{FN}s mentioned earlier, @command{gawk} provides syntax +for accessing any other inherited open file: + +@table @file +@item /dev/fd/@var{N} +The file associated with file descriptor @var{N}. Such a file must +be opened by the program initiating the @command{awk} execution (typically +the shell). Unless special pains are taken in the shell from which +@command{gawk} is invoked, only descriptors 0, 1, and 2 are available. +@end table + +The @value{FN}s @file{/dev/stdin}, @file{/dev/stdout}, and @file{/dev/stderr} +are essentially aliases for @file{/dev/fd/0}, @file{/dev/fd/1}, and +@file{/dev/fd/2}, respectively. However, those names are more self-explanatory. + +Note that using @code{close()} on a @value{FN} of the form @code{"/dev/fd/@var{N}"}, for file descriptor numbers above two, does actually close the given file descriptor. -The @file{/dev/stdin}, @file{/dev/stdout}, and @file{/dev/stderr} -special files are also recognized internally by several other -versions of @command{awk}. - @node Special Network @subsection Special Files for Network Communications @cindex networks, support for @@ -9558,8 +9574,13 @@ special @value{FN}s that @command{gawk} provides: @cindex compatibility mode (@command{gawk}), file names @cindex file names, in compatibility mode @item -Recognition of these special @value{FN}s is disabled if @command{gawk} is in -compatibility mode (@pxref{Options}). +Recognition of the @value{FN}s for the three standard pre-opened +files is disabled only in POSIX mode. + +@item +Recognition of the other special @value{FN}s is disabled if @command{gawk} is in +compatibility mode (either @option{--traditional} or @option{--posix}; +@pxref{Options}). @item @command{gawk} @emph{always} @@ -1550,6 +1550,17 @@ nextrres: * change the string. */ +/* + * 9/2014: Flow here is a little messy. + * + * For do_posix, we don't allow any of the special filenames. + * + * For do_traditional, we allow /dev/{stdin,stdout,stderr} since BWK awk + * (and mawk) support them. But we don't allow /dev/fd/N or /inet. + * + * Note that for POSIX systems os_devopen() is a no-op. + */ + int devopen(const char *name, const char *mode) { @@ -1565,7 +1576,7 @@ devopen(const char *name, const char *mode) flag = str2mode(mode); openfd = INVALID_HANDLE; - if (do_traditional) + if (do_posix) goto strictopen; if ((openfd = os_devopen(name, flag)) != INVALID_HANDLE) { @@ -1582,6 +1593,8 @@ devopen(const char *name, const char *mode) openfd = fileno(stdout); else if (strcmp(cp, "stderr") == 0 && (flag & O_ACCMODE) == O_WRONLY) openfd = fileno(stderr); + else if (do_traditional) + goto strictopen; else if (strncmp(cp, "fd/", 3) == 0) { struct stat sbuf; @@ -1594,6 +1607,8 @@ devopen(const char *name, const char *mode) /* do not set close-on-exec for inherited fd's */ if (openfd != INVALID_HANDLE) return openfd; + } else if (do_traditional) { + goto strictopen; } else if (inetfile(name, & isi)) { #ifdef HAVE_SOCKETS cp = (char *) name; |