diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2014-02-27 23:41:28 +0200 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2014-02-27 23:41:28 +0200 |
commit | b146e4641b0de2957a27e97baa4b35858c1cdf8f (patch) | |
tree | b6a14409af42af19f034a2b8ba5cf69cad0482a6 | |
parent | 8924decac2ae2a37f30c6a688e671d2b32d5ff89 (diff) | |
parent | 4cea49ca8f817354ffd513c6ec808152e9299f21 (diff) | |
download | egawk-b146e4641b0de2957a27e97baa4b35858c1cdf8f.tar.gz egawk-b146e4641b0de2957a27e97baa4b35858c1cdf8f.tar.bz2 egawk-b146e4641b0de2957a27e97baa4b35858c1cdf8f.zip |
Merge branch 'gawk-4.1-stable'
-rw-r--r-- | doc/ChangeLog | 2 | ||||
-rw-r--r-- | doc/gawk.info | 520 | ||||
-rw-r--r-- | doc/gawk.texi | 114 | ||||
-rw-r--r-- | doc/gawktexi.in | 114 |
4 files changed, 371 insertions, 379 deletions
diff --git a/doc/ChangeLog b/doc/ChangeLog index 2c3cb257..f88c3799 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,7 +1,7 @@ 2014-02-27 Arnold D. Robbins <arnold@skeeve.com> * gawktexi.in: Lots of small fixes throughout, update of - profiling output. + profiling output. Finished fixes needed before a release. 2014-02-20 Arnold D. Robbins <arnold@skeeve.com> diff --git a/doc/gawk.info b/doc/gawk.info index 10307b39..2e314a01 100644 --- a/doc/gawk.info +++ b/doc/gawk.info @@ -19143,9 +19143,9 @@ File: gawk.info, Node: Translator i18n, Next: I18N Example, Prev: Programmer =============================== Once a program's translatable strings have been marked, they must be -extracted to create the initial `.po' file. As part of translation, it -is often helpful to rearrange the order in which arguments to `printf' -are output. +extracted to create the initial `.pot' file. As part of translation, +it is often helpful to rearrange the order in which arguments to +`printf' are output. `gawk''s `--gen-pot' command-line option extracts the messages and is discussed next. After that, `printf''s ability to rearrange the @@ -19218,7 +19218,7 @@ second: $ gawk 'BEGIN { > string = "Dont Panic" - > printf _"%2$d characters live in \"%1$s\"\n", + > printf "%2$d characters live in \"%1$s\"\n", > string, length(string) > }' -| 10 characters live in "Dont Panic" @@ -19243,7 +19243,7 @@ precision capability: `gawk' does not allow you to mix regular format specifiers and those with positional specifiers in the same string: - $ gawk 'BEGIN { printf _"%d %3$s\n", 1, 2, "hi" }' + $ gawk 'BEGIN { printf "%d %3$s\n", 1, 2, "hi" }' error--> gawk: cmd. line:1: fatal: must use `count$' on all formats or none NOTE: There are some pathological cases that `gawk' may fail to @@ -19605,7 +19605,7 @@ File: gawk.info, Node: Debugger Invocation, Next: Finding The Bug, Up: Sample 14.2.1 How to Start the Debugger -------------------------------- -Starting the debugger is almost exactly like running `awk', except you +Starting the debugger is almost exactly like running `gawk', except you have to pass an additional option `--debug' or the corresponding short option `-D'. The file(s) containing the program and any supporting code are given on the command line as arguments to one or more `-f' @@ -19718,8 +19718,8 @@ our test input above. Let's look at `NR': -| NR = number (2) So we can see that `are_equal()' was only called for the second record -of the file. Of course, this is because our program contained a rule -for `NR == 1': +of the file. Of course, this is because our program contains a rule for +`NR == 1': NR == 1 { last = $0 @@ -21534,7 +21534,7 @@ floating-point value to begin with: gawk -M 'BEGIN { n = 13.0; print n % 2.0 }' - Note that for the particular example above, there is likely best to + Note that for the particular example above, it is likely best to just use the following: gawk -M 'BEGIN { n = 13; print n % 2 }' @@ -22171,7 +22171,7 @@ Extension functions are described by the following record: `awk_value_t *(*function)(int num_actual_args, awk_value_t *result);' This is a pointer to the C function that provides the desired functionality. The function must fill in the result with either a - number or a string. `awk' takes ownership of any string memory. + number or a string. `gawk' takes ownership of any string memory. As mentioned earlier, string memory *must* come from `malloc()'. The `num_actual_args' argument tells the C function how many @@ -24066,7 +24066,7 @@ declarations and argument checking: awk_array_t array; int ret; struct stat sbuf; - /* default is stat() */ + /* default is lstat() */ int (*statfunc)(const char *path, struct stat *sbuf) = lstat; assert(result != NULL); @@ -24464,12 +24464,16 @@ File: gawk.info, Node: Extension Sample Fnmatch, Next: Extension Sample Fork, This extension provides an interface to the C library `fnmatch()' function. The usage is: - @load "fnmatch" +`@load "fnmatch"' + This is how you load the extension. - result = fnmatch(pattern, string, flags) +`result = fnmatch(pattern, string, flags)' + The return value is zero on success, `FNM_NOMATCH' if the string + did not match the pattern, or a different non-zero value if an + error occurred. - The `fnmatch' extension adds a single function named `fnmatch()', -one constant (`FNM_NOMATCH'), and an array of flag values named `FNM'. + Besides the `fnmatch()' function, the `fnmatch' extension adds one +constant (`FNM_NOMATCH'), and an array of flag values named `FNM'. The arguments to `fnmatch()' are: @@ -24483,10 +24487,6 @@ one constant (`FNM_NOMATCH'), and an array of flag values named `FNM'. Either zero, or the bitwise OR of one or more of the flags in the `FNM' array. - The return value is zero on success, `FNM_NOMATCH' if the string did -not match the pattern, or a different non-zero value if an error -occurred. - The flags are follows: `FNM["CASEFOLD"]' Corresponds to the `FNM_CASEFOLD' flag as defined in @@ -24522,14 +24522,14 @@ The `fork' extension adds three functions, as follows. This is how you load the extension. `pid = fork()' - This function creates a new process. The return value is the zero - in the child and the process-id number of the child in the parent, - or -1 upon error. In the latter case, `ERRNO' indicates the - problem. In the child, `PROCINFO["pid"]' and `PROCINFO["ppid"]' - are updated to reflect the correct values. + This function creates a new process. The return value is zero in + the child and the process-ID number of the child in the parent, or + -1 upon error. In the latter case, `ERRNO' indicates the problem. + In the child, `PROCINFO["pid"]' and `PROCINFO["ppid"]' are updated + to reflect the correct values. `ret = waitpid(pid)' - This function takes a numeric argument, which is the process-id to + This function takes a numeric argument, which is the process-ID to wait for. The return value is that of the `waitpid()' system call. `ret = wait()' @@ -25619,7 +25619,7 @@ in POSIX `awk', in the order they were added to `gawk'. - The `-i' and `--include' options load `awk' library files. - - The `-l' and `--load' options for load compiled dynamic + - The `-l' and `--load' options load compiled dynamic extensions. - The `-M' and `--bignum' options enable MPFR. @@ -25633,8 +25633,9 @@ in POSIX `awk', in the order they were added to `gawk'. * Support for high precision arithmetic with MPFR. (*note Gawk and MPFR::). - * The `and()', `or()' and `xor()' functions allow any number of - arguments, with a minimum of two (*note Bitwise Functions::). + * The `and()', `or()' and `xor()' functions changed to allow any + number of arguments, with a minimum of two (*note Bitwise + Functions::). * The dynamic extension interface was completely redone (*note Dynamic Extensions::). @@ -25653,18 +25654,18 @@ available versions of `awk' (*note Other Versions::). Feature BWK Awk Mawk GNU Awk -------------------------------------------------------- `\x' Escape sequence X X X -`RS' as regexp X X `FS' as null string X X X `/dev/stdin' special file X X X `/dev/stdout' special file X X X `/dev/stderr' special file X X X -`**' and `**=' operators X X -`fflush()' function X X X -`func' keyword X X -`nextfile' statement X X X `delete' without subscript X X X +`fflush()' function X X X `length()' of an array X X X +`nextfile' statement X X X +`**' and `**=' operators X X +`func' keyword X X `BINMODE' variable X X +`RS' as regexp X X Time related functions X X (Technically speaking, as of late 2012, `fflush()', `delete ARRAY', @@ -25760,17 +25761,17 @@ of range expressions was _undefined_.(3) By using this lovely technical term, the standard gives license to implementors to implement ranges in whatever way they choose. The `gawk' maintainer chose to apply the pre-POSIX meaning in all cases: -the default regexp matching; with `--traditional', and with `--posix'; +the default regexp matching; with `--traditional' and with `--posix'; in all cases, `gawk' remains POSIX compliant. ---------- Footnotes ---------- (1) And Life was good. - (2) And thus was born the Campain for Rational Range Interpretation -(or RRI). A number of GNU tools, such as `grep' and `sed', have either -implemented this change, or will soon. Thanks to Karl Berry for -coining the phrase "Rational Range Interpretation." + (2) And thus was born the Campaign for Rational Range Interpretation +(or RRI). A number of GNU tools have either implemented this change, or +will soon. Thanks to Karl Berry for coining the phrase "Rational Range +Interpretation." (3) See the standard (http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap09.html#tag_09_03_05) @@ -26252,8 +26253,8 @@ failure is not described there, please send in a bug report (*note Bugs::). Of course, once you've built `gawk', it is likely that you will wish -to install it. To do so, you need to run the command `make check', as -a user with the appropriate permissions. How to do this varies by +to install it. To do so, you need to run the command `make install', +as a user with the appropriate permissions. How to do this varies by system, but on many systems you can use the `sudo' command to do so. The command then becomes `sudo make install'. It is likely that you will be asked for your password, and you will have to have been set up @@ -26536,10 +26537,9 @@ File: gawk.info, Node: PC Using, Next: Cygwin, Prev: PC Testing, Up: PC Inst B.3.1.4 Using `gawk' on PC Operating Systems ............................................ -With the exception of the Cygwin environment, the `|&' operator and -TCP/IP networking (*note TCP/IP Networking::) are not supported for -MS-DOS or MS-Windows. EMX (OS/2 only) does support at least the `|&' -operator. +Under MS-DOS and MS-Windows, the Cygwin and MinGW environments support +both the `|&' operator and TCP/IP networking (*note TCP/IP +Networking::). EMX (OS/2 only) supports at least the `|&' operator. The MS-DOS and MS-Windows versions of `gawk' search for program files as described in *note AWKPATH Variable::. However, semicolons @@ -26632,9 +26632,9 @@ B.3.1.5 Using `gawk' In The Cygwin Environment `gawk' can be built and used "out of the box" under MS-Windows if you are using the Cygwin environment (http://www.cygwin.com). This -environment provides an excellent simulation of Unix, using the GNU -tools, such as Bash, the GNU Compiler Collection (GCC), GNU Make, and -other GNU programs. Compilation and installation for Cygwin is the +environment provides an excellent simulation of GNU/Linux, using the +GNU tools, such as Bash, the GNU Compiler Collection (GCC), GNU Make, +and other GNU programs. Compilation and installation for Cygwin is the same as for a Unix system: tar -xvpzf gawk-4.1.0.tar.gz @@ -26646,10 +26646,6 @@ same as for a Unix system: on Cygwin takes considerably longer. However, it does finish, and then the `make' proceeds as usual. - NOTE: The `|&' operator and TCP/IP networking (*note TCP/IP - Networking::) are fully supported in the Cygwin environment. This - is not true for any other environment on MS-Windows. - File: gawk.info, Node: MSYS, Prev: Cygwin, Up: PC Installation @@ -26813,7 +26809,8 @@ add the `gawk' and `awk' to the system wide `DCLTABLES'. The DCL syntax is documented in the `gawk.hlp' file. - Optionally, `gawk.hlp' entry can be loaded into a VMS help library: + Optionally, the `gawk.hlp' entry can be loaded into a VMS help +library: $ LIBRARY/HELP sys$help:helplib [.vms]gawk.hlp @@ -30131,7 +30128,7 @@ Index * /inet4/... special files (gawk): TCP/IP Networking. (line 6) * /inet6/... special files (gawk): TCP/IP Networking. (line 6) * ; (semicolon): Statements/Lines. (line 91) -* ; (semicolon), AWKPATH variable and: PC Using. (line 11) +* ; (semicolon), AWKPATH variable and: PC Using. (line 10) * ; (semicolon), separating statements in actions <1>: Statements. (line 10) * ; (semicolon), separating statements in actions: Action Overview. @@ -30401,7 +30398,7 @@ Index * awk, versions of, See Also Brian Kernighan's awk: BTL. (line 6) * awka compiler for awk: Other Versions. (line 64) * AWKLIBPATH environment variable: AWKLIBPATH Variable. (line 6) -* AWKPATH environment variable <1>: PC Using. (line 11) +* AWKPATH environment variable <1>: PC Using. (line 10) * AWKPATH environment variable: AWKPATH Variable. (line 6) * awkprof.out file: Profiling. (line 6) * awksed.awk program: Simple Sed. (line 25) @@ -30494,7 +30491,7 @@ Index * bindtextdomain() function (gawk): I18N Functions. (line 12) * bindtextdomain() function (gawk), portability and: I18N Portability. (line 33) -* BINMODE variable <1>: PC Using. (line 34) +* BINMODE variable <1>: PC Using. (line 33) * BINMODE variable: User-modified. (line 10) * bits2str() user-defined function: Bitwise Functions. (line 70) * bitwise, complement: Bitwise Functions. (line 25) @@ -30639,7 +30636,7 @@ Index * common extensions, /dev/stdin special file: Special FD. (line 46) * common extensions, /dev/stdout special file: Special FD. (line 46) * common extensions, \x escape sequence: Escape Sequences. (line 61) -* common extensions, BINMODE variable: PC Using. (line 34) +* common extensions, BINMODE variable: PC Using. (line 33) * common extensions, delete to delete entire arrays: Delete. (line 39) * common extensions, func keyword: Definition Syntax. (line 83) * common extensions, length() applied to an array: String Functions. @@ -30908,7 +30905,7 @@ Index * differences in awk and gawk, BEGINFILE/ENDFILE patterns: BEGINFILE/ENDFILE. (line 6) * differences in awk and gawk, BINMODE variable <1>: PC Using. - (line 34) + (line 33) * differences in awk and gawk, BINMODE variable: User-modified. (line 23) * differences in awk and gawk, close() function: Close Files And Pipes. @@ -31095,7 +31092,7 @@ Index * extensions, common, /dev/stdin special file: Special FD. (line 46) * extensions, common, /dev/stdout special file: Special FD. (line 46) * extensions, common, \x escape sequence: Escape Sequences. (line 61) -* extensions, common, BINMODE variable: PC Using. (line 34) +* extensions, common, BINMODE variable: PC Using. (line 33) * extensions, common, delete to delete entire arrays: Delete. (line 39) * extensions, common, func keyword: Definition Syntax. (line 83) * extensions, common, length() applied to an array: String Functions. @@ -31224,7 +31221,7 @@ Index * floating-point, numbers: General Arithmetic. (line 6) * floating-point, VAX/VMS: VMS Running. (line 51) * fnmatch() extension function: Extension Sample Fnmatch. - (line 6) + (line 12) * FNR variable <1>: Auto-set. (line 112) * FNR variable: Records. (line 6) * FNR variable, changing: Auto-set. (line 323) @@ -31384,11 +31381,11 @@ Index * gawk, line continuation in: Conditional Exp. (line 34) * gawk, LINT variable in: User-modified. (line 98) * gawk, list of contributors to: Contributors. (line 6) -* gawk, MS-DOS version of: PC Using. (line 11) -* gawk, MS-Windows version of: PC Using. (line 11) +* gawk, MS-DOS version of: PC Using. (line 10) +* gawk, MS-Windows version of: PC Using. (line 10) * gawk, newlines in: Statements/Lines. (line 12) * gawk, octal numbers and: Nondecimal-numbers. (line 42) -* gawk, OS/2 version of: PC Using. (line 11) +* gawk, OS/2 version of: PC Using. (line 10) * gawk, PROCINFO array in <1>: Two-way I/O. (line 116) * gawk, PROCINFO array in <2>: Time Functions. (line 47) * gawk, PROCINFO array in: Auto-set. (line 142) @@ -31752,7 +31749,7 @@ Index (line 9) * matching, leftmost longest: Multiple Line. (line 26) * matching, null strings: Gory Details. (line 164) -* mawk program: Other Versions. (line 44) +* mawk utility: Other Versions. (line 44) * McPhee, Patrick: Contributors. (line 100) * message object files: Explaining gettext. (line 41) * message object files, converting from portable object files: I18N Example. @@ -32152,6 +32149,7 @@ Index * r debugger command (alias for run): Debugger Execution Control. (line 62) * Rakitzis, Byron: History Sorting. (line 25) +* Ramey, Chet <1>: General Data Types. (line 6) * Ramey, Chet: Acknowledgments. (line 60) * rand() function: Numeric Functions. (line 34) * random numbers, Cliff: Cliff Random Function. @@ -32264,9 +32262,10 @@ Index * Robbins, Arnold <1>: Future Extensions. (line 6) * Robbins, Arnold <2>: Bugs. (line 32) * Robbins, Arnold <3>: Contributors. (line 132) -* Robbins, Arnold <4>: Alarm Program. (line 6) -* Robbins, Arnold <5>: Passwd Functions. (line 90) -* Robbins, Arnold <6>: Getline/Pipe. (line 39) +* Robbins, Arnold <4>: General Data Types. (line 6) +* Robbins, Arnold <5>: Alarm Program. (line 6) +* Robbins, Arnold <6>: Passwd Functions. (line 90) +* Robbins, Arnold <7>: Getline/Pipe. (line 39) * Robbins, Arnold: Command Line Field Separator. (line 80) * Robbins, Bill: Getline/Pipe. (line 39) @@ -32308,13 +32307,13 @@ Index * Schreiber, Bert: Acknowledgments. (line 38) * Schreiber, Rita: Acknowledgments. (line 38) * search paths <1>: VMS Running. (line 58) -* search paths <2>: PC Using. (line 11) +* search paths <2>: PC Using. (line 10) * search paths <3>: Igawk Program. (line 368) * search paths <4>: AWKLIBPATH Variable. (line 6) * search paths: AWKPATH Variable. (line 6) * search paths, for shared libraries: AWKLIBPATH Variable. (line 6) * search paths, for source files <1>: VMS Running. (line 58) -* search paths, for source files <2>: PC Using. (line 11) +* search paths, for source files <2>: PC Using. (line 10) * search paths, for source files <3>: Igawk Program. (line 368) * search paths, for source files: AWKPATH Variable. (line 6) * searching: String Functions. (line 150) @@ -32325,7 +32324,7 @@ Index * sed utility: Field Splitting Summary. (line 46) * semicolon (;): Statements/Lines. (line 91) -* semicolon (;), AWKPATH variable and: PC Using. (line 11) +* semicolon (;), AWKPATH variable and: PC Using. (line 10) * semicolon (;), separating statements in actions <1>: Statements. (line 10) * semicolon (;), separating statements in actions: Action Overview. @@ -32346,6 +32345,7 @@ Index (line 12) * shells, quoting, rules for: Quoting. (line 18) * shells, scripts: One-shot. (line 22) +* shells, sea: Undocumented. (line 8) * shells, variables: Using Shell Variables. (line 6) * shift, bitwise: Bitwise Functions. (line 32) @@ -32634,7 +32634,7 @@ Index * Unix awk, password files, field separators and: Command Line Field Separator. (line 72) * Unix, awk scripts and: Executable Scripts. (line 6) -* UNIXROOT variable, on OS/2 systems: PC Using. (line 17) +* UNIXROOT variable, on OS/2 systems: PC Using. (line 16) * unsigned integers: General Arithmetic. (line 15) * until debugger command: Debugger Execution Control. (line 83) @@ -33098,196 +33098,196 @@ Ref: Explaining gettext-Footnote-1767886 Ref: Explaining gettext-Footnote-2768070 Node: Programmer i18n768235 Node: Translator i18n772437 -Node: String Extraction773230 -Ref: String Extraction-Footnote-1774191 -Node: Printf Ordering774277 -Ref: Printf Ordering-Footnote-1777061 -Node: I18N Portability777125 -Ref: I18N Portability-Footnote-1779574 -Node: I18N Example779637 -Ref: I18N Example-Footnote-1782275 -Node: Gawk I18N782347 -Node: Debugger782968 -Node: Debugging783939 -Node: Debugging Concepts784372 -Node: Debugging Terms786228 -Node: Awk Debugging788825 -Node: Sample Debugging Session789717 -Node: Debugger Invocation790237 +Node: String Extraction773231 +Ref: String Extraction-Footnote-1774192 +Node: Printf Ordering774278 +Ref: Printf Ordering-Footnote-1777060 +Node: I18N Portability777124 +Ref: I18N Portability-Footnote-1779573 +Node: I18N Example779636 +Ref: I18N Example-Footnote-1782274 +Node: Gawk I18N782346 +Node: Debugger782967 +Node: Debugging783938 +Node: Debugging Concepts784371 +Node: Debugging Terms786227 +Node: Awk Debugging788824 +Node: Sample Debugging Session789716 +Node: Debugger Invocation790236 Node: Finding The Bug791569 -Node: List of Debugger Commands798057 -Node: Breakpoint Control799391 -Node: Debugger Execution Control803055 -Node: Viewing And Changing Data806415 -Node: Execution Stack809771 -Node: Debugger Info811238 -Node: Miscellaneous Debugger Commands815220 -Node: Readline Support820396 -Node: Limitations821227 -Node: Arbitrary Precision Arithmetic823479 -Ref: Arbitrary Precision Arithmetic-Footnote-1825128 -Node: General Arithmetic825276 -Node: Floating Point Issues826996 -Node: String Conversion Precision827877 -Ref: String Conversion Precision-Footnote-1829582 -Node: Unexpected Results829691 -Node: POSIX Floating Point Problems831844 -Ref: POSIX Floating Point Problems-Footnote-1835669 -Node: Integer Programming835707 -Node: Floating-point Programming837446 -Ref: Floating-point Programming-Footnote-1843777 -Ref: Floating-point Programming-Footnote-2844047 -Node: Floating-point Representation844311 -Node: Floating-point Context845476 -Ref: table-ieee-formats846315 -Node: Rounding Mode847699 -Ref: table-rounding-modes848178 -Ref: Rounding Mode-Footnote-1851193 -Node: Gawk and MPFR851372 -Node: Arbitrary Precision Floats852627 -Ref: Arbitrary Precision Floats-Footnote-1855070 -Node: Setting Precision855386 -Ref: table-predefined-precision-strings856072 -Node: Setting Rounding Mode858217 -Ref: table-gawk-rounding-modes858621 -Node: Floating-point Constants859808 -Node: Changing Precision861237 -Ref: Changing Precision-Footnote-1862634 -Node: Exact Arithmetic862808 -Node: Arbitrary Precision Integers865946 -Ref: Arbitrary Precision Integers-Footnote-1868964 -Node: Dynamic Extensions869111 -Node: Extension Intro870569 -Node: Plugin License871834 -Node: Extension Mechanism Outline872519 -Ref: load-extension872936 -Ref: load-new-function874414 -Ref: call-new-function875409 -Node: Extension API Description877424 -Node: Extension API Functions Introduction878637 -Node: General Data Types883503 -Ref: General Data Types-Footnote-1889105 -Node: Requesting Values889404 -Ref: table-value-types-returned890135 -Node: Constructor Functions891089 -Node: Registration Functions894109 -Node: Extension Functions894794 -Node: Exit Callback Functions897019 -Node: Extension Version String898268 -Node: Input Parsers898918 -Node: Output Wrappers908675 -Node: Two-way processors913185 -Node: Printing Messages915393 -Ref: Printing Messages-Footnote-1916470 -Node: Updating `ERRNO'916622 -Node: Accessing Parameters917361 -Node: Symbol Table Access918591 -Node: Symbol table by name919103 -Node: Symbol table by cookie920850 -Ref: Symbol table by cookie-Footnote-1924980 -Node: Cached values925043 -Ref: Cached values-Footnote-1928492 -Node: Array Manipulation928583 -Ref: Array Manipulation-Footnote-1929681 -Node: Array Data Types929720 -Ref: Array Data Types-Footnote-1932423 -Node: Array Functions932515 -Node: Flattening Arrays936281 -Node: Creating Arrays943133 -Node: Extension API Variables947858 -Node: Extension Versioning948494 -Node: Extension API Informational Variables950395 -Node: Extension API Boilerplate951481 -Node: Finding Extensions955285 -Node: Extension Example955845 -Node: Internal File Description956575 -Node: Internal File Ops960666 -Ref: Internal File Ops-Footnote-1972174 -Node: Using Internal File Ops972314 -Ref: Using Internal File Ops-Footnote-1974667 -Node: Extension Samples974933 -Node: Extension Sample File Functions976457 -Node: Extension Sample Fnmatch984942 -Node: Extension Sample Fork986668 -Node: Extension Sample Inplace987886 -Node: Extension Sample Ord989664 -Node: Extension Sample Readdir990500 -Node: Extension Sample Revout992032 -Node: Extension Sample Rev2way992625 -Node: Extension Sample Read write array993315 -Node: Extension Sample Readfile995198 -Node: Extension Sample API Tests996016 -Node: Extension Sample Time996541 -Node: gawkextlib997905 -Node: Language History1000686 -Node: V7/SVR3.11002279 -Node: SVR41004599 -Node: POSIX1006041 -Node: BTL1007427 -Node: POSIX/GNU1008161 -Node: Feature History1013760 -Node: Common Extensions1026724 -Node: Ranges and Locales1028036 -Ref: Ranges and Locales-Footnote-11032654 -Ref: Ranges and Locales-Footnote-21032681 -Ref: Ranges and Locales-Footnote-31032941 -Node: Contributors1033162 -Node: Installation1038307 -Node: Gawk Distribution1039201 -Node: Getting1039685 -Node: Extracting1040511 -Node: Distribution contents1042203 -Node: Unix Installation1047908 -Node: Quick Installation1048525 -Node: Additional Configuration Options1050969 -Node: Configuration Philosophy1052705 -Node: Non-Unix Installation1055059 -Node: PC Installation1055517 -Node: PC Binary Installation1056816 -Node: PC Compiling1058664 -Node: PC Testing1061608 -Node: PC Using1062784 -Node: Cygwin1066969 -Node: MSYS1067969 -Node: VMS Installation1068483 -Node: VMS Compilation1069247 -Ref: VMS Compilation-Footnote-11070862 -Node: VMS Dynamic Extensions1070920 -Node: VMS Installation Details1072293 -Node: VMS Running1074540 -Node: VMS GNV1077374 -Node: VMS Old Gawk1078097 -Node: Bugs1078567 -Node: Other Versions1082485 -Node: Notes1088569 -Node: Compatibility Mode1089369 -Node: Additions1090152 -Node: Accessing The Source1091079 -Node: Adding Code1092519 -Node: New Ports1098564 -Node: Derived Files1102699 -Ref: Derived Files-Footnote-11108020 -Ref: Derived Files-Footnote-21108054 -Ref: Derived Files-Footnote-31108654 -Node: Future Extensions1108752 -Node: Implementation Limitations1109335 -Node: Extension Design1110587 -Node: Old Extension Problems1111741 -Ref: Old Extension Problems-Footnote-11113249 -Node: Extension New Mechanism Goals1113306 -Ref: Extension New Mechanism Goals-Footnote-11116671 -Node: Extension Other Design Decisions1116857 -Node: Extension Future Growth1118963 -Node: Old Extension Mechanism1119799 -Node: Basic Concepts1121539 -Node: Basic High Level1122220 -Ref: figure-general-flow1122491 -Ref: figure-process-flow1123090 -Ref: Basic High Level-Footnote-11126319 -Node: Basic Data Typing1126504 -Node: Glossary1129859 -Node: Copying1155321 -Node: GNU Free Documentation License1192878 -Node: Index1218015 +Node: List of Debugger Commands798056 +Node: Breakpoint Control799390 +Node: Debugger Execution Control803054 +Node: Viewing And Changing Data806414 +Node: Execution Stack809770 +Node: Debugger Info811237 +Node: Miscellaneous Debugger Commands815219 +Node: Readline Support820395 +Node: Limitations821226 +Node: Arbitrary Precision Arithmetic823478 +Ref: Arbitrary Precision Arithmetic-Footnote-1825127 +Node: General Arithmetic825275 +Node: Floating Point Issues826995 +Node: String Conversion Precision827876 +Ref: String Conversion Precision-Footnote-1829581 +Node: Unexpected Results829690 +Node: POSIX Floating Point Problems831843 +Ref: POSIX Floating Point Problems-Footnote-1835668 +Node: Integer Programming835706 +Node: Floating-point Programming837445 +Ref: Floating-point Programming-Footnote-1843776 +Ref: Floating-point Programming-Footnote-2844046 +Node: Floating-point Representation844310 +Node: Floating-point Context845475 +Ref: table-ieee-formats846314 +Node: Rounding Mode847698 +Ref: table-rounding-modes848177 +Ref: Rounding Mode-Footnote-1851192 +Node: Gawk and MPFR851371 +Node: Arbitrary Precision Floats852626 +Ref: Arbitrary Precision Floats-Footnote-1855069 +Node: Setting Precision855385 +Ref: table-predefined-precision-strings856071 +Node: Setting Rounding Mode858216 +Ref: table-gawk-rounding-modes858620 +Node: Floating-point Constants859807 +Node: Changing Precision861236 +Ref: Changing Precision-Footnote-1862633 +Node: Exact Arithmetic862807 +Node: Arbitrary Precision Integers865945 +Ref: Arbitrary Precision Integers-Footnote-1868960 +Node: Dynamic Extensions869107 +Node: Extension Intro870565 +Node: Plugin License871830 +Node: Extension Mechanism Outline872515 +Ref: load-extension872932 +Ref: load-new-function874410 +Ref: call-new-function875405 +Node: Extension API Description877420 +Node: Extension API Functions Introduction878633 +Node: General Data Types883499 +Ref: General Data Types-Footnote-1889101 +Node: Requesting Values889400 +Ref: table-value-types-returned890131 +Node: Constructor Functions891085 +Node: Registration Functions894105 +Node: Extension Functions894790 +Node: Exit Callback Functions897016 +Node: Extension Version String898265 +Node: Input Parsers898915 +Node: Output Wrappers908672 +Node: Two-way processors913182 +Node: Printing Messages915390 +Ref: Printing Messages-Footnote-1916467 +Node: Updating `ERRNO'916619 +Node: Accessing Parameters917358 +Node: Symbol Table Access918588 +Node: Symbol table by name919100 +Node: Symbol table by cookie920847 +Ref: Symbol table by cookie-Footnote-1924977 +Node: Cached values925040 +Ref: Cached values-Footnote-1928489 +Node: Array Manipulation928580 +Ref: Array Manipulation-Footnote-1929678 +Node: Array Data Types929717 +Ref: Array Data Types-Footnote-1932420 +Node: Array Functions932512 +Node: Flattening Arrays936278 +Node: Creating Arrays943130 +Node: Extension API Variables947855 +Node: Extension Versioning948491 +Node: Extension API Informational Variables950392 +Node: Extension API Boilerplate951478 +Node: Finding Extensions955282 +Node: Extension Example955842 +Node: Internal File Description956572 +Node: Internal File Ops960663 +Ref: Internal File Ops-Footnote-1972172 +Node: Using Internal File Ops972312 +Ref: Using Internal File Ops-Footnote-1974665 +Node: Extension Samples974931 +Node: Extension Sample File Functions976455 +Node: Extension Sample Fnmatch984940 +Node: Extension Sample Fork986709 +Node: Extension Sample Inplace987922 +Node: Extension Sample Ord989700 +Node: Extension Sample Readdir990536 +Node: Extension Sample Revout992068 +Node: Extension Sample Rev2way992661 +Node: Extension Sample Read write array993351 +Node: Extension Sample Readfile995234 +Node: Extension Sample API Tests996052 +Node: Extension Sample Time996577 +Node: gawkextlib997941 +Node: Language History1000722 +Node: V7/SVR3.11002315 +Node: SVR41004635 +Node: POSIX1006077 +Node: BTL1007463 +Node: POSIX/GNU1008197 +Node: Feature History1013796 +Node: Common Extensions1026772 +Node: Ranges and Locales1028084 +Ref: Ranges and Locales-Footnote-11032701 +Ref: Ranges and Locales-Footnote-21032728 +Ref: Ranges and Locales-Footnote-31032962 +Node: Contributors1033183 +Node: Installation1038328 +Node: Gawk Distribution1039222 +Node: Getting1039706 +Node: Extracting1040532 +Node: Distribution contents1042224 +Node: Unix Installation1047929 +Node: Quick Installation1048546 +Node: Additional Configuration Options1050992 +Node: Configuration Philosophy1052728 +Node: Non-Unix Installation1055082 +Node: PC Installation1055540 +Node: PC Binary Installation1056839 +Node: PC Compiling1058687 +Node: PC Testing1061631 +Node: PC Using1062807 +Node: Cygwin1066975 +Node: MSYS1067784 +Node: VMS Installation1068298 +Node: VMS Compilation1069062 +Ref: VMS Compilation-Footnote-11070677 +Node: VMS Dynamic Extensions1070735 +Node: VMS Installation Details1072108 +Node: VMS Running1074359 +Node: VMS GNV1077193 +Node: VMS Old Gawk1077916 +Node: Bugs1078386 +Node: Other Versions1082304 +Node: Notes1088388 +Node: Compatibility Mode1089188 +Node: Additions1089971 +Node: Accessing The Source1090898 +Node: Adding Code1092338 +Node: New Ports1098383 +Node: Derived Files1102518 +Ref: Derived Files-Footnote-11107839 +Ref: Derived Files-Footnote-21107873 +Ref: Derived Files-Footnote-31108473 +Node: Future Extensions1108571 +Node: Implementation Limitations1109154 +Node: Extension Design1110406 +Node: Old Extension Problems1111560 +Ref: Old Extension Problems-Footnote-11113068 +Node: Extension New Mechanism Goals1113125 +Ref: Extension New Mechanism Goals-Footnote-11116490 +Node: Extension Other Design Decisions1116676 +Node: Extension Future Growth1118782 +Node: Old Extension Mechanism1119618 +Node: Basic Concepts1121358 +Node: Basic High Level1122039 +Ref: figure-general-flow1122310 +Ref: figure-process-flow1122909 +Ref: Basic High Level-Footnote-11126138 +Node: Basic Data Typing1126323 +Node: Glossary1129678 +Node: Copying1155140 +Node: GNU Free Documentation License1192697 +Node: Index1217834 End Tag Table diff --git a/doc/gawk.texi b/doc/gawk.texi index 83f2d626..1737b001 100644 --- a/doc/gawk.texi +++ b/doc/gawk.texi @@ -4221,6 +4221,7 @@ in case some option becomes obsolete in a future version of @command{gawk}. @author Obi-Wan @end quotation +@cindex shells, sea This @value{SECTION} intentionally left blank. @@ -4233,7 +4234,7 @@ blank. @table @code @item -W nostalgia @itemx --nostalgia -Print the message @code{"awk: bailing out near line 1"} and dump core. +Print the message @samp{awk: bailing out near line 1} and dump core. This option was inspired by the common behavior of very early versions of Unix @command{awk} and by a t--shirt. The message is @emph{not} subject to translation in non-English locales. @@ -6558,7 +6559,7 @@ $ @kbd{echo a b | gawk 'BEGIN @{ FS = "" @}} @end example @cindex dark corner, @code{FS} as null string -@cindex FS variable, as null string +@cindex @code{FS} variable, as null string Traditionally, the behavior of @code{FS} equal to @code{""} was not defined. In this case, most versions of Unix @command{awk} simply treat the entire record as only having one field. @@ -26483,7 +26484,7 @@ and use translations from @command{awk}. @cindex portable object files @cindex files, portable object Once a program's translatable strings have been marked, they must -be extracted to create the initial @file{.po} file. +be extracted to create the initial @file{.pot} file. As part of translation, it is often helpful to rearrange the order in which arguments to @code{printf} are output. @@ -26578,7 +26579,7 @@ example, @samp{string} is the first argument and @samp{length(string)} is the se @example $ @kbd{gawk 'BEGIN @{} > @kbd{string = "Dont Panic"} -> @kbd{printf _"%2$d characters live in \"%1$s\"\n",} +> @kbd{printf "%2$d characters live in \"%1$s\"\n",} > @kbd{string, length(string)} > @kbd{@}'} @print{} 10 characters live in "Dont Panic" @@ -26612,7 +26613,7 @@ This is somewhat counterintuitive. and those with positional specifiers in the same string: @example -$ @kbd{gawk 'BEGIN @{ printf _"%d %3$s\n", 1, 2, "hi" @}'} +$ @kbd{gawk 'BEGIN @{ printf "%d %3$s\n", 1, 2, "hi" @}'} @error{} gawk: cmd. line:1: fatal: must use `count$' on all formats or none @end example @@ -27028,12 +27029,13 @@ as our example. @node Debugger Invocation @subsection How to Start the Debugger -Starting the debugger is almost exactly like running @command{awk}, except you have to -pass an additional option @option{--debug} or the corresponding short option @option{-D}. -The file(s) containing the program and any supporting code are given on the command -line as arguments to one or more @option{-f} options. (@command{gawk} is not designed -to debug command-line programs, only programs contained in files.) In our case, -we invoke the debugger like this: +Starting the debugger is almost exactly like running @command{gawk}, +except you have to pass an additional option @option{--debug} or the +corresponding short option @option{-D}. The file(s) containing the +program and any supporting code are given on the command line as arguments +to one or more @option{-f} options. (@command{gawk} is not designed +to debug command-line programs, only programs contained in files.) +In our case, we invoke the debugger like this: @example $ @kbd{gawk -D -f getopt.awk -f join.awk -f uniq.awk inputfile} @@ -27166,7 +27168,7 @@ gawk> @kbd{p NR} @noindent So we can see that @code{are_equal()} was only called for the second record -of the file. Of course, this is because our program contained a rule for +of the file. Of course, this is because our program contains a rule for @samp{NR == 1}: @example @@ -29333,7 +29335,7 @@ to begin with: gawk -M 'BEGIN @{ n = 13.0; print n % 2.0 @}' @end example -Note that for the particular example above, there is likely best +Note that for the particular example above, it is likely best to just use the following: @example @@ -29678,6 +29680,8 @@ the macros as if they were functions. @node General Data Types @subsection General Purpose Data Types +@cindex Robbins, Arnold +@cindex Ramey, Chet @quotation @i{I have a true love/hate relationship with unions.} @author Arnold Robbins @@ -30005,7 +30009,7 @@ Letter case in function names is significant. This is a pointer to the C function that provides the desired functionality. The function must fill in the result with either a number -or a string. @command{awk} takes ownership of any string memory. +or a string. @command{gawk} takes ownership of any string memory. As mentioned earlier, string memory @strong{must} come from @code{malloc()}. The @code{num_actual_args} argument tells the C function how many @@ -32075,7 +32079,7 @@ do_stat(int nargs, awk_value_t *result) awk_array_t array; int ret; struct stat sbuf; - /* default is stat() */ + /* default is lstat() */ int (*statfunc)(const char *path, struct stat *sbuf) = lstat; assert(result != NULL); @@ -32303,7 +32307,7 @@ upon success or less than zero upon error. In the latter case it updates @code{ERRNO}. @cindex @code{stat()} extension function -@item result = stat("/some/path", statdata [, follow]) +@item result = stat("/some/path", statdata @r{[}, follow@r{]}) The @code{stat()} function provides a hook into the @code{stat()} system call. It returns zero upon success or less than zero upon error. @@ -32513,19 +32517,23 @@ See @file{test/fts.awk} in the @command{gawk} distribution for an example. @node Extension Sample Fnmatch @subsection Interface To @code{fnmatch()} -@cindex @code{fnmatch()} extension function This extension provides an interface to the C library @code{fnmatch()} function. The usage is: -@example -@@load "fnmatch" +@table @code +@item @@load "fnmatch" +This is how you load the extension. -result = fnmatch(pattern, string, flags) -@end example +@cindex @code{fnmatch()} extension function +@item result = fnmatch(pattern, string, flags) +The return value is zero on success, @code{FNM_NOMATCH} +if the string did not match the pattern, or +a different non-zero value if an error occurred. +@end table -The @code{fnmatch} extension adds a single function named -@code{fnmatch()}, one constant (@code{FNM_NOMATCH}), and an array of -flag values named @code{FNM}. +Besides the @code{fnmatch()} function, the @code{fnmatch} extension +adds one constant (@code{FNM_NOMATCH}), and an array of flag values +named @code{FNM}. The arguments to @code{fnmatch()} are: @@ -32541,10 +32549,6 @@ Either zero, or the bitwise OR of one or more of the flags in the @code{FNM} array. @end table -The return value is zero on success, @code{FNM_NOMATCH} -if the string did not match the pattern, or -a different non-zero value if an error occurred. - The flags are follows: @multitable @columnfractions .25 .75 @@ -32588,15 +32592,15 @@ This is how you load the extension. @cindex @code{fork()} extension function @item pid = fork() -This function creates a new process. The return value is the zero in the -child and the process-id number of the child in the parent, or @minus{}1 +This function creates a new process. The return value is zero in the +child and the process-ID number of the child in the parent, or @minus{}1 upon error. In the latter case, @code{ERRNO} indicates the problem. In the child, @code{PROCINFO["pid"]} and @code{PROCINFO["ppid"]} are updated to reflect the correct values. @cindex @code{waitpid()} extension function @item ret = waitpid(pid) -This function takes a numeric argument, which is the process-id to +This function takes a numeric argument, which is the process-ID to wait for. The return value is that of the @code{waitpid()} system call. @@ -34220,7 +34224,7 @@ The @option{-i} and @option{--include} options load @command{awk} library files. @item -The @option{-l} and @option{--load} options for load compiled dynamic extensions. +The @option{-l} and @option{--load} options load compiled dynamic extensions. @item The @option{-M} and @option{--bignum} options enable MPFR. @@ -34241,7 +34245,7 @@ Support for high precision arithmetic with MPFR. @item The @code{and()}, @code{or()} and @code{xor()} functions -allow any number of arguments, +changed to allow any number of arguments, with a minimum of two (@pxref{Bitwise Functions}). @@ -34266,18 +34270,18 @@ the three most widely-used freely available versions of @command{awk} @multitable {@file{/dev/stderr} special file} {BWK Awk} {Mawk} {GNU Awk} @headitem Feature @tab BWK Awk @tab Mawk @tab GNU Awk @item @samp{\x} Escape sequence @tab X @tab X @tab X -@item @code{RS} as regexp @tab @tab X @tab X @item @code{FS} as null string @tab X @tab X @tab X @item @file{/dev/stdin} special file @tab X @tab X @tab X @item @file{/dev/stdout} special file @tab X @tab X @tab X @item @file{/dev/stderr} special file @tab X @tab X @tab X -@item @code{**} and @code{**=} operators @tab X @tab @tab X -@item @code{fflush()} function @tab X @tab X @tab X -@item @code{func} keyword @tab X @tab @tab X -@item @code{nextfile} statement @tab X @tab X @tab X @item @code{delete} without subscript @tab X @tab X @tab X +@item @code{fflush()} function @tab X @tab X @tab X @item @code{length()} of an array @tab X @tab X @tab X +@item @code{nextfile} statement @tab X @tab X @tab X +@item @code{**} and @code{**=} operators @tab X @tab @tab X +@item @code{func} keyword @tab X @tab @tab X @item @code{BINMODE} variable @tab @tab X @tab X +@item @code{RS} as regexp @tab @tab X @tab X @item Time related functions @tab @tab X @tab X @end multitable @@ -34366,10 +34370,10 @@ the @command{gawk} maintainer grew weary of trying to explain that was in the user's locale. During the development of version 4.0, he modified @command{gawk} to always treat ranges in the original, pre-POSIX fashion, unless @option{--posix} was used (@pxref{Options}).@footnote{And -thus was born the Campain for Rational Range Interpretation (or RRI). A number -of GNU tools, such as @command{grep} and @command{sed}, have either -implemented this change, or will soon. Thanks to Karl Berry for coining the phrase -``Rational Range Interpretation.''} +thus was born the Campaign for Rational Range Interpretation (or +RRI). A number of GNU tools have either implemented this change, +or will soon. Thanks to Karl Berry for coining the phrase ``Rational +Range Interpretation.''} Fortunately, shortly before the final release of @command{gawk} 4.0, the maintainer learned that the 2008 standard had changed the @@ -34382,7 +34386,7 @@ and By using this lovely technical term, the standard gives license to implementors to implement ranges in whatever way they choose. The @command{gawk} maintainer chose to apply the pre-POSIX meaning in all -cases: the default regexp matching; with @option{--traditional}, and with +cases: the default regexp matching; with @option{--traditional} and with @option{--posix}; in all cases, @command{gawk} remains POSIX compliant. @node Contributors @@ -35023,7 +35027,7 @@ please send in a bug report (@pxref{Bugs}). Of course, once you've built @command{gawk}, it is likely that you will wish to install it. To do so, you need to run the command @samp{make -check}, as a user with the appropriate permissions. How to do this +install}, as a user with the appropriate permissions. How to do this varies by system, but on many systems you can use the @command{sudo} command to do so. The command then becomes @samp{sudo make install}. It is likely that you will be asked for your password, and you will have @@ -35349,11 +35353,10 @@ multibyte functionality is not available. @c STARTOFRANGE pcgawon @cindex PC operating systems, @command{gawk} on -With the exception of the Cygwin environment, -the @samp{|&} operator and TCP/IP networking -(@pxref{TCP/IP Networking}) -are not supported for MS-DOS or MS-Windows. EMX (OS/2 only) does support -at least the @samp{|&} operator. +Under MS-DOS and MS-Windows, the Cygwin and MinGW environments support +both the @samp{|&} operator and TCP/IP networking +(@pxref{TCP/IP Networking}). +EMX (OS/2 only) supports at least the @samp{|&} operator. @cindex search paths @cindex search paths, for source files @@ -35483,7 +35486,7 @@ moved into the @code{BEGIN} rule. @command{gawk} can be built and used ``out of the box'' under MS-Windows if you are using the @uref{http://www.cygwin.com, Cygwin environment}. -This environment provides an excellent simulation of Unix, using the +This environment provides an excellent simulation of GNU/Linux, using the GNU tools, such as Bash, the GNU Compiler Collection (GCC), GNU Make, and other GNU programs. Compilation and installation for Cygwin is the same as for a Unix system: @@ -35499,13 +35502,6 @@ When compared to GNU/Linux on the same system, the @samp{configure} step on Cygwin takes considerably longer. However, it does finish, and then the @samp{make} proceeds as usual. -@quotation NOTE -The @samp{|&} operator and TCP/IP networking -(@pxref{TCP/IP Networking}) -are fully supported in the Cygwin environment. This is not true -for any other environment on MS-Windows. -@end quotation - @node MSYS @appendixsubsubsec Using @command{gawk} In The MSYS Environment @@ -35684,7 +35680,7 @@ add the @command{gawk} and @command{awk} to the system wide @samp{DCLTABLES}. The DCL syntax is documented in the @file{gawk.hlp} file. -Optionally, @file{gawk.hlp} entry can be loaded into a VMS help library: +Optionally, the @file{gawk.hlp} entry can be loaded into a VMS help library: @example $ @kbd{LIBRARY/HELP sys$help:helplib [.vms]gawk.hlp} @@ -36028,7 +36024,7 @@ from GCC (the GNU Compiler Collection) works quite nicely. for a list of extensions in this @command{awk} that are not in POSIX @command{awk}. @cindex Brennan, Michael -@cindex @command{mawk} program +@cindex @command{mawk} utility @cindex source code, @command{mawk} @item @command{mawk} Michael Brennan wrote an independent implementation of @command{awk}, diff --git a/doc/gawktexi.in b/doc/gawktexi.in index 4f6723e8..5cb65d10 100644 --- a/doc/gawktexi.in +++ b/doc/gawktexi.in @@ -4149,6 +4149,7 @@ in case some option becomes obsolete in a future version of @command{gawk}. @author Obi-Wan @end quotation +@cindex shells, sea This @value{SECTION} intentionally left blank. @@ -4161,7 +4162,7 @@ blank. @table @code @item -W nostalgia @itemx --nostalgia -Print the message @code{"awk: bailing out near line 1"} and dump core. +Print the message @samp{awk: bailing out near line 1} and dump core. This option was inspired by the common behavior of very early versions of Unix @command{awk} and by a t--shirt. The message is @emph{not} subject to translation in non-English locales. @@ -6273,7 +6274,7 @@ $ @kbd{echo a b | gawk 'BEGIN @{ FS = "" @}} @end example @cindex dark corner, @code{FS} as null string -@cindex FS variable, as null string +@cindex @code{FS} variable, as null string Traditionally, the behavior of @code{FS} equal to @code{""} was not defined. In this case, most versions of Unix @command{awk} simply treat the entire record as only having one field. @@ -25626,7 +25627,7 @@ and use translations from @command{awk}. @cindex portable object files @cindex files, portable object Once a program's translatable strings have been marked, they must -be extracted to create the initial @file{.po} file. +be extracted to create the initial @file{.pot} file. As part of translation, it is often helpful to rearrange the order in which arguments to @code{printf} are output. @@ -25721,7 +25722,7 @@ example, @samp{string} is the first argument and @samp{length(string)} is the se @example $ @kbd{gawk 'BEGIN @{} > @kbd{string = "Dont Panic"} -> @kbd{printf _"%2$d characters live in \"%1$s\"\n",} +> @kbd{printf "%2$d characters live in \"%1$s\"\n",} > @kbd{string, length(string)} > @kbd{@}'} @print{} 10 characters live in "Dont Panic" @@ -25755,7 +25756,7 @@ This is somewhat counterintuitive. and those with positional specifiers in the same string: @example -$ @kbd{gawk 'BEGIN @{ printf _"%d %3$s\n", 1, 2, "hi" @}'} +$ @kbd{gawk 'BEGIN @{ printf "%d %3$s\n", 1, 2, "hi" @}'} @error{} gawk: cmd. line:1: fatal: must use `count$' on all formats or none @end example @@ -26171,12 +26172,13 @@ as our example. @node Debugger Invocation @subsection How to Start the Debugger -Starting the debugger is almost exactly like running @command{awk}, except you have to -pass an additional option @option{--debug} or the corresponding short option @option{-D}. -The file(s) containing the program and any supporting code are given on the command -line as arguments to one or more @option{-f} options. (@command{gawk} is not designed -to debug command-line programs, only programs contained in files.) In our case, -we invoke the debugger like this: +Starting the debugger is almost exactly like running @command{gawk}, +except you have to pass an additional option @option{--debug} or the +corresponding short option @option{-D}. The file(s) containing the +program and any supporting code are given on the command line as arguments +to one or more @option{-f} options. (@command{gawk} is not designed +to debug command-line programs, only programs contained in files.) +In our case, we invoke the debugger like this: @example $ @kbd{gawk -D -f getopt.awk -f join.awk -f uniq.awk inputfile} @@ -26309,7 +26311,7 @@ gawk> @kbd{p NR} @noindent So we can see that @code{are_equal()} was only called for the second record -of the file. Of course, this is because our program contained a rule for +of the file. Of course, this is because our program contains a rule for @samp{NR == 1}: @example @@ -28476,7 +28478,7 @@ to begin with: gawk -M 'BEGIN @{ n = 13.0; print n % 2.0 @}' @end example -Note that for the particular example above, there is likely best +Note that for the particular example above, it is likely best to just use the following: @example @@ -28821,6 +28823,8 @@ the macros as if they were functions. @node General Data Types @subsection General Purpose Data Types +@cindex Robbins, Arnold +@cindex Ramey, Chet @quotation @i{I have a true love/hate relationship with unions.} @author Arnold Robbins @@ -29148,7 +29152,7 @@ Letter case in function names is significant. This is a pointer to the C function that provides the desired functionality. The function must fill in the result with either a number -or a string. @command{awk} takes ownership of any string memory. +or a string. @command{gawk} takes ownership of any string memory. As mentioned earlier, string memory @strong{must} come from @code{malloc()}. The @code{num_actual_args} argument tells the C function how many @@ -31218,7 +31222,7 @@ do_stat(int nargs, awk_value_t *result) awk_array_t array; int ret; struct stat sbuf; - /* default is stat() */ + /* default is lstat() */ int (*statfunc)(const char *path, struct stat *sbuf) = lstat; assert(result != NULL); @@ -31446,7 +31450,7 @@ upon success or less than zero upon error. In the latter case it updates @code{ERRNO}. @cindex @code{stat()} extension function -@item result = stat("/some/path", statdata [, follow]) +@item result = stat("/some/path", statdata @r{[}, follow@r{]}) The @code{stat()} function provides a hook into the @code{stat()} system call. It returns zero upon success or less than zero upon error. @@ -31656,19 +31660,23 @@ See @file{test/fts.awk} in the @command{gawk} distribution for an example. @node Extension Sample Fnmatch @subsection Interface To @code{fnmatch()} -@cindex @code{fnmatch()} extension function This extension provides an interface to the C library @code{fnmatch()} function. The usage is: -@example -@@load "fnmatch" +@table @code +@item @@load "fnmatch" +This is how you load the extension. -result = fnmatch(pattern, string, flags) -@end example +@cindex @code{fnmatch()} extension function +@item result = fnmatch(pattern, string, flags) +The return value is zero on success, @code{FNM_NOMATCH} +if the string did not match the pattern, or +a different non-zero value if an error occurred. +@end table -The @code{fnmatch} extension adds a single function named -@code{fnmatch()}, one constant (@code{FNM_NOMATCH}), and an array of -flag values named @code{FNM}. +Besides the @code{fnmatch()} function, the @code{fnmatch} extension +adds one constant (@code{FNM_NOMATCH}), and an array of flag values +named @code{FNM}. The arguments to @code{fnmatch()} are: @@ -31684,10 +31692,6 @@ Either zero, or the bitwise OR of one or more of the flags in the @code{FNM} array. @end table -The return value is zero on success, @code{FNM_NOMATCH} -if the string did not match the pattern, or -a different non-zero value if an error occurred. - The flags are follows: @multitable @columnfractions .25 .75 @@ -31731,15 +31735,15 @@ This is how you load the extension. @cindex @code{fork()} extension function @item pid = fork() -This function creates a new process. The return value is the zero in the -child and the process-id number of the child in the parent, or @minus{}1 +This function creates a new process. The return value is zero in the +child and the process-ID number of the child in the parent, or @minus{}1 upon error. In the latter case, @code{ERRNO} indicates the problem. In the child, @code{PROCINFO["pid"]} and @code{PROCINFO["ppid"]} are updated to reflect the correct values. @cindex @code{waitpid()} extension function @item ret = waitpid(pid) -This function takes a numeric argument, which is the process-id to +This function takes a numeric argument, which is the process-ID to wait for. The return value is that of the @code{waitpid()} system call. @@ -33363,7 +33367,7 @@ The @option{-i} and @option{--include} options load @command{awk} library files. @item -The @option{-l} and @option{--load} options for load compiled dynamic extensions. +The @option{-l} and @option{--load} options load compiled dynamic extensions. @item The @option{-M} and @option{--bignum} options enable MPFR. @@ -33384,7 +33388,7 @@ Support for high precision arithmetic with MPFR. @item The @code{and()}, @code{or()} and @code{xor()} functions -allow any number of arguments, +changed to allow any number of arguments, with a minimum of two (@pxref{Bitwise Functions}). @@ -33409,18 +33413,18 @@ the three most widely-used freely available versions of @command{awk} @multitable {@file{/dev/stderr} special file} {BWK Awk} {Mawk} {GNU Awk} @headitem Feature @tab BWK Awk @tab Mawk @tab GNU Awk @item @samp{\x} Escape sequence @tab X @tab X @tab X -@item @code{RS} as regexp @tab @tab X @tab X @item @code{FS} as null string @tab X @tab X @tab X @item @file{/dev/stdin} special file @tab X @tab X @tab X @item @file{/dev/stdout} special file @tab X @tab X @tab X @item @file{/dev/stderr} special file @tab X @tab X @tab X -@item @code{**} and @code{**=} operators @tab X @tab @tab X -@item @code{fflush()} function @tab X @tab X @tab X -@item @code{func} keyword @tab X @tab @tab X -@item @code{nextfile} statement @tab X @tab X @tab X @item @code{delete} without subscript @tab X @tab X @tab X +@item @code{fflush()} function @tab X @tab X @tab X @item @code{length()} of an array @tab X @tab X @tab X +@item @code{nextfile} statement @tab X @tab X @tab X +@item @code{**} and @code{**=} operators @tab X @tab @tab X +@item @code{func} keyword @tab X @tab @tab X @item @code{BINMODE} variable @tab @tab X @tab X +@item @code{RS} as regexp @tab @tab X @tab X @item Time related functions @tab @tab X @tab X @end multitable @@ -33509,10 +33513,10 @@ the @command{gawk} maintainer grew weary of trying to explain that was in the user's locale. During the development of version 4.0, he modified @command{gawk} to always treat ranges in the original, pre-POSIX fashion, unless @option{--posix} was used (@pxref{Options}).@footnote{And -thus was born the Campain for Rational Range Interpretation (or RRI). A number -of GNU tools, such as @command{grep} and @command{sed}, have either -implemented this change, or will soon. Thanks to Karl Berry for coining the phrase -``Rational Range Interpretation.''} +thus was born the Campaign for Rational Range Interpretation (or +RRI). A number of GNU tools have either implemented this change, +or will soon. Thanks to Karl Berry for coining the phrase ``Rational +Range Interpretation.''} Fortunately, shortly before the final release of @command{gawk} 4.0, the maintainer learned that the 2008 standard had changed the @@ -33525,7 +33529,7 @@ and By using this lovely technical term, the standard gives license to implementors to implement ranges in whatever way they choose. The @command{gawk} maintainer chose to apply the pre-POSIX meaning in all -cases: the default regexp matching; with @option{--traditional}, and with +cases: the default regexp matching; with @option{--traditional} and with @option{--posix}; in all cases, @command{gawk} remains POSIX compliant. @node Contributors @@ -34166,7 +34170,7 @@ please send in a bug report (@pxref{Bugs}). Of course, once you've built @command{gawk}, it is likely that you will wish to install it. To do so, you need to run the command @samp{make -check}, as a user with the appropriate permissions. How to do this +install}, as a user with the appropriate permissions. How to do this varies by system, but on many systems you can use the @command{sudo} command to do so. The command then becomes @samp{sudo make install}. It is likely that you will be asked for your password, and you will have @@ -34492,11 +34496,10 @@ multibyte functionality is not available. @c STARTOFRANGE pcgawon @cindex PC operating systems, @command{gawk} on -With the exception of the Cygwin environment, -the @samp{|&} operator and TCP/IP networking -(@pxref{TCP/IP Networking}) -are not supported for MS-DOS or MS-Windows. EMX (OS/2 only) does support -at least the @samp{|&} operator. +Under MS-DOS and MS-Windows, the Cygwin and MinGW environments support +both the @samp{|&} operator and TCP/IP networking +(@pxref{TCP/IP Networking}). +EMX (OS/2 only) supports at least the @samp{|&} operator. @cindex search paths @cindex search paths, for source files @@ -34626,7 +34629,7 @@ moved into the @code{BEGIN} rule. @command{gawk} can be built and used ``out of the box'' under MS-Windows if you are using the @uref{http://www.cygwin.com, Cygwin environment}. -This environment provides an excellent simulation of Unix, using the +This environment provides an excellent simulation of GNU/Linux, using the GNU tools, such as Bash, the GNU Compiler Collection (GCC), GNU Make, and other GNU programs. Compilation and installation for Cygwin is the same as for a Unix system: @@ -34642,13 +34645,6 @@ When compared to GNU/Linux on the same system, the @samp{configure} step on Cygwin takes considerably longer. However, it does finish, and then the @samp{make} proceeds as usual. -@quotation NOTE -The @samp{|&} operator and TCP/IP networking -(@pxref{TCP/IP Networking}) -are fully supported in the Cygwin environment. This is not true -for any other environment on MS-Windows. -@end quotation - @node MSYS @appendixsubsubsec Using @command{gawk} In The MSYS Environment @@ -34827,7 +34823,7 @@ add the @command{gawk} and @command{awk} to the system wide @samp{DCLTABLES}. The DCL syntax is documented in the @file{gawk.hlp} file. -Optionally, @file{gawk.hlp} entry can be loaded into a VMS help library: +Optionally, the @file{gawk.hlp} entry can be loaded into a VMS help library: @example $ @kbd{LIBRARY/HELP sys$help:helplib [.vms]gawk.hlp} @@ -35171,7 +35167,7 @@ from GCC (the GNU Compiler Collection) works quite nicely. for a list of extensions in this @command{awk} that are not in POSIX @command{awk}. @cindex Brennan, Michael -@cindex @command{mawk} program +@cindex @command{mawk} utility @cindex source code, @command{mawk} @item @command{mawk} Michael Brennan wrote an independent implementation of @command{awk}, |