diff options
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | doc/ChangeLog | 4 | ||||
-rw-r--r-- | doc/gawk.info | 1156 | ||||
-rw-r--r-- | doc/gawk.texi | 182 | ||||
-rw-r--r-- | doc/gawktexi.in | 182 | ||||
-rw-r--r-- | xalloc.h | 24 |
6 files changed, 844 insertions, 711 deletions
@@ -1,3 +1,10 @@ +2014-04-24 Arnold D. Robbins <arnold@skeeve.com> + + Update xalloc.h for pending merge with dfa. + + * xalloc.h (xstrdup): Implement this. + (x2nrealloc): Incorporate changed logic from GNULIB. + 2014-04-20 Andrew J. Schorr <aschorr@telemetry-investments.com> * io.c (struct inet_socket_info): Define new structure diff --git a/doc/ChangeLog b/doc/ChangeLog index 305062c9..15937359 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,7 @@ +2014-04-24 Arnold D. Robbins <arnold@skeeve.com> + + * gawktexi.in: Start on revisions. + 2014-04-17 Arnold D. Robbins <arnold@skeeve.com> * gawk.1: Remove the bit about single character programs overflowing diff --git a/doc/gawk.info b/doc/gawk.info index aad73f7a..87c79add 100644 --- a/doc/gawk.info +++ b/doc/gawk.info @@ -127,7 +127,7 @@ texts being (a) (see below), and with the Back-Cover Texts being (b) * One-shot:: Running a short throwaway `awk' program. * Read Terminal:: Using no input files (input from - terminal instead). + the keyboard instead). * Long:: Putting permanent `awk' programs in files. * Executable Scripts:: Making self-contained `awk' @@ -791,6 +791,10 @@ and other `awk' implementations. * Perform simple network communications + * Profile and debug `awk' programs. + + * Extend the language with functions written in C or C++. + This Info file teaches you about the `awk' language and how you can use it effectively. You should already be familiar with basic system commands, such as `cat' and `ls',(2) as well as basic shell facilities, @@ -799,13 +803,12 @@ such as input/output (I/O) redirection and pipes. Implementations of the `awk' language are available for many different computing environments. This Info file, while describing the `awk' language in general, also describes the particular implementation -of `awk' called `gawk' (which stands for "GNU awk"). `gawk' runs on a -broad range of Unix systems, ranging from Intel(R)-architecture -PC-based computers up through large-scale systems, such as Crays. -`gawk' has also been ported to Mac OS X, Microsoft Windows (all -versions) and OS/2 PCs, and VMS. (Some other, obsolete systems to -which `gawk' was once ported are no longer supported and the code for -those systems has been removed.) +of `awk' called `gawk' (which stands for "GNU `awk'"). `gawk' runs on +a broad range of Unix systems, ranging from Intel(R)-architecture +PC-based computers up through large-scale systems. `gawk' has also +been ported to Mac OS X, Microsoft Windows (all versions), and OpenVMS. +(Some other, obsolete systems to which `gawk' was once ported are no +longer supported and the code for those systems has been removed.) * Menu: @@ -822,7 +825,7 @@ those systems has been removed.) ---------- Footnotes ---------- - (1) The 2008 POSIX standard is online at + (1) The 2008 POSIX standard is accessable online at `http://www.opengroup.org/onlinepubs/9699919799/'. (2) These commands are available on POSIX-compliant systems, as well @@ -892,20 +895,21 @@ The `awk' language has evolved over the years. Full details are provided in *note Language History::. The language described in this Info file is often referred to as "new `awk'" (`nawk'). - Because of this, there are systems with multiple versions of `awk'. -Some systems have an `awk' utility that implements the original version -of the `awk' language and a `nawk' utility for the new version. Others -have an `oawk' version for the "old `awk'" language and plain `awk' for -the new one. Still others only have one version, which is usually the -new one.(1) - - All in all, this makes it difficult for you to know which version of -`awk' you should run when writing your programs. The best advice we -can give here is to check your local documentation. Look for `awk', -`oawk', and `nawk', as well as for `gawk'. It is likely that you -already have some version of new `awk' on your system, which is what -you should use when running your programs. (Of course, if you're -reading this Info file, chances are good that you have `gawk'!) + For some time after new `awk' was introduced, there were systems +with multiple versions of `awk'. Some systems had an `awk' utility +that implemented the original version of the `awk' language and a +`nawk' utility for the new version. Others had an `oawk' version for +the "old `awk'" language and plain `awk' for the new one. Still others +only had one version, which is usually the new one. + + Today, only Solaris systems still use an old `awk' for the default +`awk' utility. (A more modern `awk' lives in `/usr/xpg6/bin' on these +systems.) All other modern systems use some version of new `awk'.(1) + + It is likely that you already have some version of new `awk' on your +system, which is what you should use when running your programs. (Of +course, if you're reading this Info file, chances are good that you +have `gawk'!) Throughout this Info file, whenever we refer to a language feature that should be available in any complete implementation of POSIX `awk', @@ -914,7 +918,7 @@ specific to the GNU implementation, we use the term `gawk'. ---------- Footnotes ---------- - (1) Often, these systems use `gawk' for their `awk' implementation! + (1) Many of these systems use `gawk' for their `awk' implementation! File: gawk.info, Node: This Manual, Next: Conventions, Prev: Names, Up: Preface @@ -1168,11 +1172,10 @@ significant note for this edition was *note Debugger::. the major new additions are *note Arbitrary Precision Arithmetic::, and *note Dynamic Extensions::. - `GAWK: Effective AWK Programming' will undoubtedly continue to -evolve. An electronic version comes with the `gawk' distribution from -the FSF. If you find an error in this Info file, please report it! -*Note Bugs::, for information on submitting problem reports -electronically. + This Info file will undoubtedly continue to evolve. An electronic +version comes with the `gawk' distribution from the FSF. If you find +an error in this Info file, please report it! *Note Bugs::, for +information on submitting problem reports electronically. ---------- Footnotes ---------- @@ -1199,14 +1202,17 @@ something more broad, I acquired the `awk.info' domain. contributed code: the archive did not grow and the domain went unused for several years. - Fortunately, late in 2008, a volunteer took on the task of setting up -an `awk'-related web site--`http://awk.info'--and did a very nice job. + Late in 2008, a volunteer took on the task of setting up an +`awk'-related web site--`http://awk.info'--and did a very nice job. If you have written an interesting `awk' program, or have written a `gawk' extension that you would like to share with the rest of the world, please see `http://awk.info/?contribute' for how to contribute it to the web site. + As of this writing, this website is in search of a maintainer; please +contact me if you are interested. + File: gawk.info, Node: Acknowledgments, Prev: How To Contribute, Up: Preface @@ -1297,7 +1303,7 @@ to take advantage of those opportunities. Arnold Robbins Nof Ayalon ISRAEL -May, 2013 +May, 2014 File: gawk.info, Node: Getting Started, Next: Invoking Gawk, Prev: Preface, Up: Top @@ -1375,7 +1381,7 @@ variations of each. * One-shot:: Running a short throwaway `awk' program. -* Read Terminal:: Using no input files (input from terminal +* Read Terminal:: Using no input files (input from the keyboard instead). * Long:: Putting permanent `awk' programs in files. @@ -1425,7 +1431,7 @@ following command line: awk 'PROGRAM' `awk' applies the PROGRAM to the "standard input", which usually means -whatever you type on the terminal. This continues until you indicate +whatever you type on the keyboard. This continues until you indicate end-of-file by typing `Ctrl-d'. (On other operating systems, the end-of-file character may be different. For example, on OS/2, it is `Ctrl-z'.) @@ -2381,7 +2387,7 @@ The following list describes options mandated by the POSIX standard: `--debug=[FILE]' Enable debugging of `awk' programs (*note Debugging::). By default, the debugger reads commands interactively from the - terminal. The optional FILE argument allows you to specify a file + keyboard. The optional FILE argument allows you to specify a file with a list of commands for the debugger to execute non-interactively. No space is allowed between the `-D' and FILE, if FILE is supplied. @@ -2586,7 +2592,7 @@ having to be included into each individual program. (As mentioned in *note Definition Syntax::, function names must be unique.) With standard `awk', library functions can still be used, even if -the program is entered at the terminal, by specifying `-f /dev/tty'. +the program is entered at the keyboard, by specifying `-f /dev/tty'. After typing your program, type `Ctrl-d' (the end-of-file character) to terminate it. (You may also use `-f -' to read program source from the standard input but then you will not be able to also use the standard @@ -5111,7 +5117,7 @@ File: gawk.info, Node: Getline, Next: Read Timeout, Prev: Multiple Line, Up: ================================= So far we have been getting our input data from `awk''s main input -stream--either the standard input (usually your terminal, sometimes the +stream--either the standard input (usually your keyboard, sometimes the output from another program) or from the files specified on the command line. The `awk' language has a special built-in command called `getline' that can be used to read input under your explicit control. @@ -5560,8 +5566,8 @@ File: gawk.info, Node: Read Timeout, Next: Command line directories, Prev: Ge 4.10 Reading Input With A Timeout ================================= -You may specify a timeout in milliseconds for reading input from a -terminal, pipe or two-way communication including, TCP/IP sockets. This +You may specify a timeout in milliseconds for reading input from the +keyboard, pipe or two-way communication including, TCP/IP sockets. This can be done on a per input, command or connection basis, by setting a special element in the `PROCINFO' array: @@ -5579,8 +5585,8 @@ from the server after a certain amount of time: else if (ERRNO != "") print ERRNO - Here is how to read interactively from the terminal(1) without -waiting for more than five seconds: + Here is how to read interactively from the user(1) without waiting +for more than five seconds: PROCINFO["/dev/stdin", "READ_TIMEOUT"] = 5000 while ((getline < "/dev/stdin") > 0) @@ -5591,7 +5597,7 @@ after waiting for the timeout period, return failure and set the `ERRNO' variable to an appropriate string value. A negative or zero value for the timeout is the same as specifying no timeout at all. - A timeout can also be set for reading from the terminal in the + A timeout can also be set for reading from the keyboard in the implicit loop that reads input records and matches them against patterns, like so: @@ -5644,7 +5650,7 @@ writing. ---------- Footnotes ---------- - (1) This assumes that standard input is the keyboard + (1) This assumes that standard input is the keyboard. File: gawk.info, Node: Command line directories, Prev: Read Timeout, Up: Reading Files @@ -21182,7 +21188,7 @@ need it. arbitrary precision arithmetic. The easiest way to find out is to look at the output of the following command: - $ ./gawk --version + $ gawk --version -| GNU Awk 4.1.1, API: 1.1 (GNU MPFR 3.1.0-p3, GNU MP 5.0.2) -| Copyright (C) 1989, 1991-2014 Free Software Foundation. ... @@ -26272,8 +26278,8 @@ Various `.c', `.y', and `.h' files PC Installation::, for details). `vms/*' - Files needed for building `gawk' under VMS (*note VMS - Installation::, for details). + Files needed for building `gawk' under Vax/VMS and OpenVMS (*note + VMS Installation::, for details). `test/*' A test suite for `gawk'. You can use `make check' from the @@ -26757,8 +26763,8 @@ translation of `"\r\n"', since it won't. Caveat Emptor! File: gawk.info, Node: VMS Installation, Prev: PC Installation, Up: Non-Unix Installation -B.3.2 How to Compile and Install `gawk' on VMS ----------------------------------------------- +B.3.2 How to Compile and Install `gawk' on Vax/VMS and OpenVMS +-------------------------------------------------------------- This node describes how to compile and install `gawk' under VMS. The older designation "VMS" is used throughout to refer to OpenVMS. @@ -31686,7 +31692,7 @@ Index * git, use of for gawk source code: Derived Files. (line 6) * GMP: Gawk and MPFR. (line 6) * GNITS mailing list: Acknowledgments. (line 52) -* GNU awk, See gawk: Preface. (line 49) +* GNU awk, See gawk: Preface. (line 53) * GNU Free Documentation License: GNU Free Documentation License. (line 7) * GNU General Public License: Glossary. (line 306) @@ -32032,7 +32038,7 @@ Index * namespace issues <1>: Library Names. (line 6) * namespace issues: Arrays. (line 18) * namespace issues, functions: Definition Syntax. (line 20) -* nawk utility: Names. (line 17) +* nawk utility: Names. (line 10) * negative zero: Unexpected Results. (line 34) * NetBSD: Glossary. (line 616) * networks, programming: TCP/IP Networking. (line 6) @@ -32112,7 +32118,7 @@ Index * numeric, output format: OFMT. (line 6) * numeric, strings: Variable Typing. (line 6) * o debugger command (alias for option): Debugger Info. (line 57) -* oawk utility: Names. (line 17) +* oawk utility: Names. (line 10) * obsolete features: Obsolete. (line 6) * octal numbers: Nondecimal-numbers. (line 6) * octal values, enabling interpretation of: Options. (line 207) @@ -33103,529 +33109,529 @@ Index Tag Table: Node: Top1292 -Node: Foreword40821 -Node: Preface45166 -Ref: Preface-Footnote-148219 -Ref: Preface-Footnote-248315 -Node: History48547 -Node: Names50921 -Ref: Names-Footnote-152398 -Node: This Manual52470 -Ref: This Manual-Footnote-158244 -Node: Conventions58344 -Node: Manual History60500 -Ref: Manual History-Footnote-163948 -Ref: Manual History-Footnote-263989 -Node: How To Contribute64063 -Node: Acknowledgments65207 -Node: Getting Started69401 -Node: Running gawk71780 -Node: One-shot72966 -Node: Read Terminal74191 -Ref: Read Terminal-Footnote-175841 -Ref: Read Terminal-Footnote-276117 -Node: Long76288 -Node: Executable Scripts77664 -Ref: Executable Scripts-Footnote-179497 -Ref: Executable Scripts-Footnote-279599 -Node: Comments80146 -Node: Quoting82613 -Node: DOS Quoting87236 -Node: Sample Data Files87911 -Node: Very Simple90426 -Node: Two Rules95077 -Node: More Complex96975 -Ref: More Complex-Footnote-199905 -Node: Statements/Lines99990 -Ref: Statements/Lines-Footnote-1104453 -Node: Other Features104718 -Node: When105646 -Node: Invoking Gawk107793 -Node: Command Line109256 -Node: Options110039 -Ref: Options-Footnote-1125417 -Node: Other Arguments125442 -Node: Naming Standard Input128100 -Node: Environment Variables129194 -Node: AWKPATH Variable129752 -Ref: AWKPATH Variable-Footnote-1132533 -Ref: AWKPATH Variable-Footnote-2132578 -Node: AWKLIBPATH Variable132838 -Node: Other Environment Variables133556 -Node: Exit Status136519 -Node: Include Files137194 -Node: Loading Shared Libraries140763 -Node: Obsolete142127 -Node: Undocumented142824 -Node: Regexp143066 -Node: Regexp Usage144455 -Node: Escape Sequences146480 -Node: Regexp Operators152149 -Ref: Regexp Operators-Footnote-1159529 -Ref: Regexp Operators-Footnote-2159676 -Node: Bracket Expressions159774 -Ref: table-char-classes161664 -Node: GNU Regexp Operators164187 -Node: Case-sensitivity167910 -Ref: Case-sensitivity-Footnote-1170878 -Ref: Case-sensitivity-Footnote-2171113 -Node: Leftmost Longest171221 -Node: Computed Regexps172422 -Node: Reading Files175759 -Node: Records177761 -Ref: Records-Footnote-1187284 -Node: Fields187321 -Ref: Fields-Footnote-1190277 -Node: Nonconstant Fields190363 -Node: Changing Fields192569 -Node: Field Separators198528 -Node: Default Field Splitting201230 -Node: Regexp Field Splitting202347 -Node: Single Character Fields205689 -Node: Command Line Field Separator206748 -Node: Full Line Fields210090 -Ref: Full Line Fields-Footnote-1210598 -Node: Field Splitting Summary210644 -Ref: Field Splitting Summary-Footnote-1213743 -Node: Constant Size213844 -Node: Splitting By Content218451 -Ref: Splitting By Content-Footnote-1222200 -Node: Multiple Line222240 -Ref: Multiple Line-Footnote-1228087 -Node: Getline228266 -Node: Plain Getline230482 -Node: Getline/Variable232577 -Node: Getline/File233724 -Node: Getline/Variable/File235065 -Ref: Getline/Variable/File-Footnote-1236664 -Node: Getline/Pipe236751 -Node: Getline/Variable/Pipe239450 -Node: Getline/Coprocess240557 -Node: Getline/Variable/Coprocess241809 -Node: Getline Notes242546 -Node: Getline Summary245333 -Ref: table-getline-variants245741 -Node: Read Timeout246653 -Ref: Read Timeout-Footnote-1250394 -Node: Command line directories250451 -Node: Printing251081 -Node: Print252712 -Node: Print Examples254049 -Node: Output Separators256833 -Node: OFMT258849 -Node: Printf260207 -Node: Basic Printf261113 -Node: Control Letters262652 -Node: Format Modifiers266464 -Node: Printf Examples272473 -Node: Redirection275185 -Node: Special Files282159 -Node: Special FD282692 -Ref: Special FD-Footnote-1286317 -Node: Special Network286391 -Node: Special Caveats287241 -Node: Close Files And Pipes288037 -Ref: Close Files And Pipes-Footnote-1295020 -Ref: Close Files And Pipes-Footnote-2295168 -Node: Expressions295318 -Node: Values296450 -Node: Constants297126 -Node: Scalar Constants297806 -Ref: Scalar Constants-Footnote-1298665 -Node: Nondecimal-numbers298847 -Node: Regexp Constants301847 -Node: Using Constant Regexps302322 -Node: Variables305377 -Node: Using Variables306032 -Node: Assignment Options307756 -Node: Conversion309631 -Ref: table-locale-affects315131 -Ref: Conversion-Footnote-1315755 -Node: All Operators315864 -Node: Arithmetic Ops316494 -Node: Concatenation318999 -Ref: Concatenation-Footnote-1321787 -Node: Assignment Ops321907 -Ref: table-assign-ops326895 -Node: Increment Ops328226 -Node: Truth Values and Conditions331660 -Node: Truth Values332743 -Node: Typing and Comparison333792 -Node: Variable Typing334585 -Ref: Variable Typing-Footnote-1338482 -Node: Comparison Operators338604 -Ref: table-relational-ops339014 -Node: POSIX String Comparison342562 -Ref: POSIX String Comparison-Footnote-1343518 -Node: Boolean Ops343656 -Ref: Boolean Ops-Footnote-1347726 -Node: Conditional Exp347817 -Node: Function Calls349549 -Node: Precedence353143 -Node: Locales356812 -Node: Patterns and Actions357901 -Node: Pattern Overview358955 -Node: Regexp Patterns360624 -Node: Expression Patterns361167 -Node: Ranges364948 -Node: BEGIN/END368052 -Node: Using BEGIN/END368814 -Ref: Using BEGIN/END-Footnote-1371550 -Node: I/O And BEGIN/END371656 -Node: BEGINFILE/ENDFILE373938 -Node: Empty376852 -Node: Using Shell Variables377169 -Node: Action Overview379454 -Node: Statements381811 -Node: If Statement383665 -Node: While Statement385164 -Node: Do Statement387208 -Node: For Statement388364 -Node: Switch Statement391516 -Node: Break Statement393670 -Node: Continue Statement395660 -Node: Next Statement397453 -Node: Nextfile Statement399843 -Node: Exit Statement402498 -Node: Built-in Variables404914 -Node: User-modified406009 -Ref: User-modified-Footnote-1414367 -Node: Auto-set414429 -Ref: Auto-set-Footnote-1427886 -Ref: Auto-set-Footnote-2428091 -Node: ARGC and ARGV428147 -Node: Arrays432001 -Node: Array Basics433506 -Node: Array Intro434332 -Node: Reference to Elements438649 -Node: Assigning Elements440919 -Node: Array Example441410 -Node: Scanning an Array443142 -Node: Controlling Scanning445456 -Ref: Controlling Scanning-Footnote-1450543 -Node: Delete450859 -Ref: Delete-Footnote-1453624 -Node: Numeric Array Subscripts453681 -Node: Uninitialized Subscripts455864 -Node: Multidimensional457491 -Node: Multiscanning460584 -Node: Arrays of Arrays462173 -Node: Functions466813 -Node: Built-in467632 -Node: Calling Built-in468710 -Node: Numeric Functions470698 -Ref: Numeric Functions-Footnote-1474530 -Ref: Numeric Functions-Footnote-2474887 -Ref: Numeric Functions-Footnote-3474935 -Node: String Functions475204 -Ref: String Functions-Footnote-1498162 -Ref: String Functions-Footnote-2498291 -Ref: String Functions-Footnote-3498539 -Node: Gory Details498626 -Ref: table-sub-escapes500305 -Ref: table-sub-posix-92501659 -Ref: table-sub-proposed503010 -Ref: table-posix-sub504364 -Ref: table-gensub-escapes505909 -Ref: Gory Details-Footnote-1507085 -Ref: Gory Details-Footnote-2507136 -Node: I/O Functions507287 -Ref: I/O Functions-Footnote-1514277 -Node: Time Functions514424 -Ref: Time Functions-Footnote-1525407 -Ref: Time Functions-Footnote-2525475 -Ref: Time Functions-Footnote-3525633 -Ref: Time Functions-Footnote-4525744 -Ref: Time Functions-Footnote-5525856 -Ref: Time Functions-Footnote-6526083 -Node: Bitwise Functions526349 -Ref: table-bitwise-ops526911 -Ref: Bitwise Functions-Footnote-1531132 -Node: Type Functions531316 -Node: I18N Functions532467 -Node: User-defined534094 -Node: Definition Syntax534898 -Ref: Definition Syntax-Footnote-1539812 -Node: Function Example539881 -Ref: Function Example-Footnote-1542530 -Node: Function Caveats542552 -Node: Calling A Function543070 -Node: Variable Scope544025 -Node: Pass By Value/Reference546988 -Node: Return Statement550496 -Node: Dynamic Typing553477 -Node: Indirect Calls554408 -Node: Library Functions564095 -Ref: Library Functions-Footnote-1567608 -Ref: Library Functions-Footnote-2567751 -Node: Library Names567922 -Ref: Library Names-Footnote-1571395 -Ref: Library Names-Footnote-2571615 -Node: General Functions571701 -Node: Strtonum Function572729 -Node: Assert Function575659 -Node: Round Function578985 -Node: Cliff Random Function580526 -Node: Ordinal Functions581542 -Ref: Ordinal Functions-Footnote-1584619 -Ref: Ordinal Functions-Footnote-2584871 -Node: Join Function585082 -Ref: Join Function-Footnote-1586853 -Node: Getlocaltime Function587053 -Node: Readfile Function590794 -Node: Data File Management592633 -Node: Filetrans Function593265 -Node: Rewind Function597334 -Node: File Checking598721 -Node: Empty Files599815 -Node: Ignoring Assigns602045 -Node: Getopt Function603599 -Ref: Getopt Function-Footnote-1614902 -Node: Passwd Functions615105 -Ref: Passwd Functions-Footnote-1624083 -Node: Group Functions624171 -Node: Walking Arrays632255 -Node: Sample Programs634391 -Node: Running Examples635065 -Node: Clones635793 -Node: Cut Program637017 -Node: Egrep Program646868 -Ref: Egrep Program-Footnote-1654641 -Node: Id Program654751 -Node: Split Program658400 -Ref: Split Program-Footnote-1661919 -Node: Tee Program662047 -Node: Uniq Program664850 -Node: Wc Program672279 -Ref: Wc Program-Footnote-1676545 -Ref: Wc Program-Footnote-2676745 -Node: Miscellaneous Programs676837 -Node: Dupword Program678025 -Node: Alarm Program680056 -Node: Translate Program684863 -Ref: Translate Program-Footnote-1689250 -Ref: Translate Program-Footnote-2689498 -Node: Labels Program689632 -Ref: Labels Program-Footnote-1693003 -Node: Word Sorting693087 -Node: History Sorting696971 -Node: Extract Program698810 -Ref: Extract Program-Footnote-1706313 -Node: Simple Sed706441 -Node: Igawk Program709503 -Ref: Igawk Program-Footnote-1724660 -Ref: Igawk Program-Footnote-2724861 -Node: Anagram Program724999 -Node: Signature Program728067 -Node: Advanced Features729167 -Node: Nondecimal Data731053 -Node: Array Sorting732636 -Node: Controlling Array Traversal733333 -Node: Array Sorting Functions741617 -Ref: Array Sorting Functions-Footnote-1745486 -Node: Two-way I/O745680 -Ref: Two-way I/O-Footnote-1751112 -Node: TCP/IP Networking751194 -Node: Profiling754038 -Node: Internationalization761541 -Node: I18N and L10N762966 -Node: Explaining gettext763652 -Ref: Explaining gettext-Footnote-1768720 -Ref: Explaining gettext-Footnote-2768904 -Node: Programmer i18n769069 -Node: Translator i18n773271 -Node: String Extraction774065 -Ref: String Extraction-Footnote-1775026 -Node: Printf Ordering775112 -Ref: Printf Ordering-Footnote-1777894 -Node: I18N Portability777958 -Ref: I18N Portability-Footnote-1780407 -Node: I18N Example780470 -Ref: I18N Example-Footnote-1783108 -Node: Gawk I18N783180 -Node: Debugger783801 -Node: Debugging784772 -Node: Debugging Concepts785205 -Node: Debugging Terms787061 -Node: Awk Debugging789658 -Node: Sample Debugging Session790550 -Node: Debugger Invocation791070 -Node: Finding The Bug792403 -Node: List of Debugger Commands798890 -Node: Breakpoint Control800224 -Node: Debugger Execution Control803888 -Node: Viewing And Changing Data807248 -Node: Execution Stack810604 -Node: Debugger Info812071 -Node: Miscellaneous Debugger Commands816053 -Node: Readline Support821229 -Node: Limitations822060 -Node: Arbitrary Precision Arithmetic824312 -Ref: Arbitrary Precision Arithmetic-Footnote-1825961 -Node: General Arithmetic826109 -Node: Floating Point Issues827829 -Node: String Conversion Precision828710 -Ref: String Conversion Precision-Footnote-1830415 -Node: Unexpected Results830524 -Node: POSIX Floating Point Problems832677 -Ref: POSIX Floating Point Problems-Footnote-1836502 -Node: Integer Programming836540 -Node: Floating-point Programming838279 -Ref: Floating-point Programming-Footnote-1844610 -Ref: Floating-point Programming-Footnote-2844880 -Node: Floating-point Representation845144 -Node: Floating-point Context846309 -Ref: table-ieee-formats847148 -Node: Rounding Mode848532 -Ref: table-rounding-modes849011 -Ref: Rounding Mode-Footnote-1852026 -Node: Gawk and MPFR852205 -Node: Arbitrary Precision Floats853616 -Ref: Arbitrary Precision Floats-Footnote-1856059 -Node: Setting Precision856375 -Ref: table-predefined-precision-strings857061 -Node: Setting Rounding Mode859206 -Ref: table-gawk-rounding-modes859610 -Node: Floating-point Constants860797 -Node: Changing Precision862226 -Ref: Changing Precision-Footnote-1863623 -Node: Exact Arithmetic863797 -Node: Arbitrary Precision Integers866935 -Ref: Arbitrary Precision Integers-Footnote-1869950 -Node: Dynamic Extensions870097 -Node: Extension Intro871555 -Node: Plugin License872820 -Node: Extension Mechanism Outline873505 -Ref: load-extension873922 -Ref: load-new-function875400 -Ref: call-new-function876395 -Node: Extension API Description878410 -Node: Extension API Functions Introduction879697 -Node: General Data Types884624 -Ref: General Data Types-Footnote-1890319 -Node: Requesting Values890618 -Ref: table-value-types-returned891355 -Node: Memory Allocation Functions892309 -Ref: Memory Allocation Functions-Footnote-1895055 -Node: Constructor Functions895151 -Node: Registration Functions896909 -Node: Extension Functions897594 -Node: Exit Callback Functions899896 -Node: Extension Version String901145 -Node: Input Parsers901795 -Node: Output Wrappers911552 -Node: Two-way processors916062 -Node: Printing Messages918270 -Ref: Printing Messages-Footnote-1919347 -Node: Updating `ERRNO'919499 -Node: Accessing Parameters920238 -Node: Symbol Table Access921468 -Node: Symbol table by name921982 -Node: Symbol table by cookie923958 -Ref: Symbol table by cookie-Footnote-1928090 -Node: Cached values928153 -Ref: Cached values-Footnote-1931643 -Node: Array Manipulation931734 -Ref: Array Manipulation-Footnote-1932832 -Node: Array Data Types932871 -Ref: Array Data Types-Footnote-1935574 -Node: Array Functions935666 -Node: Flattening Arrays939502 -Node: Creating Arrays946354 -Node: Extension API Variables951079 -Node: Extension Versioning951715 -Node: Extension API Informational Variables953616 -Node: Extension API Boilerplate954702 -Node: Finding Extensions958506 -Node: Extension Example959066 -Node: Internal File Description959796 -Node: Internal File Ops963887 -Ref: Internal File Ops-Footnote-1975396 -Node: Using Internal File Ops975536 -Ref: Using Internal File Ops-Footnote-1977889 -Node: Extension Samples978155 -Node: Extension Sample File Functions979679 -Node: Extension Sample Fnmatch988164 -Node: Extension Sample Fork989933 -Node: Extension Sample Inplace991146 -Node: Extension Sample Ord992924 -Node: Extension Sample Readdir993760 -Node: Extension Sample Revout995292 -Node: Extension Sample Rev2way995885 -Node: Extension Sample Read write array996575 -Node: Extension Sample Readfile998458 -Node: Extension Sample API Tests999558 -Node: Extension Sample Time1000083 -Node: gawkextlib1001447 -Node: Language History1004228 -Node: V7/SVR3.11005821 -Node: SVR41008141 -Node: POSIX1009583 -Node: BTL1010969 -Node: POSIX/GNU1011703 -Node: Feature History1017302 -Node: Common Extensions1030278 -Node: Ranges and Locales1031590 -Ref: Ranges and Locales-Footnote-11036207 -Ref: Ranges and Locales-Footnote-21036234 -Ref: Ranges and Locales-Footnote-31036468 -Node: Contributors1036689 -Node: Installation1042070 -Node: Gawk Distribution1042964 -Node: Getting1043448 -Node: Extracting1044274 -Node: Distribution contents1045966 -Node: Unix Installation1051671 -Node: Quick Installation1052288 -Node: Additional Configuration Options1054734 -Node: Configuration Philosophy1056470 -Node: Non-Unix Installation1058824 -Node: PC Installation1059282 -Node: PC Binary Installation1060581 -Node: PC Compiling1062429 -Node: PC Testing1065373 -Node: PC Using1066549 -Node: Cygwin1070717 -Node: MSYS1071526 -Node: VMS Installation1072040 -Node: VMS Compilation1072804 -Ref: VMS Compilation-Footnote-11074056 -Node: VMS Dynamic Extensions1074114 -Node: VMS Installation Details1075487 -Node: VMS Running1077738 -Node: VMS GNV1080572 -Node: VMS Old Gawk1081295 -Node: Bugs1081765 -Node: Other Versions1085683 -Node: Notes1091767 -Node: Compatibility Mode1092567 -Node: Additions1093350 -Node: Accessing The Source1094277 -Node: Adding Code1095717 -Node: New Ports1101762 -Node: Derived Files1105897 -Ref: Derived Files-Footnote-11111218 -Ref: Derived Files-Footnote-21111252 -Ref: Derived Files-Footnote-31111852 -Node: Future Extensions1111950 -Node: Implementation Limitations1112533 -Node: Extension Design1113785 -Node: Old Extension Problems1114939 -Ref: Old Extension Problems-Footnote-11116447 -Node: Extension New Mechanism Goals1116504 -Ref: Extension New Mechanism Goals-Footnote-11119869 -Node: Extension Other Design Decisions1120055 -Node: Extension Future Growth1122161 -Node: Old Extension Mechanism1122997 -Node: Basic Concepts1124737 -Node: Basic High Level1125418 -Ref: figure-general-flow1125690 -Ref: figure-process-flow1126289 -Ref: Basic High Level-Footnote-11129518 -Node: Basic Data Typing1129703 -Node: Glossary1133058 -Node: Copying1158289 -Node: GNU Free Documentation License1195845 -Node: Index1220981 +Node: Foreword40825 +Node: Preface45170 +Ref: Preface-Footnote-148303 +Ref: Preface-Footnote-248410 +Node: History48642 +Node: Names51016 +Ref: Names-Footnote-152480 +Node: This Manual52553 +Ref: This Manual-Footnote-158327 +Node: Conventions58427 +Node: Manual History60583 +Ref: Manual History-Footnote-164013 +Ref: Manual History-Footnote-264054 +Node: How To Contribute64128 +Node: Acknowledgments65367 +Node: Getting Started69561 +Node: Running gawk71940 +Node: One-shot73130 +Node: Read Terminal74355 +Ref: Read Terminal-Footnote-176005 +Ref: Read Terminal-Footnote-276281 +Node: Long76452 +Node: Executable Scripts77828 +Ref: Executable Scripts-Footnote-179661 +Ref: Executable Scripts-Footnote-279763 +Node: Comments80310 +Node: Quoting82777 +Node: DOS Quoting87400 +Node: Sample Data Files88075 +Node: Very Simple90590 +Node: Two Rules95241 +Node: More Complex97139 +Ref: More Complex-Footnote-1100069 +Node: Statements/Lines100154 +Ref: Statements/Lines-Footnote-1104617 +Node: Other Features104882 +Node: When105810 +Node: Invoking Gawk107957 +Node: Command Line109420 +Node: Options110203 +Ref: Options-Footnote-1125581 +Node: Other Arguments125606 +Node: Naming Standard Input128264 +Node: Environment Variables129358 +Node: AWKPATH Variable129916 +Ref: AWKPATH Variable-Footnote-1132697 +Ref: AWKPATH Variable-Footnote-2132742 +Node: AWKLIBPATH Variable133002 +Node: Other Environment Variables133720 +Node: Exit Status136683 +Node: Include Files137358 +Node: Loading Shared Libraries140927 +Node: Obsolete142291 +Node: Undocumented142988 +Node: Regexp143230 +Node: Regexp Usage144619 +Node: Escape Sequences146644 +Node: Regexp Operators152313 +Ref: Regexp Operators-Footnote-1159693 +Ref: Regexp Operators-Footnote-2159840 +Node: Bracket Expressions159938 +Ref: table-char-classes161828 +Node: GNU Regexp Operators164351 +Node: Case-sensitivity168074 +Ref: Case-sensitivity-Footnote-1171042 +Ref: Case-sensitivity-Footnote-2171277 +Node: Leftmost Longest171385 +Node: Computed Regexps172586 +Node: Reading Files175923 +Node: Records177925 +Ref: Records-Footnote-1187448 +Node: Fields187485 +Ref: Fields-Footnote-1190441 +Node: Nonconstant Fields190527 +Node: Changing Fields192733 +Node: Field Separators198692 +Node: Default Field Splitting201394 +Node: Regexp Field Splitting202511 +Node: Single Character Fields205853 +Node: Command Line Field Separator206912 +Node: Full Line Fields210254 +Ref: Full Line Fields-Footnote-1210762 +Node: Field Splitting Summary210808 +Ref: Field Splitting Summary-Footnote-1213907 +Node: Constant Size214008 +Node: Splitting By Content218615 +Ref: Splitting By Content-Footnote-1222364 +Node: Multiple Line222404 +Ref: Multiple Line-Footnote-1228251 +Node: Getline228430 +Node: Plain Getline230646 +Node: Getline/Variable232741 +Node: Getline/File233888 +Node: Getline/Variable/File235229 +Ref: Getline/Variable/File-Footnote-1236828 +Node: Getline/Pipe236915 +Node: Getline/Variable/Pipe239614 +Node: Getline/Coprocess240721 +Node: Getline/Variable/Coprocess241973 +Node: Getline Notes242710 +Node: Getline Summary245497 +Ref: table-getline-variants245905 +Node: Read Timeout246817 +Ref: Read Timeout-Footnote-1250556 +Node: Command line directories250614 +Node: Printing251244 +Node: Print252875 +Node: Print Examples254212 +Node: Output Separators256996 +Node: OFMT259012 +Node: Printf260370 +Node: Basic Printf261276 +Node: Control Letters262815 +Node: Format Modifiers266627 +Node: Printf Examples272636 +Node: Redirection275348 +Node: Special Files282322 +Node: Special FD282855 +Ref: Special FD-Footnote-1286480 +Node: Special Network286554 +Node: Special Caveats287404 +Node: Close Files And Pipes288200 +Ref: Close Files And Pipes-Footnote-1295183 +Ref: Close Files And Pipes-Footnote-2295331 +Node: Expressions295481 +Node: Values296613 +Node: Constants297289 +Node: Scalar Constants297969 +Ref: Scalar Constants-Footnote-1298828 +Node: Nondecimal-numbers299010 +Node: Regexp Constants302010 +Node: Using Constant Regexps302485 +Node: Variables305540 +Node: Using Variables306195 +Node: Assignment Options307919 +Node: Conversion309794 +Ref: table-locale-affects315294 +Ref: Conversion-Footnote-1315918 +Node: All Operators316027 +Node: Arithmetic Ops316657 +Node: Concatenation319162 +Ref: Concatenation-Footnote-1321950 +Node: Assignment Ops322070 +Ref: table-assign-ops327058 +Node: Increment Ops328389 +Node: Truth Values and Conditions331823 +Node: Truth Values332906 +Node: Typing and Comparison333955 +Node: Variable Typing334748 +Ref: Variable Typing-Footnote-1338645 +Node: Comparison Operators338767 +Ref: table-relational-ops339177 +Node: POSIX String Comparison342725 +Ref: POSIX String Comparison-Footnote-1343681 +Node: Boolean Ops343819 +Ref: Boolean Ops-Footnote-1347889 +Node: Conditional Exp347980 +Node: Function Calls349712 +Node: Precedence353306 +Node: Locales356975 +Node: Patterns and Actions358064 +Node: Pattern Overview359118 +Node: Regexp Patterns360787 +Node: Expression Patterns361330 +Node: Ranges365111 +Node: BEGIN/END368215 +Node: Using BEGIN/END368977 +Ref: Using BEGIN/END-Footnote-1371713 +Node: I/O And BEGIN/END371819 +Node: BEGINFILE/ENDFILE374101 +Node: Empty377015 +Node: Using Shell Variables377332 +Node: Action Overview379617 +Node: Statements381974 +Node: If Statement383828 +Node: While Statement385327 +Node: Do Statement387371 +Node: For Statement388527 +Node: Switch Statement391679 +Node: Break Statement393833 +Node: Continue Statement395823 +Node: Next Statement397616 +Node: Nextfile Statement400006 +Node: Exit Statement402661 +Node: Built-in Variables405077 +Node: User-modified406172 +Ref: User-modified-Footnote-1414530 +Node: Auto-set414592 +Ref: Auto-set-Footnote-1428049 +Ref: Auto-set-Footnote-2428254 +Node: ARGC and ARGV428310 +Node: Arrays432164 +Node: Array Basics433669 +Node: Array Intro434495 +Node: Reference to Elements438812 +Node: Assigning Elements441082 +Node: Array Example441573 +Node: Scanning an Array443305 +Node: Controlling Scanning445619 +Ref: Controlling Scanning-Footnote-1450706 +Node: Delete451022 +Ref: Delete-Footnote-1453787 +Node: Numeric Array Subscripts453844 +Node: Uninitialized Subscripts456027 +Node: Multidimensional457654 +Node: Multiscanning460747 +Node: Arrays of Arrays462336 +Node: Functions466976 +Node: Built-in467795 +Node: Calling Built-in468873 +Node: Numeric Functions470861 +Ref: Numeric Functions-Footnote-1474693 +Ref: Numeric Functions-Footnote-2475050 +Ref: Numeric Functions-Footnote-3475098 +Node: String Functions475367 +Ref: String Functions-Footnote-1498325 +Ref: String Functions-Footnote-2498454 +Ref: String Functions-Footnote-3498702 +Node: Gory Details498789 +Ref: table-sub-escapes500468 +Ref: table-sub-posix-92501822 +Ref: table-sub-proposed503173 +Ref: table-posix-sub504527 +Ref: table-gensub-escapes506072 +Ref: Gory Details-Footnote-1507248 +Ref: Gory Details-Footnote-2507299 +Node: I/O Functions507450 +Ref: I/O Functions-Footnote-1514440 +Node: Time Functions514587 +Ref: Time Functions-Footnote-1525570 +Ref: Time Functions-Footnote-2525638 +Ref: Time Functions-Footnote-3525796 +Ref: Time Functions-Footnote-4525907 +Ref: Time Functions-Footnote-5526019 +Ref: Time Functions-Footnote-6526246 +Node: Bitwise Functions526512 +Ref: table-bitwise-ops527074 +Ref: Bitwise Functions-Footnote-1531295 +Node: Type Functions531479 +Node: I18N Functions532630 +Node: User-defined534257 +Node: Definition Syntax535061 +Ref: Definition Syntax-Footnote-1539975 +Node: Function Example540044 +Ref: Function Example-Footnote-1542693 +Node: Function Caveats542715 +Node: Calling A Function543233 +Node: Variable Scope544188 +Node: Pass By Value/Reference547151 +Node: Return Statement550659 +Node: Dynamic Typing553640 +Node: Indirect Calls554571 +Node: Library Functions564258 +Ref: Library Functions-Footnote-1567771 +Ref: Library Functions-Footnote-2567914 +Node: Library Names568085 +Ref: Library Names-Footnote-1571558 +Ref: Library Names-Footnote-2571778 +Node: General Functions571864 +Node: Strtonum Function572892 +Node: Assert Function575822 +Node: Round Function579148 +Node: Cliff Random Function580689 +Node: Ordinal Functions581705 +Ref: Ordinal Functions-Footnote-1584782 +Ref: Ordinal Functions-Footnote-2585034 +Node: Join Function585245 +Ref: Join Function-Footnote-1587016 +Node: Getlocaltime Function587216 +Node: Readfile Function590957 +Node: Data File Management592796 +Node: Filetrans Function593428 +Node: Rewind Function597497 +Node: File Checking598884 +Node: Empty Files599978 +Node: Ignoring Assigns602208 +Node: Getopt Function603762 +Ref: Getopt Function-Footnote-1615065 +Node: Passwd Functions615268 +Ref: Passwd Functions-Footnote-1624246 +Node: Group Functions624334 +Node: Walking Arrays632418 +Node: Sample Programs634554 +Node: Running Examples635228 +Node: Clones635956 +Node: Cut Program637180 +Node: Egrep Program647031 +Ref: Egrep Program-Footnote-1654804 +Node: Id Program654914 +Node: Split Program658563 +Ref: Split Program-Footnote-1662082 +Node: Tee Program662210 +Node: Uniq Program665013 +Node: Wc Program672442 +Ref: Wc Program-Footnote-1676708 +Ref: Wc Program-Footnote-2676908 +Node: Miscellaneous Programs677000 +Node: Dupword Program678188 +Node: Alarm Program680219 +Node: Translate Program685026 +Ref: Translate Program-Footnote-1689413 +Ref: Translate Program-Footnote-2689661 +Node: Labels Program689795 +Ref: Labels Program-Footnote-1693166 +Node: Word Sorting693250 +Node: History Sorting697134 +Node: Extract Program698973 +Ref: Extract Program-Footnote-1706476 +Node: Simple Sed706604 +Node: Igawk Program709666 +Ref: Igawk Program-Footnote-1724823 +Ref: Igawk Program-Footnote-2725024 +Node: Anagram Program725162 +Node: Signature Program728230 +Node: Advanced Features729330 +Node: Nondecimal Data731216 +Node: Array Sorting732799 +Node: Controlling Array Traversal733496 +Node: Array Sorting Functions741780 +Ref: Array Sorting Functions-Footnote-1745649 +Node: Two-way I/O745843 +Ref: Two-way I/O-Footnote-1751275 +Node: TCP/IP Networking751357 +Node: Profiling754201 +Node: Internationalization761704 +Node: I18N and L10N763129 +Node: Explaining gettext763815 +Ref: Explaining gettext-Footnote-1768883 +Ref: Explaining gettext-Footnote-2769067 +Node: Programmer i18n769232 +Node: Translator i18n773434 +Node: String Extraction774228 +Ref: String Extraction-Footnote-1775189 +Node: Printf Ordering775275 +Ref: Printf Ordering-Footnote-1778057 +Node: I18N Portability778121 +Ref: I18N Portability-Footnote-1780570 +Node: I18N Example780633 +Ref: I18N Example-Footnote-1783271 +Node: Gawk I18N783343 +Node: Debugger783964 +Node: Debugging784935 +Node: Debugging Concepts785368 +Node: Debugging Terms787224 +Node: Awk Debugging789821 +Node: Sample Debugging Session790713 +Node: Debugger Invocation791233 +Node: Finding The Bug792566 +Node: List of Debugger Commands799053 +Node: Breakpoint Control800387 +Node: Debugger Execution Control804051 +Node: Viewing And Changing Data807411 +Node: Execution Stack810767 +Node: Debugger Info812234 +Node: Miscellaneous Debugger Commands816216 +Node: Readline Support821392 +Node: Limitations822223 +Node: Arbitrary Precision Arithmetic824475 +Ref: Arbitrary Precision Arithmetic-Footnote-1826124 +Node: General Arithmetic826272 +Node: Floating Point Issues827992 +Node: String Conversion Precision828873 +Ref: String Conversion Precision-Footnote-1830578 +Node: Unexpected Results830687 +Node: POSIX Floating Point Problems832840 +Ref: POSIX Floating Point Problems-Footnote-1836665 +Node: Integer Programming836703 +Node: Floating-point Programming838442 +Ref: Floating-point Programming-Footnote-1844773 +Ref: Floating-point Programming-Footnote-2845043 +Node: Floating-point Representation845307 +Node: Floating-point Context846472 +Ref: table-ieee-formats847311 +Node: Rounding Mode848695 +Ref: table-rounding-modes849174 +Ref: Rounding Mode-Footnote-1852189 +Node: Gawk and MPFR852368 +Node: Arbitrary Precision Floats853777 +Ref: Arbitrary Precision Floats-Footnote-1856220 +Node: Setting Precision856536 +Ref: table-predefined-precision-strings857222 +Node: Setting Rounding Mode859367 +Ref: table-gawk-rounding-modes859771 +Node: Floating-point Constants860958 +Node: Changing Precision862387 +Ref: Changing Precision-Footnote-1863784 +Node: Exact Arithmetic863958 +Node: Arbitrary Precision Integers867096 +Ref: Arbitrary Precision Integers-Footnote-1870111 +Node: Dynamic Extensions870258 +Node: Extension Intro871716 +Node: Plugin License872981 +Node: Extension Mechanism Outline873666 +Ref: load-extension874083 +Ref: load-new-function875561 +Ref: call-new-function876556 +Node: Extension API Description878571 +Node: Extension API Functions Introduction879858 +Node: General Data Types884785 +Ref: General Data Types-Footnote-1890480 +Node: Requesting Values890779 +Ref: table-value-types-returned891516 +Node: Memory Allocation Functions892470 +Ref: Memory Allocation Functions-Footnote-1895216 +Node: Constructor Functions895312 +Node: Registration Functions897070 +Node: Extension Functions897755 +Node: Exit Callback Functions900057 +Node: Extension Version String901306 +Node: Input Parsers901956 +Node: Output Wrappers911713 +Node: Two-way processors916223 +Node: Printing Messages918431 +Ref: Printing Messages-Footnote-1919508 +Node: Updating `ERRNO'919660 +Node: Accessing Parameters920399 +Node: Symbol Table Access921629 +Node: Symbol table by name922143 +Node: Symbol table by cookie924119 +Ref: Symbol table by cookie-Footnote-1928251 +Node: Cached values928314 +Ref: Cached values-Footnote-1931804 +Node: Array Manipulation931895 +Ref: Array Manipulation-Footnote-1932993 +Node: Array Data Types933032 +Ref: Array Data Types-Footnote-1935735 +Node: Array Functions935827 +Node: Flattening Arrays939663 +Node: Creating Arrays946515 +Node: Extension API Variables951240 +Node: Extension Versioning951876 +Node: Extension API Informational Variables953777 +Node: Extension API Boilerplate954863 +Node: Finding Extensions958667 +Node: Extension Example959227 +Node: Internal File Description959957 +Node: Internal File Ops964048 +Ref: Internal File Ops-Footnote-1975557 +Node: Using Internal File Ops975697 +Ref: Using Internal File Ops-Footnote-1978050 +Node: Extension Samples978316 +Node: Extension Sample File Functions979840 +Node: Extension Sample Fnmatch988325 +Node: Extension Sample Fork990094 +Node: Extension Sample Inplace991307 +Node: Extension Sample Ord993085 +Node: Extension Sample Readdir993921 +Node: Extension Sample Revout995453 +Node: Extension Sample Rev2way996046 +Node: Extension Sample Read write array996736 +Node: Extension Sample Readfile998619 +Node: Extension Sample API Tests999719 +Node: Extension Sample Time1000244 +Node: gawkextlib1001608 +Node: Language History1004389 +Node: V7/SVR3.11005982 +Node: SVR41008302 +Node: POSIX1009744 +Node: BTL1011130 +Node: POSIX/GNU1011864 +Node: Feature History1017463 +Node: Common Extensions1030439 +Node: Ranges and Locales1031751 +Ref: Ranges and Locales-Footnote-11036368 +Ref: Ranges and Locales-Footnote-21036395 +Ref: Ranges and Locales-Footnote-31036629 +Node: Contributors1036850 +Node: Installation1042231 +Node: Gawk Distribution1043125 +Node: Getting1043609 +Node: Extracting1044435 +Node: Distribution contents1046127 +Node: Unix Installation1051848 +Node: Quick Installation1052465 +Node: Additional Configuration Options1054911 +Node: Configuration Philosophy1056647 +Node: Non-Unix Installation1059001 +Node: PC Installation1059459 +Node: PC Binary Installation1060758 +Node: PC Compiling1062606 +Node: PC Testing1065550 +Node: PC Using1066726 +Node: Cygwin1070894 +Node: MSYS1071703 +Node: VMS Installation1072217 +Node: VMS Compilation1073013 +Ref: VMS Compilation-Footnote-11074265 +Node: VMS Dynamic Extensions1074323 +Node: VMS Installation Details1075696 +Node: VMS Running1077947 +Node: VMS GNV1080781 +Node: VMS Old Gawk1081504 +Node: Bugs1081974 +Node: Other Versions1085892 +Node: Notes1091976 +Node: Compatibility Mode1092776 +Node: Additions1093559 +Node: Accessing The Source1094486 +Node: Adding Code1095926 +Node: New Ports1101971 +Node: Derived Files1106106 +Ref: Derived Files-Footnote-11111427 +Ref: Derived Files-Footnote-21111461 +Ref: Derived Files-Footnote-31112061 +Node: Future Extensions1112159 +Node: Implementation Limitations1112742 +Node: Extension Design1113994 +Node: Old Extension Problems1115148 +Ref: Old Extension Problems-Footnote-11116656 +Node: Extension New Mechanism Goals1116713 +Ref: Extension New Mechanism Goals-Footnote-11120078 +Node: Extension Other Design Decisions1120264 +Node: Extension Future Growth1122370 +Node: Old Extension Mechanism1123206 +Node: Basic Concepts1124946 +Node: Basic High Level1125627 +Ref: figure-general-flow1125899 +Ref: figure-process-flow1126498 +Ref: Basic High Level-Footnote-11129727 +Node: Basic Data Typing1129912 +Node: Glossary1133267 +Node: Copying1158498 +Node: GNU Free Documentation License1196054 +Node: Index1221190 End Tag Table diff --git a/doc/gawk.texi b/doc/gawk.texi index 539ea53d..3e864614 100644 --- a/doc/gawk.texi +++ b/doc/gawk.texi @@ -303,15 +303,15 @@ ISBN 1-882114-28-0 @* @page @w{ } @sp 9 -@center @i{To Miriam, for making me complete.} +@center @i{To my parents, for their love, and for the wonderful +example they set for me.} @sp 1 -@center @i{To Chana, for the joy you bring us.} +@center @i{To my wife Miriam, for making me complete. +Thank you for building your life together with me.} @sp 1 -@center @i{To Rivka, for the exponential increase.} +@center @i{To our children Chana, Rivka, Nachum and Malka, +for enrichening our lives in innumerable ways.} @sp 1 -@center @i{To Nachum, for the added dimension.} -@sp 1 -@center @i{To Malka, for the new beginning.} @w{ } @page @w{ } @@ -321,13 +321,12 @@ ISBN 1-882114-28-0 @* @docbook <dedication> -<simplelist> -<member>To Miriam, for making me complete.</member> -<member>To Chana, for the joy you bring us.</member> -<member>To Rivka, for the exponential increase.</member> -<member>To Nachum, for the added dimension.</member> -<member>To Malka, for the new beginning.</member> -</simplelist> +<para>To my parents, for their love, and for the wonderful +example they set for me.</para> +<para>To my wife Miriam, for making me complete. +Thank you for building your life together with me.</para> +<para>To our children Chana, Rivka, Nachum and Malka, +for enrichening our lives in innumerable ways.</para> </dedication> @end docbook @@ -420,7 +419,7 @@ particular records in a file and perform operations upon them. * One-shot:: Running a short throwaway @command{awk} program. * Read Terminal:: Using no input files (input from - terminal instead). + the keyboard instead). * Long:: Putting permanent @command{awk} programs in files. * Executable Scripts:: Making self-contained @command{awk} @@ -1119,7 +1118,7 @@ The GNU implementation of @command{awk} is called @command{gawk}; if you invoke it with the proper options or environment variables (@pxref{Options}), it is fully compatible with -the POSIX@footnote{The 2008 POSIX standard is online at +the POSIX@footnote{The 2008 POSIX standard is accessable online at @url{http://www.opengroup.org/onlinepubs/9699919799/}.} specification of the @command{awk} language and with the Unix version of @command{awk} maintained @@ -1171,6 +1170,12 @@ Sort data @item Perform simple network communications + +@item +Profile and debug @command{awk} programs. + +@item +Extend the language with functions written in C or C++. @end itemize This @value{DOCUMENT} teaches you about the @command{awk} language and @@ -1186,12 +1191,18 @@ Implementations of the @command{awk} language are available for many different computing environments. This @value{DOCUMENT}, while describing the @command{awk} language in general, also describes the particular implementation of @command{awk} called @command{gawk} (which stands for -``GNU awk''). @command{gawk} runs on a broad range of Unix systems, +``GNU @command{awk}''). @command{gawk} runs on a broad range of Unix systems, ranging from Intel@registeredsymbol{}-architecture PC-based computers -up through large-scale systems, -such as Crays. @command{gawk} has also been ported to Mac OS X, -Microsoft Windows (all versions) and OS/2 PCs, -and VMS. +up through large-scale systems. +@command{gawk} has also been ported to Mac OS X, +Microsoft Windows +@ifset FOR_PRINT +(all versions) and OS/2 PCs, +@end ifset +@ifclear FOR_PRINT +(all versions), +@end ifclear +and OpenVMS. (Some other, obsolete systems to which @command{gawk} was once ported are no longer supported and the code for those systems has been removed.) @@ -1312,26 +1323,26 @@ The language described in this @value{DOCUMENT} is often referred to as ``new @command{awk}'' (@command{nawk}). @cindex @command{awk}, versions of -Because of this, there are systems with multiple -versions of @command{awk}. -Some systems have an @command{awk} utility that implements the -original version of the @command{awk} language and a @command{nawk} utility -for the new version. -Others have an @command{oawk} version for the ``old @command{awk}'' -language and plain @command{awk} for the new one. Still others only -have one version, which is usually the new one.@footnote{Often, these systems -use @command{gawk} for their @command{awk} implementation!} - @cindex @command{nawk} utility @cindex @command{oawk} utility -All in all, this makes it difficult for you to know which version of -@command{awk} you should run when writing your programs. The best advice -we can give here is to check your local documentation. Look for @command{awk}, -@command{oawk}, and @command{nawk}, as well as for @command{gawk}. -It is likely that you already -have some version of new @command{awk} on your system, which is what -you should use when running your programs. (Of course, if you're reading -this @value{DOCUMENT}, chances are good that you have @command{gawk}!) +For some time after new @command{awk} was introduced, there were +systems with multiple versions of @command{awk}. Some systems had +an @command{awk} utility that implemented the original version of the +@command{awk} language and a @command{nawk} utility for the new version. +Others had an @command{oawk} version for the ``old @command{awk}'' +language and plain @command{awk} for the new one. Still others only +had one version, which is usually the new one. + +Today, only Solaris systems still use an old @command{awk} for the +default @command{awk} utility. (A more modern @command{awk} lives in +@file{/usr/xpg6/bin} on these systems.) All other modern systems use +some version of new @command{awk}.@footnote{Many of these systems use +@command{gawk} for their @command{awk} implementation!} + +It is likely that you already have some version of new @command{awk} on +your system, which is what you should use when running your programs. +(Of course, if you're reading this @value{DOCUMENT}, chances are good +that you have @command{gawk}!) Throughout this @value{DOCUMENT}, whenever we refer to a language feature that should be available in any complete implementation of POSIX @command{awk}, @@ -1493,6 +1504,32 @@ non-POSIX systems. It also describes how to report bugs in @command{gawk} and where to get other freely available @command{awk} implementations. +@ifset FOR_PRINT +To save space, we have omitted some of the appendices from this +printed edition. You may find them online, as follows: + +@uref{http://www.gnu.org/software/gawk/manual/html_node/Notes.html} +describes how to disable @command{gawk}'s extensions, as +well as how to contribute new code to @command{gawk}, +and some possible future directions for @command{gawk} development. + +@uref{http://www.gnu.org/software/gawk/manual/html_node/Basic-Concepts.html} +provides some very cursory background material for those who +are completely unfamiliar with computer programming. + +@uref{http://www.gnu.org/software/gawk/manual/html_node/Glossary.html, +The Glossary} +defines most, if not all, the significant terms used +throughout the book. If you find terms that you aren't familiar with, +try looking them up here. + +@uref{http://www.gnu.org/software/gawk/manual/html_node/Copying.html} and +@uref{http://www.gnu.org/software/gawk/manual/html_node/GNU-Free-Documentation-License.html} +present the licenses that cover the @command{gawk} source code +and this @value{DOCUMENT}, respectively. +@end ifset + +@ifclear FOR_PRINT @ref{Notes}, describes how to disable @command{gawk}'s extensions, as well as how to contribute new code to @command{gawk}, @@ -1510,6 +1547,7 @@ try looking them up here. @ref{GNU Free Documentation License}, present the licenses that cover the @command{gawk} source code and this @value{DOCUMENT}, respectively. +@end ifclear @node Conventions @unnumberedsec Typographical Conventions @@ -1585,9 +1623,8 @@ the picture of a flashlight in the margin, as shown here. @end ifnottex They also appear in the index under the heading ``dark corner.'' -As noted by the opening quote, though, any -coverage of dark corners -is, by definition, incomplete. +As noted by the opening quote, though, any coverage of dark corners is, +by definition, incomplete. Extensions to the standard @command{awk} language that are supported by more than one @command{awk} implementation are marked @@ -1727,6 +1764,11 @@ the FSF published several preliminary versions (numbered 0.@var{x}). In 1996, Edition 1.0 was released with @command{gawk} 3.0.0. The FSF published the first two editions under the title @cite{The GNU Awk User's Guide}. +@ifset FOR_PRINT +SSC published two editions of the @value{DOCUMENT} under the +title @cite{Effective awk Programming}, and in O'Reilly published +the edition in 2001. +@end ifset This edition maintains the basic structure of the previous editions. For Edition 4.0, the content has been thoroughly reviewed @@ -1738,13 +1780,12 @@ For edition @value{EDITION}, the content has been reorganized into parts, and the major new additions are @ref{Arbitrary Precision Arithmetic}, and @ref{Dynamic Extensions}. -@cite{@value{TITLE}} will undoubtedly continue to evolve. -An electronic version -comes with the @command{gawk} distribution from the FSF. -If you find an error in this @value{DOCUMENT}, please report it! -@xref{Bugs}, for information on submitting -problem reports electronically. +This @value{DOCUMENT} will undoubtedly continue to evolve. An electronic +version comes with the @command{gawk} distribution from the FSF. If you +find an error in this @value{DOCUMENT}, please report it! @xref{Bugs}, +for information on submitting problem reports electronically. +@ifclear FOR_PRINT @node How To Contribute @unnumberedsec How to Contribute @@ -1761,7 +1802,7 @@ However, I found that I could not dedicate enough time to managing contributed code: the archive did not grow and the domain went unused for several years. -Fortunately, late in 2008, a volunteer took on the task of setting up +Late in 2008, a volunteer took on the task of setting up an @command{awk}-related web site---@uref{http://awk.info}---and did a very nice job. @@ -1770,11 +1811,15 @@ a @command{gawk} extension that you would like to share with the rest of the world, please see @uref{http://awk.info/?contribute} for how to contribute it to the web site. +As of this writing, this website is in search of a maintainer; please +contact me if you are interested. + @ignore Other links: http://www.reddit.com/r/linux/comments/dtect/composing_music_in_awk/ @end ignore +@end ifclear @node Acknowledgments @unnumberedsec Acknowledgments @@ -1936,7 +1981,7 @@ take advantage of those opportunities. Arnold Robbins @* Nof Ayalon @* ISRAEL @* -May, 2013 +May, 2014 @iftex @part Part I:@* The @command{awk} Language @@ -1944,11 +1989,11 @@ May, 2013 @ignore @ifdocbook -@part Part I:@* The @command{awk} Language - -Part I describes the @command{awk} language and @command{gawk} program in detail. -It starts with the basics, and continues through all of the features of @command{awk} -and @command{gawk}. It contains the following chapters: +Part I describes the @command{awk} language and @command{gawk} program +in detail. It starts with the basics, and continues through all of +the features of @command{awk}. Included also are many, but not all, +of the features of @command{gawk}. This part contains the +following chapters: @itemize @bullet @item @@ -2071,7 +2116,7 @@ variations of each. @menu * One-shot:: Running a short throwaway @command{awk} program. -* Read Terminal:: Using no input files (input from terminal +* Read Terminal:: Using no input files (input from the keyboard instead). * Long:: Putting permanent @command{awk} programs in files. @@ -2135,10 +2180,15 @@ awk '@var{program}' @noindent @command{awk} applies the @var{program} to the @dfn{standard input}, -which usually means whatever you type on the terminal. This continues +which usually means whatever you type on the keyboard. This continues until you indicate end-of-file by typing @kbd{Ctrl-d}. +@ifset FOR_PRINT +(On other operating systems, the end-of-file character may be different.) +@end ifset +@ifclear FOR_PRINT (On other operating systems, the end-of-file character may be different. For example, on OS/2, it is @kbd{Ctrl-z}.) +@end ifclear @cindex files, input, See input files @cindex input files, running @command{awk} without @@ -3444,7 +3494,7 @@ names like @code{i}, @code{j}, etc.) @cindex @command{awk} debugging, enabling Enable debugging of @command{awk} programs (@pxref{Debugging}). -By default, the debugger reads commands interactively from the terminal. +By default, the debugger reads commands interactively from the keyboard. The optional @var{file} argument allows you to specify a file with a list of commands for the debugger to execute non-interactively. No space is allowed between the @option{-D} and @var{file}, if @@ -3751,7 +3801,7 @@ of having to be included into each individual program. function names must be unique.) With standard @command{awk}, library functions can still be used, even -if the program is entered at the terminal, +if the program is entered at the keyboard, by specifying @samp{-f /dev/tty}. After typing your program, type @kbd{Ctrl-d} (the end-of-file character) to terminate it. (You may also use @samp{-f -} to read program source from the standard @@ -7455,7 +7505,7 @@ then @command{gawk} sets @code{RT} to the null string. @c STARTOFRANGE inex @cindex input, explicit So far we have been getting our input data from @command{awk}'s main -input stream---either the standard input (usually your terminal, sometimes +input stream---either the standard input (usually your keyboard, sometimes the output from another program) or from the files specified on the command line. The @command{awk} language has a special built-in command called @code{getline} that @@ -8017,7 +8067,7 @@ Note: for each variant, @command{gawk} sets the @code{RT} built-in variable. @section Reading Input With A Timeout @cindex timeout, reading input -You may specify a timeout in milliseconds for reading input from a terminal, +You may specify a timeout in milliseconds for reading input from the keyboard, pipe or two-way communication including, TCP/IP sockets. This can be done on a per input, command or connection basis, by setting a special element in the @code{PROCINFO} array: @@ -8040,8 +8090,8 @@ else if (ERRNO != "") print ERRNO @end example -Here is how to read interactively from the terminal@footnote{This assumes -that standard input is the keyboard} without waiting +Here is how to read interactively from the user@footnote{This assumes +that standard input is the keyboard.} without waiting for more than five seconds: @example @@ -8056,7 +8106,7 @@ and set the @code{ERRNO} variable to an appropriate string value. A negative or zero value for the timeout is the same as specifying no timeout at all. -A timeout can also be set for reading from the terminal in the implicit +A timeout can also be set for reading from the keyboard in the implicit loop that reads input records and matches them against patterns, like so: @@ -29259,7 +29309,7 @@ The easiest way to find out is to look at the output of the following command: @example -$ @kbd{./gawk --version} +$ @kbd{gawk --version} @print{} GNU Awk 4.1.1, API: 1.1 (GNU MPFR 3.1.0-p3, GNU MP 5.0.2) @print{} Copyright (C) 1989, 1991-2014 Free Software Foundation. @dots{} @@ -35548,7 +35598,7 @@ Files needed for building @command{gawk} under MS-Windows and OS/2 (@pxref{PC Installation}, for details). @item vms/* -Files needed for building @command{gawk} under VMS +Files needed for building @command{gawk} under Vax/VMS and OpenVMS (@pxref{VMS Installation}, for details). @item test/* @@ -36130,7 +36180,7 @@ been ported to MS-Windows that expect @command{gawk} to do automatic translation of @code{"\r\n"}, since it won't. Caveat Emptor! @node VMS Installation -@appendixsubsec How to Compile and Install @command{gawk} on VMS +@appendixsubsec How to Compile and Install @command{gawk} on Vax/VMS and OpenVMS @c based on material from Pat Rankin <rankin@eql.caltech.edu> @c now rankin@pactechdata.com diff --git a/doc/gawktexi.in b/doc/gawktexi.in index 791f787f..6d4eab55 100644 --- a/doc/gawktexi.in +++ b/doc/gawktexi.in @@ -298,15 +298,15 @@ ISBN 1-882114-28-0 @* @page @w{ } @sp 9 -@center @i{To Miriam, for making me complete.} +@center @i{To my parents, for their love, and for the wonderful +example they set for me.} @sp 1 -@center @i{To Chana, for the joy you bring us.} +@center @i{To my wife Miriam, for making me complete. +Thank you for building your life together with me.} @sp 1 -@center @i{To Rivka, for the exponential increase.} +@center @i{To our children Chana, Rivka, Nachum and Malka, +for enrichening our lives in innumerable ways.} @sp 1 -@center @i{To Nachum, for the added dimension.} -@sp 1 -@center @i{To Malka, for the new beginning.} @w{ } @page @w{ } @@ -316,13 +316,12 @@ ISBN 1-882114-28-0 @* @docbook <dedication> -<simplelist> -<member>To Miriam, for making me complete.</member> -<member>To Chana, for the joy you bring us.</member> -<member>To Rivka, for the exponential increase.</member> -<member>To Nachum, for the added dimension.</member> -<member>To Malka, for the new beginning.</member> -</simplelist> +<para>To my parents, for their love, and for the wonderful +example they set for me.</para> +<para>To my wife Miriam, for making me complete. +Thank you for building your life together with me.</para> +<para>To our children Chana, Rivka, Nachum and Malka, +for enrichening our lives in innumerable ways.</para> </dedication> @end docbook @@ -415,7 +414,7 @@ particular records in a file and perform operations upon them. * One-shot:: Running a short throwaway @command{awk} program. * Read Terminal:: Using no input files (input from - terminal instead). + the keyboard instead). * Long:: Putting permanent @command{awk} programs in files. * Executable Scripts:: Making self-contained @command{awk} @@ -1114,7 +1113,7 @@ The GNU implementation of @command{awk} is called @command{gawk}; if you invoke it with the proper options or environment variables (@pxref{Options}), it is fully compatible with -the POSIX@footnote{The 2008 POSIX standard is online at +the POSIX@footnote{The 2008 POSIX standard is accessable online at @url{http://www.opengroup.org/onlinepubs/9699919799/}.} specification of the @command{awk} language and with the Unix version of @command{awk} maintained @@ -1166,6 +1165,12 @@ Sort data @item Perform simple network communications + +@item +Profile and debug @command{awk} programs. + +@item +Extend the language with functions written in C or C++. @end itemize This @value{DOCUMENT} teaches you about the @command{awk} language and @@ -1181,12 +1186,18 @@ Implementations of the @command{awk} language are available for many different computing environments. This @value{DOCUMENT}, while describing the @command{awk} language in general, also describes the particular implementation of @command{awk} called @command{gawk} (which stands for -``GNU awk''). @command{gawk} runs on a broad range of Unix systems, +``GNU @command{awk}''). @command{gawk} runs on a broad range of Unix systems, ranging from Intel@registeredsymbol{}-architecture PC-based computers -up through large-scale systems, -such as Crays. @command{gawk} has also been ported to Mac OS X, -Microsoft Windows (all versions) and OS/2 PCs, -and VMS. +up through large-scale systems. +@command{gawk} has also been ported to Mac OS X, +Microsoft Windows +@ifset FOR_PRINT +(all versions) and OS/2 PCs, +@end ifset +@ifclear FOR_PRINT +(all versions), +@end ifclear +and OpenVMS. (Some other, obsolete systems to which @command{gawk} was once ported are no longer supported and the code for those systems has been removed.) @@ -1279,26 +1290,26 @@ The language described in this @value{DOCUMENT} is often referred to as ``new @command{awk}'' (@command{nawk}). @cindex @command{awk}, versions of -Because of this, there are systems with multiple -versions of @command{awk}. -Some systems have an @command{awk} utility that implements the -original version of the @command{awk} language and a @command{nawk} utility -for the new version. -Others have an @command{oawk} version for the ``old @command{awk}'' -language and plain @command{awk} for the new one. Still others only -have one version, which is usually the new one.@footnote{Often, these systems -use @command{gawk} for their @command{awk} implementation!} - @cindex @command{nawk} utility @cindex @command{oawk} utility -All in all, this makes it difficult for you to know which version of -@command{awk} you should run when writing your programs. The best advice -we can give here is to check your local documentation. Look for @command{awk}, -@command{oawk}, and @command{nawk}, as well as for @command{gawk}. -It is likely that you already -have some version of new @command{awk} on your system, which is what -you should use when running your programs. (Of course, if you're reading -this @value{DOCUMENT}, chances are good that you have @command{gawk}!) +For some time after new @command{awk} was introduced, there were +systems with multiple versions of @command{awk}. Some systems had +an @command{awk} utility that implemented the original version of the +@command{awk} language and a @command{nawk} utility for the new version. +Others had an @command{oawk} version for the ``old @command{awk}'' +language and plain @command{awk} for the new one. Still others only +had one version, which is usually the new one. + +Today, only Solaris systems still use an old @command{awk} for the +default @command{awk} utility. (A more modern @command{awk} lives in +@file{/usr/xpg6/bin} on these systems.) All other modern systems use +some version of new @command{awk}.@footnote{Many of these systems use +@command{gawk} for their @command{awk} implementation!} + +It is likely that you already have some version of new @command{awk} on +your system, which is what you should use when running your programs. +(Of course, if you're reading this @value{DOCUMENT}, chances are good +that you have @command{gawk}!) Throughout this @value{DOCUMENT}, whenever we refer to a language feature that should be available in any complete implementation of POSIX @command{awk}, @@ -1460,6 +1471,32 @@ non-POSIX systems. It also describes how to report bugs in @command{gawk} and where to get other freely available @command{awk} implementations. +@ifset FOR_PRINT +To save space, we have omitted some of the appendices from this +printed edition. You may find them online, as follows: + +@uref{http://www.gnu.org/software/gawk/manual/html_node/Notes.html} +describes how to disable @command{gawk}'s extensions, as +well as how to contribute new code to @command{gawk}, +and some possible future directions for @command{gawk} development. + +@uref{http://www.gnu.org/software/gawk/manual/html_node/Basic-Concepts.html} +provides some very cursory background material for those who +are completely unfamiliar with computer programming. + +@uref{http://www.gnu.org/software/gawk/manual/html_node/Glossary.html, +The Glossary} +defines most, if not all, the significant terms used +throughout the book. If you find terms that you aren't familiar with, +try looking them up here. + +@uref{http://www.gnu.org/software/gawk/manual/html_node/Copying.html} and +@uref{http://www.gnu.org/software/gawk/manual/html_node/GNU-Free-Documentation-License.html} +present the licenses that cover the @command{gawk} source code +and this @value{DOCUMENT}, respectively. +@end ifset + +@ifclear FOR_PRINT @ref{Notes}, describes how to disable @command{gawk}'s extensions, as well as how to contribute new code to @command{gawk}, @@ -1477,6 +1514,7 @@ try looking them up here. @ref{GNU Free Documentation License}, present the licenses that cover the @command{gawk} source code and this @value{DOCUMENT}, respectively. +@end ifclear @node Conventions @unnumberedsec Typographical Conventions @@ -1552,9 +1590,8 @@ the picture of a flashlight in the margin, as shown here. @end ifnottex They also appear in the index under the heading ``dark corner.'' -As noted by the opening quote, though, any -coverage of dark corners -is, by definition, incomplete. +As noted by the opening quote, though, any coverage of dark corners is, +by definition, incomplete. Extensions to the standard @command{awk} language that are supported by more than one @command{awk} implementation are marked @@ -1694,6 +1731,11 @@ the FSF published several preliminary versions (numbered 0.@var{x}). In 1996, Edition 1.0 was released with @command{gawk} 3.0.0. The FSF published the first two editions under the title @cite{The GNU Awk User's Guide}. +@ifset FOR_PRINT +SSC published two editions of the @value{DOCUMENT} under the +title @cite{Effective awk Programming}, and in O'Reilly published +the edition in 2001. +@end ifset This edition maintains the basic structure of the previous editions. For Edition 4.0, the content has been thoroughly reviewed @@ -1705,13 +1747,12 @@ For edition @value{EDITION}, the content has been reorganized into parts, and the major new additions are @ref{Arbitrary Precision Arithmetic}, and @ref{Dynamic Extensions}. -@cite{@value{TITLE}} will undoubtedly continue to evolve. -An electronic version -comes with the @command{gawk} distribution from the FSF. -If you find an error in this @value{DOCUMENT}, please report it! -@xref{Bugs}, for information on submitting -problem reports electronically. +This @value{DOCUMENT} will undoubtedly continue to evolve. An electronic +version comes with the @command{gawk} distribution from the FSF. If you +find an error in this @value{DOCUMENT}, please report it! @xref{Bugs}, +for information on submitting problem reports electronically. +@ifclear FOR_PRINT @node How To Contribute @unnumberedsec How to Contribute @@ -1728,7 +1769,7 @@ However, I found that I could not dedicate enough time to managing contributed code: the archive did not grow and the domain went unused for several years. -Fortunately, late in 2008, a volunteer took on the task of setting up +Late in 2008, a volunteer took on the task of setting up an @command{awk}-related web site---@uref{http://awk.info}---and did a very nice job. @@ -1737,11 +1778,15 @@ a @command{gawk} extension that you would like to share with the rest of the world, please see @uref{http://awk.info/?contribute} for how to contribute it to the web site. +As of this writing, this website is in search of a maintainer; please +contact me if you are interested. + @ignore Other links: http://www.reddit.com/r/linux/comments/dtect/composing_music_in_awk/ @end ignore +@end ifclear @node Acknowledgments @unnumberedsec Acknowledgments @@ -1903,7 +1948,7 @@ take advantage of those opportunities. Arnold Robbins @* Nof Ayalon @* ISRAEL @* -May, 2013 +May, 2014 @iftex @part Part I:@* The @command{awk} Language @@ -1911,11 +1956,11 @@ May, 2013 @ignore @ifdocbook -@part Part I:@* The @command{awk} Language - -Part I describes the @command{awk} language and @command{gawk} program in detail. -It starts with the basics, and continues through all of the features of @command{awk} -and @command{gawk}. It contains the following chapters: +Part I describes the @command{awk} language and @command{gawk} program +in detail. It starts with the basics, and continues through all of +the features of @command{awk}. Included also are many, but not all, +of the features of @command{gawk}. This part contains the +following chapters: @itemize @bullet @item @@ -2038,7 +2083,7 @@ variations of each. @menu * One-shot:: Running a short throwaway @command{awk} program. -* Read Terminal:: Using no input files (input from terminal +* Read Terminal:: Using no input files (input from the keyboard instead). * Long:: Putting permanent @command{awk} programs in files. @@ -2102,10 +2147,15 @@ awk '@var{program}' @noindent @command{awk} applies the @var{program} to the @dfn{standard input}, -which usually means whatever you type on the terminal. This continues +which usually means whatever you type on the keyboard. This continues until you indicate end-of-file by typing @kbd{Ctrl-d}. +@ifset FOR_PRINT +(On other operating systems, the end-of-file character may be different.) +@end ifset +@ifclear FOR_PRINT (On other operating systems, the end-of-file character may be different. For example, on OS/2, it is @kbd{Ctrl-z}.) +@end ifclear @cindex files, input, See input files @cindex input files, running @command{awk} without @@ -3372,7 +3422,7 @@ names like @code{i}, @code{j}, etc.) @cindex @command{awk} debugging, enabling Enable debugging of @command{awk} programs (@pxref{Debugging}). -By default, the debugger reads commands interactively from the terminal. +By default, the debugger reads commands interactively from the keyboard. The optional @var{file} argument allows you to specify a file with a list of commands for the debugger to execute non-interactively. No space is allowed between the @option{-D} and @var{file}, if @@ -3679,7 +3729,7 @@ of having to be included into each individual program. function names must be unique.) With standard @command{awk}, library functions can still be used, even -if the program is entered at the terminal, +if the program is entered at the keyboard, by specifying @samp{-f /dev/tty}. After typing your program, type @kbd{Ctrl-d} (the end-of-file character) to terminate it. (You may also use @samp{-f -} to read program source from the standard @@ -7073,7 +7123,7 @@ then @command{gawk} sets @code{RT} to the null string. @c STARTOFRANGE inex @cindex input, explicit So far we have been getting our input data from @command{awk}'s main -input stream---either the standard input (usually your terminal, sometimes +input stream---either the standard input (usually your keyboard, sometimes the output from another program) or from the files specified on the command line. The @command{awk} language has a special built-in command called @code{getline} that @@ -7635,7 +7685,7 @@ Note: for each variant, @command{gawk} sets the @code{RT} built-in variable. @section Reading Input With A Timeout @cindex timeout, reading input -You may specify a timeout in milliseconds for reading input from a terminal, +You may specify a timeout in milliseconds for reading input from the keyboard, pipe or two-way communication including, TCP/IP sockets. This can be done on a per input, command or connection basis, by setting a special element in the @code{PROCINFO} array: @@ -7658,8 +7708,8 @@ else if (ERRNO != "") print ERRNO @end example -Here is how to read interactively from the terminal@footnote{This assumes -that standard input is the keyboard} without waiting +Here is how to read interactively from the user@footnote{This assumes +that standard input is the keyboard.} without waiting for more than five seconds: @example @@ -7674,7 +7724,7 @@ and set the @code{ERRNO} variable to an appropriate string value. A negative or zero value for the timeout is the same as specifying no timeout at all. -A timeout can also be set for reading from the terminal in the implicit +A timeout can also be set for reading from the keyboard in the implicit loop that reads input records and matches them against patterns, like so: @@ -28400,7 +28450,7 @@ The easiest way to find out is to look at the output of the following command: @example -$ @kbd{./gawk --version} +$ @kbd{gawk --version} @print{} GNU Awk 4.1.1, API: 1.1 (GNU MPFR 3.1.0-p3, GNU MP 5.0.2) @print{} Copyright (C) 1989, 1991-2014 Free Software Foundation. @dots{} @@ -34689,7 +34739,7 @@ Files needed for building @command{gawk} under MS-Windows and OS/2 (@pxref{PC Installation}, for details). @item vms/* -Files needed for building @command{gawk} under VMS +Files needed for building @command{gawk} under Vax/VMS and OpenVMS (@pxref{VMS Installation}, for details). @item test/* @@ -35271,7 +35321,7 @@ been ported to MS-Windows that expect @command{gawk} to do automatic translation of @code{"\r\n"}, since it won't. Caveat Emptor! @node VMS Installation -@appendixsubsec How to Compile and Install @command{gawk} on VMS +@appendixsubsec How to Compile and Install @command{gawk} on Vax/VMS and OpenVMS @c based on material from Pat Rankin <rankin@eql.caltech.edu> @c now rankin@pactechdata.com @@ -136,6 +136,8 @@ xnmalloc (size_t n, size_t s) #ifdef GAWK #include <errno.h> +extern void r_fatal(const char *msg, ...) ATTRIBUTE_NORETURN ; + /* Allocate an array of N objects, each with S bytes of memory, dynamically, with error checking. S must be nonzero. Clear the contents afterwards. */ @@ -165,8 +167,6 @@ xrealloc(void *p, size_t size) void xalloc_die (void) { - extern void r_fatal(const char *msg, ...) ATTRIBUTE_NORETURN ; - r_fatal(_("xalloc: malloc failed: %s"), strerror(errno)); } @@ -179,6 +179,22 @@ xmemdup (void const *p, size_t s) { return memcpy (xmalloc (s), p, s); } + +/* xstrdup --- strdup and die if fails */ +char *xstrdup(const char *s) +{ + char *p; + int l; + + if (s == NULL) + r_fatal(_("xstrdup: null parameter")); + + l = strlen(s); + p = xmemdup(s, l + 1); + p[l] = '\0'; + + return p; +} #endif /* Change the size of an allocated block of memory P to an array of N @@ -260,7 +276,7 @@ x2nrealloc (void *p, size_t *pn, size_t s) requests, when the invoking code specifies an old size of zero. 64 bytes is the largest "small" request for the GNU C library malloc. */ - enum { DEFAULT_MXFAST = 64 }; + enum { DEFAULT_MXFAST = 64 * sizeof (size_t) / 4 }; n = DEFAULT_MXFAST / s; n += !n; @@ -274,7 +290,7 @@ x2nrealloc (void *p, size_t *pn, size_t s) worth the trouble. */ if ((size_t) -1 / 3 * 2 / s <= n) xalloc_die (); - n += (n + 1) / 2; + n += n / 2 + 1; } *pn = n; |