diff options
-rw-r--r-- | TODO | 4 | ||||
-rw-r--r-- | doc/gawk.info | 923 | ||||
-rw-r--r-- | doc/gawk.texi | 105 | ||||
-rw-r--r-- | extension/ChangeLog | 5 | ||||
-rw-r--r-- | extension/filefuncs.c | 17 |
5 files changed, 579 insertions, 475 deletions
@@ -3,6 +3,10 @@ Review all FIXME and TODO comments FIX regular field splitting to use FPAT algorithm. +Look at function order within files. + +?? Scope IDs for IPv6 addresses ?? + ------ Code Review: diff --git a/doc/gawk.info b/doc/gawk.info index 12377d99..2d657f95 100644 --- a/doc/gawk.info +++ b/doc/gawk.info @@ -567,7 +567,7 @@ Software Foundation. This book is the `gawk' reference manual, but at its core it is a book about AWK programming that will appeal to a wide audience. It is a definitive reference to the AWK language as defined by the 1987 Bell -Labs release and codified in the 1992 POSIX Utilities standard. +Laboratories release and codified in the 1992 POSIX Utilities standard. On the other hand, the novice AWK programmer can study a wealth of practical programs that emphasize the power of AWK's basic idioms: data @@ -19224,7 +19224,7 @@ A.2 Changes Between SVR3.1 and SVR4 The System V Release 4 (1989) version of Unix `awk' added these features (some of which originated in `gawk'): - * The `ENVIRON' variable (*note Built-in Variables::). + * The `ENVIRON' array (*note Built-in Variables::). * Multiple `-f' options on the command line (*note Options::). @@ -20644,9 +20644,9 @@ Unix `awk' since approximately 2003. `pawk' - Nelson H.F. Beebe at the University of Utah has modified the Bell - Labs `awk' to provide timing and profiling information. It is - different from `pgawk' (*note Profiling::), in that it uses + Nelson H.F. Beebe at the University of Utah has modified Brian + Kernighan's `awk' to provide timing and profiling information. It + is different from `pgawk' (*note Profiling::), in that it uses CPU-based profiling, not line-count profiling. You may find it at either `ftp://ftp.math.utah.edu/pub/pawk/pawk-20030606.tar.gz' or `http://www.math.utah.edu/pub/pawk/pawk-20030606.tar.gz'. @@ -20668,6 +20668,14 @@ The OpenSolaris POSIX `awk' from POSIX `awk'. More information is available on the project's home page (http://jawk.sourceforge.net). +Libmawk + This is an embeddable `awk' interpreter derived from `mawk'. For + more information see `http://repo.hu/projects/libmawk/'. + +QSE Awk + This is an embeddable `awk' interpreter. For more information see + `http://code.google.com/p/qse/' and `http://awk.info/?tools/qse'. + `QTawk' This is an independent implementation of `awk' distributed under the GPL. It has a large number of extensions over standard `awk' @@ -20675,13 +20683,12 @@ The OpenSolaris POSIX `awk' `http://www.quiktrim.org/QTawk.html' for more information, including the manual and a download link. -QSE Awk - This is an embeddable `awk' interpreter. For more information see - `http://code.google.com/p/qse/' and `http://awk.info/?tools/qse'. - -Libmawk - This is an embeddable `awk' interpreter derived from `mawk'. For - more information see `http://repo.hu/projects/libmawk/'. +`xgawk' + XML `gawk'. This is a fork of the `gawk' 3.1.6 source base to + support processing XML files. It has a number of interesting + extensions which should one day be integrated into the main `gawk' + code base. For more information, see the XMLgawk project web site + (http://xgawk.sourceforge.net). @@ -21181,7 +21188,7 @@ when writing extensions. The next minor node shows how they are used: given name already exists. The argument function must return a pointer to a `NODE' containing the newly created variable. This function is used to implement the builtin `ENVIRON' and `PROCINFO' - variables, so you can refer to them for examples. + arrays, so you can refer to them for examples. `void register_open_hook(void *(*open_func)(IOBUF *))' This function is called to register a function to be called @@ -25133,8 +25140,8 @@ Index * endgrent() user-defined function: Group Functions. (line 219) * endpwent() function (C library): Passwd Functions. (line 211) * endpwent() user-defined function: Passwd Functions. (line 214) -* ENVIRON variable <1>: Internals. (line 150) -* ENVIRON variable: Auto-set. (line 60) +* ENVIRON array <1>: Internals. (line 150) +* ENVIRON array: Auto-set. (line 60) * environment variables: Auto-set. (line 60) * epoch, definition of: Glossary. (line 235) * equals sign (=), = operator: Assignment Ops. (line 6) @@ -25191,6 +25198,7 @@ Index (line 9) * expressions, selecting: Conditional Exp. (line 6) * Extended Regular Expressions (EREs): Character Lists. (line 23) +* eXtensible Markup Language (XML): Internals. (line 161) * extension() function (gawk): Using Internal File Ops. (line 15) * extensions, Brian Kernighan's awk <1>: Other Versions. (line 13) @@ -25684,6 +25692,37 @@ Index * integers: Basic Data Typing. (line 21) * integers, unsigned: Basic Data Typing. (line 30) * interacting with other programs: I/O Functions. (line 63) +* internal constant, INVALID_HANDLE: Internals. (line 161) +* internal function, assoc_clear(): Internals. (line 75) +* internal function, assoc_lookup(): Internals. (line 79) +* internal function, dupnode(): Internals. (line 96) +* internal function, force_number(): Internals. (line 27) +* internal function, force_string(): Internals. (line 32) +* internal function, force_wstring(): Internals. (line 37) +* internal function, get_actual_argument(): Internals. (line 125) +* internal function, get_argument(): Internals. (line 120) +* internal function, get_curfunc_arg_count(): Internals. (line 42) +* internal function, iop_alloc(): Internals. (line 161) +* internal function, make_builtin(): Internals. (line 106) +* internal function, make_number(): Internals. (line 91) +* internal function, make_string(): Internals. (line 86) +* internal function, register_deferred_variable(): Internals. (line 150) +* internal function, register_open_hook(): Internals. (line 161) +* internal function, unref(): Internals. (line 101) +* internal function, update_ERRNO(): Internals. (line 139) +* internal function, update_ERRNO_saved(): Internals. (line 144) +* internal macro, get_array_argument(): Internals. (line 136) +* internal macro, get_scalar_argument(): Internals. (line 133) +* internal structure, IOBUF: Internals. (line 161) +* internal type, AWKNUM: Internals. (line 19) +* internal type, NODE: Internals. (line 23) +* internal variable, nargs: Internals. (line 49) +* internal variable, stlen: Internals. (line 53) +* internal variable, stptr: Internals. (line 53) +* internal variable, type: Internals. (line 66) +* internal variable, vname: Internals. (line 71) +* internal variable, wstlen: Internals. (line 61) +* internal variable, wstptr: Internals. (line 61) * internationalization <1>: I18N and L10N. (line 6) * internationalization: I18N Functions. (line 6) * internationalization, localization <1>: Internationalization. @@ -25758,7 +25797,7 @@ Index * length() function: String Functions. (line 137) * Lesser General Public License (LGPL): Glossary. (line 385) * LGPL (Lesser General Public License): Glossary. (line 385) -* libmawk: Other Versions. (line 106) +* libmawk: Other Versions. (line 95) * libraries of awk functions: Library Functions. (line 6) * libraries of awk functions, assertions: Assert Function. (line 6) * libraries of awk functions, associative arrays and: Library Names. @@ -26055,7 +26094,7 @@ Index * patterns, ranges in: Ranges. (line 6) * patterns, regexp constants as: Expression Patterns. (line 36) * patterns, types of: Pattern Overview. (line 15) -* pawk profiling version of Brian Kernighan's awk: Other Versions. +* pawk (profiling version of Brian Kernighan's awk): Other Versions. (line 69) * PC operating systems, gawk on: PC Using. (line 6) * PC operating systems, gawk on, installing: PC Installation. (line 6) @@ -26063,7 +26102,7 @@ Index * percent sign (%), %= operator <1>: Precedence. (line 95) * percent sign (%), %= operator: Assignment Ops. (line 129) * period (.): Regexp Operators. (line 43) -* PERL: Future Extensions. (line 6) +* Perl: Future Extensions. (line 6) * Peters, Arno: Contributors. (line 82) * Peterson, Hal: Contributors. (line 40) * pgawk program: Profiling. (line 6) @@ -26126,6 +26165,7 @@ Index * positive zero: Unexpected Results. (line 28) * POSIX awk <1>: Assignment Ops. (line 136) * POSIX awk: This Manual. (line 14) +* POSIX awk, ** operator and: Precedence. (line 98) * POSIX awk, **= operator and: Assignment Ops. (line 142) * POSIX awk, < operator and: Getline/File. (line 26) * POSIX awk, arithmetic operators and: Arithmetic Ops. (line 36) @@ -26202,14 +26242,14 @@ Index * private variables: Library Names. (line 11) * processes, two-way communications with: Two-way I/O. (line 23) * processing data: Basic High Level. (line 6) -* PROCINFO array <1>: Id Program. (line 15) -* PROCINFO array <2>: Group Functions. (line 6) -* PROCINFO array <3>: Passwd Functions. (line 6) -* PROCINFO array <4>: Two-way I/O. (line 116) -* PROCINFO array <5>: Time Functions. (line 46) -* PROCINFO array <6>: Auto-set. (line 123) +* PROCINFO array <1>: Internals. (line 150) +* PROCINFO array <2>: Id Program. (line 15) +* PROCINFO array <3>: Group Functions. (line 6) +* PROCINFO array <4>: Passwd Functions. (line 6) +* PROCINFO array <5>: Two-way I/O. (line 116) +* PROCINFO array <6>: Time Functions. (line 46) +* PROCINFO array <7>: Auto-set. (line 123) * PROCINFO array: Obsolete. (line 11) -* PROCINFO variable: Internals. (line 150) * profiling awk programs: Profiling. (line 6) * profiling awk programs, dynamically: Profiling. (line 174) * profiling gawk, See pgawk program: Profiling. (line 6) @@ -26238,12 +26278,12 @@ Index * pwcat program: Passwd Functions. (line 23) * q debugger command (alias for quit): Miscellaneous Dgawk Commands. (line 101) -* QSE Awk: Other Versions. (line 102) +* QSE Awk: Other Versions. (line 99) * question mark (?) regexp operator <1>: GNU Regexp Operators. (line 59) * question mark (?) regexp operator: Regexp Operators. (line 110) * question mark (?), ?: operator: Precedence. (line 92) -* QuikTrim Awk: Other Versions. (line 95) +* QuikTrim Awk: Other Versions. (line 103) * quit debugger command: Miscellaneous Dgawk Commands. (line 101) * QUIT signal (MS-Windows): Profiling. (line 207) @@ -26261,7 +26301,7 @@ Index * random numbers, rand()/srand() functions: Numeric Functions. (line 33) * random numbers, seed of: Numeric Functions. (line 63) -* range expressions: Character Lists. (line 6) +* range expressions (regexps): Character Lists. (line 6) * range patterns: Ranges. (line 6) * Rankin, Pat <1>: Bugs. (line 72) * Rankin, Pat <2>: Contributors. (line 38) @@ -26338,7 +26378,7 @@ Index * return statement, user-defined functions: Return Statement. (line 6) * return values, close() function: Close Files And Pipes. (line 131) -* rev user-defined function: Function Example. (line 52) +* rev() user-defined function: Function Example. (line 52) * rewind() user-defined function: Rewind Function. (line 16) * right angle bracket (>), > operator <1>: Precedence. (line 65) * right angle bracket (>), > operator: Comparison Operators. @@ -26371,7 +26411,6 @@ Index * robot, the: Dynamic Extensions. (line 6) * Rommel, Kai Uwe: Contributors. (line 42) * round() user-defined function: Round Function. (line 16) -* rounding: Round Function. (line 6) * rounding numbers: Round Function. (line 6) * RS variable <1>: User-modified. (line 134) * RS variable: Records. (line 20) @@ -26398,9 +26437,12 @@ Index * Schreiber, Bert: Acknowledgments. (line 37) * Schreiber, Rita: Acknowledgments. (line 37) * search paths <1>: VMS Running. (line 28) -* search paths: PC Using. (line 11) +* search paths <2>: PC Using. (line 11) +* search paths <3>: Igawk Program. (line 364) +* search paths: AWKPATH Variable. (line 6) * search paths, for source files <1>: VMS Running. (line 28) -* search paths, for source files <2>: Igawk Program. (line 364) +* search paths, for source files <2>: PC Using. (line 11) +* search paths, for source files <3>: Igawk Program. (line 364) * search paths, for source files: AWKPATH Variable. (line 6) * searching: String Functions. (line 126) * searching, files for regular expressions: Egrep Program. (line 6) @@ -26419,10 +26461,10 @@ Index * separators, field, FIELDWIDTHS variable and: User-modified. (line 35) * separators, field, FPAT variable and: User-modified. (line 45) * separators, field, POSIX and: Fields. (line 6) +* separators, for records <1>: User-modified. (line 134) * separators, for records: Records. (line 14) * separators, for records, regular expressions as: Records. (line 112) * separators, for statements in actions: Action Overview. (line 19) -* separators, record: User-modified. (line 134) * separators, subscript: User-modified. (line 147) * set debugger command: Viewing And Changing Data. (line 59) @@ -26480,13 +26522,14 @@ Index * source code, Brian Kernighan's awk: Other Versions. (line 13) * source code, gawk: Gawk Distribution. (line 6) * source code, jawk: Other Versions. (line 87) -* source code, libmawk: Other Versions. (line 106) +* source code, libmawk: Other Versions. (line 95) * source code, mawk: Other Versions. (line 35) * source code, mixing: Options. (line 104) * source code, pawk: Other Versions. (line 69) -* source code, QSE Awk: Other Versions. (line 102) -* source code, QuikTrim Awk: Other Versions. (line 95) +* source code, QSE Awk: Other Versions. (line 99) +* source code, QuikTrim Awk: Other Versions. (line 103) * source code, Solaris awk: Other Versions. (line 77) +* source code, xgawk: Other Versions. (line 110) * source files, search path for: Igawk Program. (line 364) * sparse arrays: Array Intro. (line 71) * Spencer, Henry: Glossary. (line 12) @@ -26506,6 +26549,7 @@ Index * Stallman, Richard <2>: Contributors. (line 24) * Stallman, Richard <3>: Acknowledgments. (line 18) * Stallman, Richard: Manual History. (line 6) +* standard error: Special FD. (line 6) * standard input <1>: Special FD. (line 6) * standard input: Read Terminal. (line 6) * standard output: Special FD. (line 6) @@ -26738,8 +26782,8 @@ Index * vertical bar (|): Regexp Operators. (line 68) * vertical bar (|), | operator (I/O) <1>: Precedence. (line 65) * vertical bar (|), | operator (I/O): Getline/Pipe. (line 6) -* vertical bar (|), |& I/O operator (I/O): Two-way I/O. (line 44) -* vertical bar (|), |& operator (I/O) <1>: Precedence. (line 65) +* vertical bar (|), |& operator (I/O) <1>: Two-way I/O. (line 44) +* vertical bar (|), |& operator (I/O) <2>: Precedence. (line 65) * vertical bar (|), |& operator (I/O): Getline/Coprocess. (line 6) * vertical bar (|), || operator <1>: Precedence. (line 89) * vertical bar (|), || operator: Boolean Ops. (line 57) @@ -26779,8 +26823,9 @@ Index * words, usage counts, generating: Word Sorting. (line 6) * wstlen internal variable: Internals. (line 61) * wstptr internal variable: Internals. (line 61) +* xgawk: Other Versions. (line 110) * xgettext utility: String Extraction. (line 13) -* XML: Internals. (line 161) +* XML (eXtensible Markup Language): Internals. (line 161) * XOR bitwise operation: Bitwise Functions. (line 6) * xor() function (gawk): Bitwise Functions. (line 54) * Zaretskii, Eli <1>: Bugs. (line 70) @@ -26817,405 +26862,405 @@ Index Tag Table: Node: Top1340 Node: Foreword30033 -Node: Preface34353 -Ref: Preface-Footnote-137305 -Ref: Preface-Footnote-237411 -Node: History37643 -Node: Names39877 -Ref: Names-Footnote-141354 -Node: This Manual41426 -Ref: This Manual-Footnote-146324 -Node: Conventions46424 -Node: Manual History48540 -Ref: Manual History-Footnote-151718 -Ref: Manual History-Footnote-251759 -Node: How To Contribute51833 -Node: Acknowledgments52977 -Node: Getting Started57225 -Node: Running gawk59604 -Node: One-shot60790 -Node: Read Terminal62015 -Ref: Read Terminal-Footnote-163665 -Ref: Read Terminal-Footnote-263939 -Node: Long64110 -Node: Executable Scripts65486 -Ref: Executable Scripts-Footnote-167347 -Ref: Executable Scripts-Footnote-267449 -Node: Comments67900 -Node: Quoting70367 -Node: DOS Quoting74984 -Node: Sample Data Files75659 -Node: Very Simple78691 -Node: Two Rules83288 -Node: More Complex85435 -Ref: More Complex-Footnote-188365 -Node: Statements/Lines88445 -Ref: Statements/Lines-Footnote-192907 -Node: Other Features93172 -Node: When94041 -Node: Invoking Gawk96184 -Node: Command Line97569 -Node: Options98352 -Ref: Options-Footnote-1111406 -Node: Other Arguments111431 -Node: Naming Standard Input114094 -Node: Environment Variables115058 -Node: AWKPATH Variable115502 -Ref: AWKPATH Variable-Footnote-1118239 -Node: Other Environment Variables118499 -Node: Exit Status120847 -Node: Include Files121522 -Node: Obsolete124913 -Node: Undocumented125599 -Node: Regexp125840 -Node: Regexp Usage127292 -Node: Escape Sequences129318 -Node: Regexp Operators135061 -Ref: Regexp Operators-Footnote-1142233 -Ref: Regexp Operators-Footnote-2142380 -Node: Character Lists142478 -Ref: table-char-classes144253 -Node: GNU Regexp Operators146893 -Node: Case-sensitivity150612 -Ref: Case-sensitivity-Footnote-1153567 -Ref: Case-sensitivity-Footnote-2153802 -Node: Leftmost Longest153910 -Node: Computed Regexps155111 -Node: Locales158528 -Node: Reading Files162070 -Node: Records164011 -Ref: Records-Footnote-1172690 -Node: Fields172727 -Ref: Fields-Footnote-1175759 -Node: Nonconstant Fields175845 -Node: Changing Fields178047 -Node: Field Separators183337 -Node: Default Field Splitting185966 -Node: Regexp Field Splitting187083 -Node: Single Character Fields190441 -Node: Command Line Field Separator191500 -Node: Field Splitting Summary194939 -Ref: Field Splitting Summary-Footnote-1198125 -Node: Constant Size198226 -Node: Splitting By Content202788 -Ref: Splitting By Content-Footnote-1206514 -Node: Multiple Line206554 -Ref: Multiple Line-Footnote-1212401 -Node: Getline212580 -Node: Plain Getline214808 -Node: Getline/Variable216897 -Node: Getline/File218038 -Node: Getline/Variable/File219360 -Ref: Getline/Variable/File-Footnote-1220959 -Node: Getline/Pipe221046 -Node: Getline/Variable/Pipe223594 -Node: Getline/Coprocess224701 -Node: Getline/Variable/Coprocess225944 -Node: Getline Notes226658 -Node: Getline Summary228600 -Ref: table-getline-variants228884 -Node: Command line directories229789 -Node: Printing230414 -Node: Print232045 -Node: Print Examples233382 -Node: Output Separators236166 -Node: OFMT237925 -Node: Printf239283 -Node: Basic Printf240189 -Node: Control Letters241726 -Node: Format Modifiers245538 -Node: Printf Examples251549 -Node: Redirection254264 -Node: Special Files261242 -Node: Special FD261775 -Ref: Special FD-Footnote-1265386 -Node: Special Network265460 -Node: Special Caveats266315 -Node: Close Files And Pipes267109 -Ref: Close Files And Pipes-Footnote-1274053 -Ref: Close Files And Pipes-Footnote-2274201 -Node: Expressions274351 -Node: Values275420 -Node: Constants276096 -Node: Scalar Constants276776 -Ref: Scalar Constants-Footnote-1277635 -Node: Nondecimal-numbers277817 -Node: Regexp Constants280876 -Node: Using Constant Regexps281351 -Node: Variables284356 -Node: Using Variables285011 -Node: Assignment Options286738 -Node: Conversion288619 -Ref: table-locale-affects293993 -Ref: Conversion-Footnote-1294617 -Node: All Operators294726 -Node: Arithmetic Ops295356 -Node: Concatenation297862 -Ref: Concatenation-Footnote-1300655 -Node: Assignment Ops300774 -Ref: table-assign-ops305762 -Node: Increment Ops307170 -Node: Truth Values and Conditions310648 -Node: Truth Values311731 -Node: Typing and Comparison312779 -Node: Variable Typing313568 -Ref: Variable Typing-Footnote-1317465 -Node: Comparison Operators317587 -Ref: table-relational-ops317997 -Node: POSIX String Comparison321546 -Ref: POSIX String Comparison-Footnote-1322503 -Node: Boolean Ops322641 -Ref: Boolean Ops-Footnote-1326719 -Node: Conditional Exp326810 -Node: Function Calls328542 -Node: Precedence332132 -Node: Patterns and Actions335785 -Node: Pattern Overview336839 -Node: Regexp Patterns338505 -Node: Expression Patterns339048 -Node: Ranges342622 -Node: BEGIN/END345588 -Node: Using BEGIN/END346338 -Ref: Using BEGIN/END-Footnote-1349069 -Node: I/O And BEGIN/END349183 -Node: Empty351452 -Node: BEGINFILE/ENDFILE351786 -Node: Using Shell Variables354611 -Node: Action Overview356890 -Node: Statements359247 -Node: If Statement361106 -Node: While Statement362605 -Node: Do Statement364649 -Node: For Statement365805 -Node: Switch Statement368957 -Node: Break Statement371054 -Node: Continue Statement373030 -Node: Next Statement374731 -Node: Nextfile Statement377113 -Node: Exit Statement379638 -Node: Built-in Variables381969 -Node: User-modified383064 -Ref: User-modified-Footnote-1391065 -Node: Auto-set391127 -Ref: Auto-set-Footnote-1400110 -Node: ARGC and ARGV400315 -Node: Arrays404074 -Node: Array Basics405645 -Node: Array Intro406356 -Node: Reference to Elements410674 -Node: Assigning Elements412944 -Node: Array Example413435 -Node: Scanning an Array415167 -Node: Delete417444 -Ref: Delete-Footnote-1419875 -Node: Numeric Array Subscripts419932 -Node: Uninitialized Subscripts422115 -Node: Multi-dimensional423743 -Node: Multi-scanning426834 -Node: Array Sorting428418 -Ref: Array Sorting-Footnote-1431616 -Node: Arrays of Arrays431810 -Node: Functions435972 -Node: Built-in436794 -Node: Calling Built-in437808 -Node: Numeric Functions439784 -Ref: Numeric Functions-Footnote-1443541 -Ref: Numeric Functions-Footnote-2443877 -Ref: Numeric Functions-Footnote-3443925 -Node: String Functions444194 -Ref: String Functions-Footnote-1466000 -Ref: String Functions-Footnote-2466129 -Ref: String Functions-Footnote-3466377 -Node: Gory Details466464 -Ref: table-sub-escapes468121 -Ref: table-posix-sub469435 -Ref: table-gensub-escapes470335 -Node: I/O Functions471506 -Ref: I/O Functions-Footnote-1478201 -Node: Time Functions478348 -Ref: Time Functions-Footnote-1489215 -Ref: Time Functions-Footnote-2489283 -Ref: Time Functions-Footnote-3489441 -Ref: Time Functions-Footnote-4489552 -Ref: Time Functions-Footnote-5489664 -Ref: Time Functions-Footnote-6489891 -Node: Bitwise Functions490157 -Ref: table-bitwise-ops490715 -Ref: Bitwise Functions-Footnote-1494875 -Node: I18N Functions495059 -Node: User-defined496689 -Node: Definition Syntax497493 -Ref: Definition Syntax-Footnote-1502130 -Node: Function Example502199 -Node: Function Caveats504793 -Node: Calling A Function505214 -Node: Variable Scope506329 -Node: Pass By Value/Reference508257 -Node: Return Statement511697 -Node: Dynamic Typing514639 -Node: Indirect Calls515376 -Node: Internationalization525061 -Node: I18N and L10N526489 -Node: Explaining gettext527175 -Ref: Explaining gettext-Footnote-1532237 -Ref: Explaining gettext-Footnote-2532420 -Node: Programmer i18n532585 -Node: Translator i18n536876 -Node: String Extraction537669 -Ref: String Extraction-Footnote-1538630 -Node: Printf Ordering538716 -Ref: Printf Ordering-Footnote-1541500 -Node: I18N Portability541564 -Ref: I18N Portability-Footnote-1544013 -Node: I18N Example544076 -Ref: I18N Example-Footnote-1546711 -Node: Gawk I18N546783 -Node: Advanced Features547400 -Node: Nondecimal Data548719 -Node: Two-way I/O550300 -Ref: Two-way I/O-Footnote-1555714 -Node: TCP/IP Networking555791 -Node: Profiling558634 -Node: Library Functions566034 -Ref: Library Functions-Footnote-1569004 -Node: Library Names569175 -Ref: Library Names-Footnote-1572646 -Ref: Library Names-Footnote-2572866 -Node: General Functions572952 -Node: Nextfile Function574015 -Node: Strtonum Function578396 -Node: Assert Function581347 -Node: Round Function584673 -Node: Cliff Random Function586214 -Node: Ordinal Functions587230 -Ref: Ordinal Functions-Footnote-1590300 -Ref: Ordinal Functions-Footnote-2590552 -Node: Join Function590768 -Ref: Join Function-Footnote-1592539 -Node: Gettimeofday Function592739 -Node: Data File Management596454 -Node: Filetrans Function597086 -Node: Rewind Function601323 -Node: File Checking602776 -Node: Empty Files603870 -Node: Ignoring Assigns606100 -Node: Getopt Function607653 -Ref: Getopt Function-Footnote-1618978 -Node: Passwd Functions619181 -Ref: Passwd Functions-Footnote-1628169 -Node: Group Functions628257 -Node: Sample Programs636337 -Node: Running Examples637002 -Node: Clones637730 -Node: Cut Program638853 -Node: Egrep Program648694 -Ref: Egrep Program-Footnote-1656465 -Node: Id Program656575 -Node: Split Program660191 -Ref: Split Program-Footnote-1663710 -Node: Tee Program663838 -Node: Uniq Program666641 -Node: Wc Program674064 -Ref: Wc Program-Footnote-1678328 -Node: Miscellaneous Programs678528 -Node: Dupword Program679648 -Node: Alarm Program681679 -Node: Translate Program686401 -Ref: Translate Program-Footnote-1690780 -Ref: Translate Program-Footnote-2691008 -Node: Labels Program691142 -Ref: Labels Program-Footnote-1694513 -Node: Word Sorting694597 -Node: History Sorting698942 -Node: Extract Program700780 -Ref: Extract Program-Footnote-1708261 -Node: Simple Sed708389 -Node: Igawk Program711451 -Ref: Igawk Program-Footnote-1726485 -Ref: Igawk Program-Footnote-2726686 -Node: Signature Program726824 -Node: Debugger727904 -Node: Debugging728815 -Node: Debugging Concepts729129 -Node: Debugging Terms730985 -Node: Awk Debugging733530 -Node: Sample dgawk session734422 -Node: dgawk invocation734914 -Node: Finding The Bug736096 -Node: List of Debugger Commands742580 -Node: Breakpoint Control743891 -Node: Dgawk Execution Control747367 -Node: Viewing And Changing Data750718 -Node: Dgawk Stack754027 -Node: Dgawk Info755487 -Node: Miscellaneous Dgawk Commands759435 -Node: Readline Support764863 -Node: Dgawk Limitations765690 -Node: Language History767829 -Node: V7/SVR3.1769261 -Node: SVR4771556 -Node: POSIX773001 -Node: BTL773999 -Node: POSIX/GNU774733 -Node: Common Extensions779919 -Node: Contributors781052 -Node: Installation785087 -Node: Gawk Distribution785981 -Node: Getting786465 -Node: Extracting787291 -Node: Distribution contents788969 -Node: Unix Installation793987 -Node: Quick Installation794604 -Node: Additional Configuration Options796566 -Node: Configuration Philosophy798043 -Node: Non-Unix Installation800385 -Node: PC Installation800843 -Node: PC Binary Installation802142 -Node: PC Compiling803990 -Node: PC Testing807136 -Node: PC Using808312 -Node: Cygwin812497 -Node: MSYS813494 -Node: VMS Installation814008 -Node: VMS Compilation814612 -Node: VMS Installation Details816189 -Node: VMS Running817819 -Node: VMS POSIX819416 -Node: VMS Old Gawk820714 -Node: Bugs821186 -Node: Other Versions825051 -Node: Notes829559 -Node: Compatibility Mode830251 -Node: Additions831034 -Node: Accessing The Source831846 -Node: Adding Code833269 -Node: New Ports838817 -Node: Dynamic Extensions842930 -Node: Internals844306 -Node: Plugin License853425 -Node: Sample Library854059 -Node: Internal File Description854745 -Node: Internal File Ops858452 -Ref: Internal File Ops-Footnote-1863220 -Node: Using Internal File Ops863368 -Node: Future Extensions865745 -Node: Basic Concepts868249 -Node: Basic High Level869006 -Ref: Basic High Level-Footnote-1873041 -Node: Basic Data Typing873226 -Node: Floating Point Issues877751 -Node: String Conversion Precision878834 -Ref: String Conversion Precision-Footnote-1880528 -Node: Unexpected Results880637 -Node: POSIX Floating Point Problems882463 -Ref: POSIX Floating Point Problems-Footnote-1886159 -Node: Glossary886197 -Node: Copying910296 -Node: GNU Free Documentation License947853 -Node: next-edition972997 -Node: unresolved973349 -Node: revision973849 -Node: consistency974272 -Node: Index977771 +Node: Preface34361 +Ref: Preface-Footnote-137313 +Ref: Preface-Footnote-237419 +Node: History37651 +Node: Names39885 +Ref: Names-Footnote-141362 +Node: This Manual41434 +Ref: This Manual-Footnote-146332 +Node: Conventions46432 +Node: Manual History48548 +Ref: Manual History-Footnote-151726 +Ref: Manual History-Footnote-251767 +Node: How To Contribute51841 +Node: Acknowledgments52985 +Node: Getting Started57233 +Node: Running gawk59612 +Node: One-shot60798 +Node: Read Terminal62023 +Ref: Read Terminal-Footnote-163673 +Ref: Read Terminal-Footnote-263947 +Node: Long64118 +Node: Executable Scripts65494 +Ref: Executable Scripts-Footnote-167355 +Ref: Executable Scripts-Footnote-267457 +Node: Comments67908 +Node: Quoting70375 +Node: DOS Quoting74992 +Node: Sample Data Files75667 +Node: Very Simple78699 +Node: Two Rules83296 +Node: More Complex85443 +Ref: More Complex-Footnote-188373 +Node: Statements/Lines88453 +Ref: Statements/Lines-Footnote-192915 +Node: Other Features93180 +Node: When94049 +Node: Invoking Gawk96192 +Node: Command Line97577 +Node: Options98360 +Ref: Options-Footnote-1111414 +Node: Other Arguments111439 +Node: Naming Standard Input114102 +Node: Environment Variables115066 +Node: AWKPATH Variable115510 +Ref: AWKPATH Variable-Footnote-1118247 +Node: Other Environment Variables118507 +Node: Exit Status120855 +Node: Include Files121530 +Node: Obsolete124921 +Node: Undocumented125607 +Node: Regexp125848 +Node: Regexp Usage127300 +Node: Escape Sequences129326 +Node: Regexp Operators135069 +Ref: Regexp Operators-Footnote-1142241 +Ref: Regexp Operators-Footnote-2142388 +Node: Character Lists142486 +Ref: table-char-classes144261 +Node: GNU Regexp Operators146901 +Node: Case-sensitivity150620 +Ref: Case-sensitivity-Footnote-1153575 +Ref: Case-sensitivity-Footnote-2153810 +Node: Leftmost Longest153918 +Node: Computed Regexps155119 +Node: Locales158536 +Node: Reading Files162078 +Node: Records164019 +Ref: Records-Footnote-1172698 +Node: Fields172735 +Ref: Fields-Footnote-1175767 +Node: Nonconstant Fields175853 +Node: Changing Fields178055 +Node: Field Separators183345 +Node: Default Field Splitting185974 +Node: Regexp Field Splitting187091 +Node: Single Character Fields190449 +Node: Command Line Field Separator191508 +Node: Field Splitting Summary194947 +Ref: Field Splitting Summary-Footnote-1198133 +Node: Constant Size198234 +Node: Splitting By Content202796 +Ref: Splitting By Content-Footnote-1206522 +Node: Multiple Line206562 +Ref: Multiple Line-Footnote-1212409 +Node: Getline212588 +Node: Plain Getline214816 +Node: Getline/Variable216905 +Node: Getline/File218046 +Node: Getline/Variable/File219368 +Ref: Getline/Variable/File-Footnote-1220967 +Node: Getline/Pipe221054 +Node: Getline/Variable/Pipe223602 +Node: Getline/Coprocess224709 +Node: Getline/Variable/Coprocess225952 +Node: Getline Notes226666 +Node: Getline Summary228608 +Ref: table-getline-variants228892 +Node: Command line directories229797 +Node: Printing230422 +Node: Print232053 +Node: Print Examples233390 +Node: Output Separators236174 +Node: OFMT237933 +Node: Printf239291 +Node: Basic Printf240197 +Node: Control Letters241734 +Node: Format Modifiers245546 +Node: Printf Examples251557 +Node: Redirection254272 +Node: Special Files261250 +Node: Special FD261783 +Ref: Special FD-Footnote-1265394 +Node: Special Network265468 +Node: Special Caveats266323 +Node: Close Files And Pipes267117 +Ref: Close Files And Pipes-Footnote-1274061 +Ref: Close Files And Pipes-Footnote-2274209 +Node: Expressions274359 +Node: Values275428 +Node: Constants276104 +Node: Scalar Constants276784 +Ref: Scalar Constants-Footnote-1277643 +Node: Nondecimal-numbers277825 +Node: Regexp Constants280884 +Node: Using Constant Regexps281359 +Node: Variables284364 +Node: Using Variables285019 +Node: Assignment Options286746 +Node: Conversion288627 +Ref: table-locale-affects294001 +Ref: Conversion-Footnote-1294625 +Node: All Operators294734 +Node: Arithmetic Ops295364 +Node: Concatenation297870 +Ref: Concatenation-Footnote-1300663 +Node: Assignment Ops300782 +Ref: table-assign-ops305770 +Node: Increment Ops307178 +Node: Truth Values and Conditions310656 +Node: Truth Values311739 +Node: Typing and Comparison312787 +Node: Variable Typing313576 +Ref: Variable Typing-Footnote-1317473 +Node: Comparison Operators317595 +Ref: table-relational-ops318005 +Node: POSIX String Comparison321554 +Ref: POSIX String Comparison-Footnote-1322511 +Node: Boolean Ops322649 +Ref: Boolean Ops-Footnote-1326727 +Node: Conditional Exp326818 +Node: Function Calls328550 +Node: Precedence332140 +Node: Patterns and Actions335793 +Node: Pattern Overview336847 +Node: Regexp Patterns338513 +Node: Expression Patterns339056 +Node: Ranges342630 +Node: BEGIN/END345596 +Node: Using BEGIN/END346346 +Ref: Using BEGIN/END-Footnote-1349077 +Node: I/O And BEGIN/END349191 +Node: Empty351460 +Node: BEGINFILE/ENDFILE351794 +Node: Using Shell Variables354619 +Node: Action Overview356898 +Node: Statements359255 +Node: If Statement361114 +Node: While Statement362613 +Node: Do Statement364657 +Node: For Statement365813 +Node: Switch Statement368965 +Node: Break Statement371062 +Node: Continue Statement373038 +Node: Next Statement374739 +Node: Nextfile Statement377121 +Node: Exit Statement379646 +Node: Built-in Variables381977 +Node: User-modified383072 +Ref: User-modified-Footnote-1391073 +Node: Auto-set391135 +Ref: Auto-set-Footnote-1400118 +Node: ARGC and ARGV400323 +Node: Arrays404082 +Node: Array Basics405653 +Node: Array Intro406364 +Node: Reference to Elements410682 +Node: Assigning Elements412952 +Node: Array Example413443 +Node: Scanning an Array415175 +Node: Delete417452 +Ref: Delete-Footnote-1419883 +Node: Numeric Array Subscripts419940 +Node: Uninitialized Subscripts422123 +Node: Multi-dimensional423751 +Node: Multi-scanning426842 +Node: Array Sorting428426 +Ref: Array Sorting-Footnote-1431624 +Node: Arrays of Arrays431818 +Node: Functions435980 +Node: Built-in436802 +Node: Calling Built-in437816 +Node: Numeric Functions439792 +Ref: Numeric Functions-Footnote-1443549 +Ref: Numeric Functions-Footnote-2443885 +Ref: Numeric Functions-Footnote-3443933 +Node: String Functions444202 +Ref: String Functions-Footnote-1466008 +Ref: String Functions-Footnote-2466137 +Ref: String Functions-Footnote-3466385 +Node: Gory Details466472 +Ref: table-sub-escapes468129 +Ref: table-posix-sub469443 +Ref: table-gensub-escapes470343 +Node: I/O Functions471514 +Ref: I/O Functions-Footnote-1478209 +Node: Time Functions478356 +Ref: Time Functions-Footnote-1489223 +Ref: Time Functions-Footnote-2489291 +Ref: Time Functions-Footnote-3489449 +Ref: Time Functions-Footnote-4489560 +Ref: Time Functions-Footnote-5489672 +Ref: Time Functions-Footnote-6489899 +Node: Bitwise Functions490165 +Ref: table-bitwise-ops490723 +Ref: Bitwise Functions-Footnote-1494883 +Node: I18N Functions495067 +Node: User-defined496697 +Node: Definition Syntax497501 +Ref: Definition Syntax-Footnote-1502138 +Node: Function Example502207 +Node: Function Caveats504801 +Node: Calling A Function505222 +Node: Variable Scope506337 +Node: Pass By Value/Reference508265 +Node: Return Statement511705 +Node: Dynamic Typing514647 +Node: Indirect Calls515384 +Node: Internationalization525069 +Node: I18N and L10N526497 +Node: Explaining gettext527183 +Ref: Explaining gettext-Footnote-1532245 +Ref: Explaining gettext-Footnote-2532428 +Node: Programmer i18n532593 +Node: Translator i18n536884 +Node: String Extraction537677 +Ref: String Extraction-Footnote-1538638 +Node: Printf Ordering538724 +Ref: Printf Ordering-Footnote-1541508 +Node: I18N Portability541572 +Ref: I18N Portability-Footnote-1544021 +Node: I18N Example544084 +Ref: I18N Example-Footnote-1546719 +Node: Gawk I18N546791 +Node: Advanced Features547408 +Node: Nondecimal Data548727 +Node: Two-way I/O550308 +Ref: Two-way I/O-Footnote-1555722 +Node: TCP/IP Networking555799 +Node: Profiling558642 +Node: Library Functions566042 +Ref: Library Functions-Footnote-1569012 +Node: Library Names569183 +Ref: Library Names-Footnote-1572654 +Ref: Library Names-Footnote-2572874 +Node: General Functions572960 +Node: Nextfile Function574023 +Node: Strtonum Function578404 +Node: Assert Function581355 +Node: Round Function584681 +Node: Cliff Random Function586222 +Node: Ordinal Functions587238 +Ref: Ordinal Functions-Footnote-1590308 +Ref: Ordinal Functions-Footnote-2590560 +Node: Join Function590776 +Ref: Join Function-Footnote-1592547 +Node: Gettimeofday Function592747 +Node: Data File Management596462 +Node: Filetrans Function597094 +Node: Rewind Function601331 +Node: File Checking602784 +Node: Empty Files603878 +Node: Ignoring Assigns606108 +Node: Getopt Function607661 +Ref: Getopt Function-Footnote-1618986 +Node: Passwd Functions619189 +Ref: Passwd Functions-Footnote-1628177 +Node: Group Functions628265 +Node: Sample Programs636345 +Node: Running Examples637010 +Node: Clones637738 +Node: Cut Program638861 +Node: Egrep Program648702 +Ref: Egrep Program-Footnote-1656473 +Node: Id Program656583 +Node: Split Program660199 +Ref: Split Program-Footnote-1663718 +Node: Tee Program663846 +Node: Uniq Program666649 +Node: Wc Program674072 +Ref: Wc Program-Footnote-1678336 +Node: Miscellaneous Programs678536 +Node: Dupword Program679656 +Node: Alarm Program681687 +Node: Translate Program686409 +Ref: Translate Program-Footnote-1690788 +Ref: Translate Program-Footnote-2691016 +Node: Labels Program691150 +Ref: Labels Program-Footnote-1694521 +Node: Word Sorting694605 +Node: History Sorting698950 +Node: Extract Program700788 +Ref: Extract Program-Footnote-1708269 +Node: Simple Sed708397 +Node: Igawk Program711459 +Ref: Igawk Program-Footnote-1726493 +Ref: Igawk Program-Footnote-2726694 +Node: Signature Program726832 +Node: Debugger727912 +Node: Debugging728823 +Node: Debugging Concepts729137 +Node: Debugging Terms730993 +Node: Awk Debugging733538 +Node: Sample dgawk session734430 +Node: dgawk invocation734922 +Node: Finding The Bug736104 +Node: List of Debugger Commands742588 +Node: Breakpoint Control743899 +Node: Dgawk Execution Control747375 +Node: Viewing And Changing Data750726 +Node: Dgawk Stack754035 +Node: Dgawk Info755495 +Node: Miscellaneous Dgawk Commands759443 +Node: Readline Support764871 +Node: Dgawk Limitations765698 +Node: Language History767837 +Node: V7/SVR3.1769269 +Node: SVR4771564 +Node: POSIX773006 +Node: BTL774004 +Node: POSIX/GNU774738 +Node: Common Extensions779924 +Node: Contributors781057 +Node: Installation785092 +Node: Gawk Distribution785986 +Node: Getting786470 +Node: Extracting787296 +Node: Distribution contents788974 +Node: Unix Installation793992 +Node: Quick Installation794609 +Node: Additional Configuration Options796571 +Node: Configuration Philosophy798048 +Node: Non-Unix Installation800390 +Node: PC Installation800848 +Node: PC Binary Installation802147 +Node: PC Compiling803995 +Node: PC Testing807141 +Node: PC Using808317 +Node: Cygwin812502 +Node: MSYS813499 +Node: VMS Installation814013 +Node: VMS Compilation814617 +Node: VMS Installation Details816194 +Node: VMS Running817824 +Node: VMS POSIX819421 +Node: VMS Old Gawk820719 +Node: Bugs821191 +Node: Other Versions825056 +Node: Notes829892 +Node: Compatibility Mode830584 +Node: Additions831367 +Node: Accessing The Source832179 +Node: Adding Code833602 +Node: New Ports839150 +Node: Dynamic Extensions843263 +Node: Internals844639 +Node: Plugin License853755 +Node: Sample Library854389 +Node: Internal File Description855075 +Node: Internal File Ops858782 +Ref: Internal File Ops-Footnote-1863550 +Node: Using Internal File Ops863698 +Node: Future Extensions866075 +Node: Basic Concepts868579 +Node: Basic High Level869336 +Ref: Basic High Level-Footnote-1873371 +Node: Basic Data Typing873556 +Node: Floating Point Issues878081 +Node: String Conversion Precision879164 +Ref: String Conversion Precision-Footnote-1880858 +Node: Unexpected Results880967 +Node: POSIX Floating Point Problems882793 +Ref: POSIX Floating Point Problems-Footnote-1886489 +Node: Glossary886527 +Node: Copying910626 +Node: GNU Free Documentation License948183 +Node: next-edition973327 +Node: unresolved973679 +Node: revision974179 +Node: consistency974602 +Node: Index978101 End Tag Table diff --git a/doc/gawk.texi b/doc/gawk.texi index 1179135d..c7f742f1 100644 --- a/doc/gawk.texi +++ b/doc/gawk.texi @@ -781,7 +781,7 @@ This book is the @command{gawk} reference manual, but at its core it is a book about AWK programming that will appeal to a wide audience. It is a definitive reference to the AWK language as defined by the -1987 Bell Labs release and codified in the 1992 POSIX Utilities +1987 Bell Laboratories release and codified in the 1992 POSIX Utilities standard. On the other hand, the novice AWK programmer can study @@ -3512,6 +3512,7 @@ behaves. @subsection The @env{AWKPATH} Environment Variable @cindex @env{AWKPATH} environment variable @cindex directories, searching +@cindex search paths @cindex search paths, for source files @cindex differences in @command{awk} and @command{gawk}, @code{AWKPATH} environment variable @ifinfo @@ -4483,7 +4484,7 @@ regular expressions. @c STARTOFRANGE charlist @cindex character lists @cindex character lists, range expressions -@cindex range expressions +@cindex range expressions (regexps) Within a character list, a @dfn{range expression} consists of two characters separated by a hyphen. It matches any single character that @@ -8280,6 +8281,7 @@ and TCP/IP networking. @cindex standard output @cindex output, standard @cindex error output +@cindex standard error @cindex file descriptors @cindex files, descriptors, See file descriptors @@ -10833,6 +10835,7 @@ Conditional. This operator groups right-to-left. Assignment. These operators group right-to-left. @end table +@cindex POSIX @command{awk}, @code{**} operator and @cindex portability, operators, not in POSIX @command{awk} @quotation NOTE The @samp{|&}, @samp{**}, and @samp{**=} operators are not specified by POSIX. @@ -12442,7 +12445,7 @@ This is the output record separator. It is output at the end of every character. (@xref{Output Separators}.) @cindex @code{RS} variable -@cindex separators, record +@cindex separators, for records @cindex record separators @item RS This is @command{awk}'s input record separator. Its default value is a string @@ -12573,7 +12576,7 @@ or if @command{gawk} is in compatibility mode (@pxref{Options}), it is not special. -@cindex @code{ENVIRON} variable +@cindex @code{ENVIRON} array @cindex environment variables @item ENVIRON An associative array containing the values of the environment. The array @@ -16431,7 +16434,7 @@ Recursive functions must always have a test that stops the recursion. In this case, the recursion terminates when the starting position is zero, i.e., when there are no more characters left in the string. -@cindex @code{rev} user-defined function +@cindex @code{rev()} user-defined function @example function rev(str, start) @{ @@ -17670,7 +17673,7 @@ translations for @command{guide}. @subsection Rearranging @code{printf} Arguments @cindex @code{printf} statement, positional specifiers -@cindex positional specifiers@comma{} @code{printf} statement +@cindex positional specifiers, @code{printf} statement Format strings for @code{printf} and @code{sprintf()} (@pxref{Printf}) present a special problem for translation. @@ -17739,7 +17742,7 @@ This is somewhat counterintuitive. @end quotation @cindex @code{printf} statement, positional specifiers, mixing with regular formats -@cindex positional specifiers@comma{} @code{printf} statement, mixing with regular formats +@cindex positional specifiers, @code{printf} statement, mixing with regular formats @cindex format specifiers, mixing regular with positional specifiers @command{gawk} does not allow you to mix regular format specifiers and those with positional specifiers in the same string: @@ -18160,7 +18163,7 @@ to be using a temporary file with the same name. @cindex coprocesses @cindex input/output, two-way @cindex @code{|} (vertical bar), @code{|&} operator (I/O) -@cindex vertical bar (@code{|}), @code{|&} I/O operator (I/O) +@cindex vertical bar (@code{|}), @code{|&} operator (I/O) @cindex @command{csh} utility, @code{|&} operator, comparison with It is possible to open a @emph{two-way} pipe to another process. The second process is @@ -19262,7 +19265,6 @@ with an @code{exit} statement. @node Round Function @subsection Rounding Numbers -@cindex rounding @cindex rounding numbers @cindex numbers, rounding @cindex libraries of @command{awk} functions, rounding numbers @@ -24358,6 +24360,7 @@ there is no real reason to build @samp{@@include} processing into @command{gawk} itself. @end ignore +@cindex search paths @cindex search paths, for source files @cindex source files@comma{} search path for @cindex files, source@comma{} search path for @@ -25831,7 +25834,7 @@ The System V Release 4 (1989) version of Unix @command{awk} added these features @itemize @bullet @item -The @code{ENVIRON} variable (@pxref{Built-in Variables}). +The @code{ENVIRON} array (@pxref{Built-in Variables}). @c gawk and MKS awk @item @@ -27150,6 +27153,7 @@ are not supported for MS-DOS or MS-Windows. EMX (OS/2 only) does support at least the @samp{|&} operator. @cindex search paths +@cindex search paths, for source files @cindex @command{gawk}, OS/2 version of @cindex @command{gawk}, MS-DOS version of @cindex @command{gawk}, MS-Windows version of @@ -27719,11 +27723,11 @@ The project seems to be frozen; no new code changes have been made since approximately 2003. @cindex Beebe, Nelson -@cindex @command{pawk} profiling version of Brian Kernighan's @command{awk} +@cindex @command{pawk} (profiling version of Brian Kernighan's @command{awk}) @cindex source code, @command{pawk} @item @command{pawk} Nelson H.F.@: Beebe at the University of Utah has modified -the Bell Labs @command{awk} to provide timing and profiling information. +Brian Kernighan's @command{awk} to provide timing and profiling information. It is different from @command{pgawk} (@pxref{Profiling}), in that it uses CPU-based profiling, not line-count @@ -27756,6 +27760,19 @@ for I/O and for regexp matching, the language it supports is different from POSIX @command{awk}. More information is available on the @uref{http://jawk.sourceforge.net, project's home page}. +@item Libmawk +@cindex libmawk +@cindex source code, libmawk +This is an embeddable @command{awk} interpreter derived from +@command{mawk}. For more information see +@uref{http://repo.hu/projects/libmawk/}. + +@item QSE Awk +@cindex QSE Awk +@cindex source code, QSE Awk +This is an embeddable @command{awk} interpreter. For more information +see @uref{http://code.google.com/p/qse/} and @uref{http://awk.info/?tools/qse}. + @item @command{QTawk} @cindex QuikTrim Awk @cindex source code, QuikTrim Awk @@ -27765,18 +27782,16 @@ under the GPL. It has a large number of extensions over standard See @uref{http://www.quiktrim.org/QTawk.html} for more information, including the manual and a download link. -@item QSE Awk -@cindex QSE Awk -@cindex source code, QSE Awk -This is an embeddable @command{awk} interpreter. For more information -see @uref{http://code.google.com/p/qse/} and @uref{http://awk.info/?tools/qse}. - -@item Libmawk -@cindex libmawk -@cindex source code, libmawk -This is an embeddable @command{awk} interpreter derived from -@command{mawk}. For more information see -@uref{http://repo.hu/projects/libmawk/}. +@item @command{xgawk} +@cindex @command{xgawk} +@cindex source code, @command{xgawk} +XML @command{gawk}. +This is a fork of the @command{gawk} 3.1.6 source base +to support processing XML files. It has a number of +interesting extensions which should one day be integrated +into the main @command{gawk} code base. +For more information, see +@uref{http://xgawk.sourceforge.net, the XMLgawk project web site}. @end table @c ENDOFRANGE gligawk @@ -28225,11 +28240,13 @@ shows how they are used: @cindex floating-point, numbers, @code{AWKNUM} internal type @cindex numbers, floating-point, @code{AWKNUM} internal type @cindex @code{AWKNUM} internal type +@cindex internal type, @code{AWKNUM} @item AWKNUM An @code{AWKNUM} is the internal type of @command{awk} floating-point numbers. Typically, it is a C @code{double}. @cindex @code{NODE} internal type +@cindex internal type, @code{NODE} @cindex strings, @code{NODE} internal type @cindex numbers, @code{NODE} internal type @item NODE @@ -28237,6 +28254,7 @@ Just about everything is done using objects of type @code{NODE}. These contain both strings and numbers, as well as variables and arrays. @cindex @code{force_number()} internal function +@cindex internal function, @code{force_number()} @cindex numeric, values @item AWKNUM force_number(NODE *n) This macro forces a value to be numeric. It returns the actual @@ -28244,12 +28262,14 @@ numeric value contained in the node. It may end up calling an internal @command{gawk} function. @cindex @code{force_string()} internal function +@cindex internal function, @code{force_string()} @item void force_string(NODE *n) This macro guarantees that a @code{NODE}'s string value is current. It may end up calling an internal @command{gawk} function. It also guarantees that the string is zero-terminated. @cindex @code{force_wstring()} internal function +@cindex internal function, @code{force_wstring()} @item void force_wstring(NODE *n) Similarly, this macro guarantees that a @code{NODE}'s wide-string value is current. @@ -28257,6 +28277,7 @@ It may end up calling an internal @command{gawk} function. It also guarantees that the wide string is zero-terminated. @cindex @code{get_curfunc_arg_count()} internal function +@cindex internal function, @code{get_curfunc_arg_count()} @item size_t get_curfunc_arg_count(void) This function returns the actual number of parameters passed to the current function. Inside the code of an extension @@ -28267,12 +28288,15 @@ called incorrectly from the @command{awk} program. @cindex parameters@comma{} number of @cindex @code{nargs} internal variable +@cindex internal variable, @code{nargs} @item nargs Inside an extension function, this is the maximum number of expected parameters, as set by the @code{make_builtin()} function. @cindex @code{stptr} internal variable +@cindex internal variable, @code{stptr} @cindex @code{stlen} internal variable +@cindex internal variable, @code{stlen} @item n->stptr @itemx n->stlen The data and length of a @code{NODE}'s string value, respectively. @@ -28282,31 +28306,37 @@ the value in @code{n->stptr[n->stlen]}, assign @code{'\0'} to it, call the routine, and then restore the value. @cindex @code{wstptr} internal variable +@cindex internal variable, @code{wstptr} @cindex @code{wstlen} internal variable +@cindex internal variable, @code{wstlen} @item n->wstptr @itemx n->wstlen The data and length of a @code{NODE}'s wide-string value, respectively. Use @code{force_wstring()} to make sure these values are current. @cindex @code{type} internal variable +@cindex internal variable, @code{type} @item n->type The type of the @code{NODE}. This is a C @code{enum}. Values should be one of @code{Node_var}, @code{Node_var_new}, or @code{Node_var_array} for function parameters. @cindex @code{vname} internal variable +@cindex internal variable, @code{vname} @item n->vname The ``variable name'' of a node. This is not of much use inside externally written extensions. @cindex arrays, associative, clearing @cindex @code{assoc_clear()} internal function +@cindex internal function, @code{assoc_clear()} @item void assoc_clear(NODE *n) Clears the associative array pointed to by @code{n}. Make sure that @samp{n->type == Node_var_array} first. @cindex arrays, elements, installing @cindex @code{assoc_lookup()} internal function +@cindex internal function, @code{assoc_lookup()} @item NODE **assoc_lookup(NODE *symbol, NODE *subs, int reference) Finds, and installs if necessary, array elements. @code{symbol} is the array, @code{subs} is the subscript. @@ -28317,6 +28347,7 @@ correct value to use from extension functions. @cindex strings @cindex @code{make_string()} internal function +@cindex internal function, @code{make_string()} @item NODE *make_string(char *s, size_t len) Take a C string and turn it into a pointer to a @code{NODE} that can be stored appropriately. This is permanent storage; understanding @@ -28324,6 +28355,7 @@ of @command{gawk} memory management is helpful. @cindex numbers @cindex @code{make_number()} internal function +@cindex internal function, @code{make_number()} @item NODE *make_number(AWKNUM val) Take an @code{AWKNUM} and turn it into a pointer to a @code{NODE} that can be stored appropriately. This is permanent storage; understanding @@ -28332,6 +28364,7 @@ of @command{gawk} memory management is helpful. @cindex nodes@comma{} duplicating @cindex @code{dupnode()} internal function +@cindex internal function, @code{dupnode()} @item NODE *dupnode(NODE *n) Duplicate a node. In most cases, this increments an internal reference count instead of actually duplicating the entire @code{NODE}; @@ -28339,12 +28372,14 @@ understanding of @command{gawk} memory management is helpful. @cindex memory, releasing @cindex @code{unref()} internal function +@cindex internal function, @code{unref()} @item void unref(NODE *n) This macro releases the memory associated with a @code{NODE} allocated with @code{make_string} or @code{make_number}. Understanding of @command{gawk} memory management is helpful. @cindex @code{make_builtin()} internal function +@cindex internal function, @code{make_builtin()} @item void make_builtin(const char *name, NODE *(*func)(NODE *), int count) Register a C function pointed to by @code{func} as new built-in function @code{name}. @code{name} is a regular C string. @code{count} @@ -28363,12 +28398,14 @@ do_xxx(int nargs) @cindex arguments, retrieving @cindex @code{get_argument()} internal function +@cindex internal function, @code{get_argument()} @item NODE *get_argument(int i) This function is called from within a C extension function to get the @code{i}-th argument from the function call. The first argument is argument zero. @cindex @code{get_actual_argument()} internal function +@cindex internal function, @code{get_actual_argument()} @item NODE *get_actual_argument(int i, @itemx @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ int@ optional,@ int@ wantarray); This function retrieves a particular argument @code{i}. @code{wantarray} is @code{TRUE} @@ -28378,10 +28415,12 @@ value is @code{NULL}. It is a fatal error if @code{optional} is @code{TRUE} but the argument was not provided. @cindex @code{get_scalar_argument()} internal macro +@cindex internal macro, @code{get_scalar_argument()} @item get_scalar_argument(i, opt) This is a convenience macro that calls @code{get_actual_argument()}. @cindex @code{get_array_argument()} internal macro +@cindex internal macro, @code{get_array_argument()} @item get_array_argument(i, opt) This is a convenience macro that calls @code{get_actual_argument()}. @@ -28389,6 +28428,7 @@ This is a convenience macro that calls @code{get_actual_argument()}. @cindex @code{ERRNO} variable @cindex @code{update_ERRNO()} internal function +@cindex internal function, @code{update_ERRNO()} @item void update_ERRNO(void) This function is called from within a C extension function to set the value of @command{gawk}'s @code{ERRNO} variable, based on the current @@ -28397,15 +28437,17 @@ It is provided as a convenience. @cindex @code{ERRNO} variable @cindex @code{update_ERRNO_saved()} internal function +@cindex internal function, @code{update_ERRNO_saved()} @item void update_ERRNO_saved(int errno_saved) This function is called from within a C extension function to set the value of @command{gawk}'s @code{ERRNO} variable, based on the saved value of the C @code{errno} variable provided as the argument. It is provided as a convenience. -@cindex @code{ENVIRON} variable -@cindex @code{PROCINFO} variable +@cindex @code{ENVIRON} array +@cindex @code{PROCINFO} array @cindex @code{register_deferred_variable()} internal function +@cindex internal function, @code{register_deferred_variable()} @item void register_deferred_variable(const char *name, NODE *(*load_func)(void)) This function is called to register a function to be called when a reference to an undefined variable with the given name is encountered. @@ -28414,16 +28456,21 @@ so, unless the calling code is running at program startup, it should first check whether a variable of the given name already exists. The argument function must return a pointer to a @code{NODE} containing the newly created variable. This function is used to implement the builtin -@code{ENVIRON} and @code{PROCINFO} variables, so you can refer to them +@code{ENVIRON} and @code{PROCINFO} arrays, so you can refer to them for examples. @cindex @code{IOBUF} internal structure +@cindex internal structure, @code{IOBUF} @cindex @code{iop_alloc()} internal function +@cindex internal function, @code{iop_alloc()} @cindex @code{get_record()} input method @cindex @code{close_func}() input method @cindex @code{INVALID_HANDLE} internal constant -@cindex XML +@cindex internal constant, @code{INVALID_HANDLE} +@cindex XML (eXtensible Markup Language) +@cindex eXtensible Markup Language (XML) @cindex @code{register_open_hook()} internal function +@cindex internal function, @code{register_open_hook()} @item void register_open_hook(void *(*open_func)(IOBUF *)) This function is called to register a function to be called whenever a new data file is opened, leading to the creation of an @code{IOBUF} @@ -28950,7 +28997,7 @@ I think that would be fine. Larry @end ignore -@cindex PERL +@cindex Perl @cindex Wall, Larry @cindex Robbins, Arnold @quotation diff --git a/extension/ChangeLog b/extension/ChangeLog index 19cfbee0..926bf0b5 100644 --- a/extension/ChangeLog +++ b/extension/ChangeLog @@ -1,3 +1,8 @@ +Thu Jan 13 20:37:02 2011 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * filefuncs.c (do_stat): Malloc the buffer to read the contents + of the link. From mail of June 21, 2005. + Sun Jan 2 21:08:17 2011 Arnold D. Robbins <arnold@skeeve.com> * filefuncs.c: Synched with code in gawk.texi, copyright dates diff --git a/extension/filefuncs.c b/extension/filefuncs.c index 46873f1f..7efa912e 100644 --- a/extension/filefuncs.c +++ b/extension/filefuncs.c @@ -264,18 +264,21 @@ do_stat(int nargs) /* for symbolic links, add a linkval field */ if (S_ISLNK(sbuf.st_mode)) { - char buf[BUFSIZ*2]; + char *buf; int linksize; - linksize = readlink(file->stptr, buf, sizeof(buf) - 1); - if (linksize >= 0) { - /* should make this smarter */ - if (linksize >= sizeof(buf) - 1) - fatal("size of symbolic link too big"); + emalloc(buf, char *, sbuf.st_size + 2, "do_stat"); + if (((linksize = readlink(file->stptr, buf, + sbuf.st_size + 2)) >= 0) && + (linksize <= sbuf.st_size)) { + /* + * set the linkval field only if we are able to + * retrieve the entire link value successfully. + */ buf[linksize] = '\0'; aptr = assoc_lookup(array, tmp = make_string("linkval", 7), FALSE); - *aptr = make_string(buf, linksize); + *aptr = make_str_node(buf, linksize, ALREADY_MALLOCED); unref(tmp); } } |