From: Arkadiusz Miśkiewicz Date: Wed, 10 Oct 2018 13:54:17 +0000 (+0200) Subject: - rel 2; upstream fixes used in fc X-Git-Tag: auto/th/gawk-4.2.1-2 X-Git-Url: http://git.pld-linux.org/?p=packages%2Fgawk.git;a=commitdiff_plain;h=9169c9b5e3474b67bf3f12b8d048207e707ff446 - rel 2; upstream fixes used in fc --- diff --git a/gawk-4.2.1-000-add-support-for-a-and-A-in-printf.patch b/gawk-4.2.1-000-add-support-for-a-and-A-in-printf.patch new file mode 100644 index 0000000..eff117b --- /dev/null +++ b/gawk-4.2.1-000-add-support-for-a-and-A-in-printf.patch @@ -0,0 +1,1321 @@ +From 51e6897a1dc72dd5e39921e8a1c8fa4efb568ca6 Mon Sep 17 00:00:00 2001 +From: "Arnold D. Robbins" +Date: Thu, 22 Mar 2018 18:37:52 +0200 +Subject: [PATCH] Add support for %a and %A in printf. + +--- + NEWS | 5 + + builtin.c | 31 +- + configh.in | 3 + + configure | 42 +++ + configure.ac | 28 ++ + doc/awkcard.in | 1 + + doc/gawk.1 | 12 +- + doc/gawk.info | 925 ++++++++++++++++++++++++++++---------------------------- + doc/gawk.texi | 19 ++ + doc/gawktexi.in | 19 ++ + doc/wordlist | 2 + + doc/wordlist2 | 1 + + pc/config.h | 3 + + pc/config.sed | 2 + + 14 files changed, 631 insertions(+), 462 deletions(-) + +diff --git a/NEWS b/NEWS +index c2885c8..71d9608 100644 +--- a/NEWS ++++ b/NEWS +@@ -5,6 +5,11 @@ + are permitted in any medium without royalty provided the copyright + notice and this notice are preserved. + ++Changes from 4.2.1 to 4.2.2 ++--------------------------- ++ ++1. Support for the POSIX standard %a and %A formats has been added. ++ + Changes from 4.2.0 to 4.2.1 + --------------------------- + +diff --git a/builtin.c b/builtin.c +index 6927205..c54be9b 100644 +--- a/builtin.c ++++ b/builtin.c +@@ -1493,6 +1493,17 @@ mpf1: + case 'e': + case 'f': + case 'E': ++#if defined(PRINTF_HAS_A_FORMAT) && PRINTF_HAS_A_FORMAT == 1 ++ case 'A': ++ case 'a': ++ { ++ static bool warned = false; ++ if (do_lint && tolower(cs1) == 'a' && ! warned) { ++ warned = true; ++ lintwarn(_("%%%c format is POSIX standard but not portable to other awks"), cs1); ++ } ++ } ++#endif + need_format = false; + parse_next_arg(); + (void) force_number(arg); +@@ -1557,11 +1568,21 @@ mpf1: + break; + #endif + default: +- sprintf(cp, "*.*%c", cs1); +- while ((nc = snprintf(obufout, ofre, cpbuf, +- (int) fw, (int) prec, +- (double) tmpval)) >= ofre) +- chksize(nc) ++ if (have_prec || tolower(cs1) != 'a') { ++ sprintf(cp, "*.*%c", cs1); ++ while ((nc = snprintf(obufout, ofre, cpbuf, ++ (int) fw, (int) prec, ++ (double) tmpval)) >= ofre) ++ chksize(nc) ++ } else { ++ // For %a and %A, use the default precision if it ++ // wasn't supplied by the user. ++ sprintf(cp, "*%c", cs1); ++ while ((nc = snprintf(obufout, ofre, cpbuf, ++ (int) fw, ++ (double) tmpval)) >= ofre) ++ chksize(nc) ++ } + } + + #if defined(LC_NUMERIC) +diff --git a/configh.in b/configh.in +index e600005..8c4d94d 100644 +--- a/configh.in ++++ b/configh.in +@@ -368,6 +368,9 @@ + /* Define to the version of this package. */ + #undef PACKAGE_VERSION + ++/* Define to 1 if *printf supports %a format */ ++#undef PRINTF_HAS_A_FORMAT ++ + /* Define to 1 if *printf supports %F format */ + #undef PRINTF_HAS_F_FORMAT + +diff --git a/configure b/configure +index 2283f09..f492a75 100755 +--- a/configure ++++ b/configure +@@ -10210,6 +10210,48 @@ fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $has_f_format" >&5 + $as_echo "$has_f_format" >&6; } + ++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for printf %a format" >&5 ++$as_echo_n "checking for printf %a format... " >&6; } ++if test "$cross_compiling" = yes; then : ++ has_a_format=no ++else ++ cat confdefs.h - <<_ACEOF >conftest.$ac_ext ++/* end confdefs.h. */ ++ ++ ++#include ++ ++int main() ++{ ++ char buf[100]; ++ ++ sprintf(buf, "%a", 8.0); ++ ++ if (strncmp(buf, "0x", 2) == 0) ++ return 0; ++ else ++ return 1; ++} ++ ++_ACEOF ++if ac_fn_c_try_run "$LINENO"; then : ++ has_a_format=yes ++else ++ has_a_format=no ++fi ++rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ ++ conftest.$ac_objext conftest.beam conftest.$ac_ext ++fi ++ ++if test "$has_a_format" = yes ++then ++ ++$as_echo "#define PRINTF_HAS_A_FORMAT 1" >>confdefs.h ++ ++fi ++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $has_a_format" >&5 ++$as_echo "$has_a_format" >&6; } ++ + + gawk_have_sockets=no + # Check for system-dependent location of socket libraries +diff --git a/configure.ac b/configure.ac +index f45c710..a4817ee 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -395,6 +395,34 @@ then + fi + AC_MSG_RESULT($has_f_format) + ++dnl check for printf %a format ++AC_MSG_CHECKING([for printf %a format]) ++AC_RUN_IFELSE([ ++AC_LANG_SOURCE([ ++#include ++ ++int main() ++{ ++ char buf[[100]]; ++ ++ sprintf(buf, "%a", 8.0); ++ ++ if (strncmp(buf, "0x", 2) == 0) ++ return 0; ++ else ++ return 1; ++} ++])], ++ has_a_format=yes, ++ has_a_format=no, ++ has_a_format=no dnl Cross-compiling, assuming the worst. ++) ++if test "$has_a_format" = yes ++then ++ AC_DEFINE(PRINTF_HAS_A_FORMAT, 1, [Define to 1 if *printf supports %a format]) ++fi ++AC_MSG_RESULT($has_a_format) ++ + dnl check for sockets + GAWK_AC_LIB_SOCKETS + +diff --git a/doc/awkcard.in b/doc/awkcard.in +index 1148294..d4df342 100644 +--- a/doc/awkcard.in ++++ b/doc/awkcard.in +@@ -1431,6 +1431,7 @@ the error.\*(CX + accept the following conversion specification formats: + .sp .5 + .nf ++\*(CB\*(FC%a\fP, \*(FC%A\fP A C99 floating point hexadecimal number\*(CD + \*(FC%c\fP An \s-1ASCII\s+1 character + \*(FC%d\fP, \*(FC%i\fP A decimal number (the integer part) + \*(FC%e\fP A floating point number of the form +diff --git a/doc/gawk.1 b/doc/gawk.1 +index 16762a8..48c07b7 100644 +--- a/doc/gawk.1 ++++ b/doc/gawk.1 +@@ -13,7 +13,7 @@ + . if \w'\(rq' .ds rq "\(rq + . \} + .\} +-.TH GAWK 1 "Feb 15 2018" "Free Software Foundation" "Utility Commands" ++.TH GAWK 1 "Mar 22 2018" "Free Software Foundation" "Utility Commands" + .SH NAME + gawk \- pattern scanning and processing language + .SH SYNOPSIS +@@ -1264,7 +1264,7 @@ behavior: + \fBPROCINFO["NONFATAL"]\fR + If this exists, then I/O errors for all redirections become nonfatal. + .TP +-\fBPROCINFO["\fname\fB", "NONFATAL"]\fR ++\fBPROCINFO["\fIname\fB", "NONFATAL"]\fR + Make I/O errors for + .I name + be nonfatal. +@@ -2429,6 +2429,14 @@ function + (see below) + accept the following conversion specification formats: + .TP "\w'\fB%g\fR, \fB%G\fR'u+2n" ++.BR "%a" "," " %A" ++A floating point number of the form ++[\fB\-\fP]\fB0x\fIh\fB.\fIhhhh\fBp+\-\fIdd\fR ++(C99 hexadecimal floating point format). ++For ++.BR %A , ++uppercase letters are used instead of lowercase ones. ++.TP + .B %c + A single character. + If the argument used for +diff --git a/doc/gawk.info b/doc/gawk.info +index 738de09..c01e43b 100644 +--- a/doc/gawk.info ++++ b/doc/gawk.info +@@ -6614,6 +6614,21 @@ print. The rest of the format specifier is made up of optional + "modifiers" that control _how_ to print the value, such as the field + width. Here is a list of the format-control letters: + ++'%a', '%A' ++ A floating point number of the form ['-']'0xH.HHHHp+-DD' (C99 ++ hexadecimal floating point format). For '%A', uppercase letters ++ are used instead of lowercase ones. ++ ++ NOTE: While the current POSIX standard requires support for ++ '%a' and '%A' in 'awk', as far as we know, no other version of ++ 'awk' actually implements it. It's use is thus highly ++ nonportable! ++ ++ Furthermore, these formats are not available on any system ++ where the underlying C library 'printf()' function does not ++ support them. As of this writing, among current systems, only ++ OpenVMS is known to not support them. ++ + '%c' + Print a number as a character; thus, 'printf "%c", 65' outputs the + letter 'A'. The output for a string value is the first character +@@ -33759,9 +33774,9 @@ Index + * dark corner, FILENAME variable: Getline Notes. (line 19) + * dark corner, FILENAME variable <1>: Auto-set. (line 108) + * dark corner, FNR/NR variables: Auto-set. (line 389) +-* dark corner, format-control characters: Control Letters. (line 18) ++* dark corner, format-control characters: Control Letters. (line 33) + * dark corner, format-control characters <1>: Control Letters. +- (line 93) ++ (line 108) + * dark corner, FS as null string: Single Character Fields. + (line 20) + * dark corner, input files: awk split records. (line 110) +@@ -34459,8 +34474,8 @@ Index + * gawk, FIELDWIDTHS variable in: Fixed width data. (line 17) + * gawk, FIELDWIDTHS variable in <1>: User-modified. (line 37) + * gawk, file names in: Special Files. (line 6) +-* gawk, format-control characters: Control Letters. (line 18) +-* gawk, format-control characters <1>: Control Letters. (line 93) ++* gawk, format-control characters: Control Letters. (line 33) ++* gawk, format-control characters <1>: Control Letters. (line 108) + * gawk, FPAT variable in: Splitting By Content. + (line 25) + * gawk, FPAT variable in <1>: User-modified. (line 46) +@@ -36129,456 +36144,456 @@ Node: OFMT288591 + Node: Printf289947 + Node: Basic Printf290732 + Node: Control Letters292306 +-Node: Format Modifiers296302 +-Node: Printf Examples302317 +-Node: Redirection304803 +-Node: Special FD311644 +-Ref: Special FD-Footnote-1314812 +-Node: Special Files314886 +-Node: Other Inherited Files315503 +-Node: Special Network316504 +-Node: Special Caveats317364 +-Node: Close Files And Pipes318313 +-Ref: table-close-pipe-return-values325220 +-Ref: Close Files And Pipes-Footnote-1326033 +-Ref: Close Files And Pipes-Footnote-2326181 +-Node: Nonfatal326333 +-Node: Output Summary328671 +-Node: Output Exercises329893 +-Node: Expressions330572 +-Node: Values331760 +-Node: Constants332438 +-Node: Scalar Constants333129 +-Ref: Scalar Constants-Footnote-1333993 +-Node: Nondecimal-numbers334243 +-Node: Regexp Constants337244 +-Node: Using Constant Regexps337770 +-Node: Standard Regexp Constants338392 +-Node: Strong Regexp Constants341580 +-Node: Variables344538 +-Node: Using Variables345195 +-Node: Assignment Options347105 +-Node: Conversion348978 +-Node: Strings And Numbers349502 +-Ref: Strings And Numbers-Footnote-1352565 +-Node: Locale influences conversions352674 +-Ref: table-locale-affects355432 +-Node: All Operators356050 +-Node: Arithmetic Ops356679 +-Node: Concatenation359185 +-Ref: Concatenation-Footnote-1362032 +-Node: Assignment Ops362139 +-Ref: table-assign-ops367130 +-Node: Increment Ops368443 +-Node: Truth Values and Conditions371903 +-Node: Truth Values372977 +-Node: Typing and Comparison374025 +-Node: Variable Typing374845 +-Ref: Variable Typing-Footnote-1381308 +-Ref: Variable Typing-Footnote-2381380 +-Node: Comparison Operators381457 +-Ref: table-relational-ops381876 +-Node: POSIX String Comparison385371 +-Ref: POSIX String Comparison-Footnote-1387066 +-Ref: POSIX String Comparison-Footnote-2387205 +-Node: Boolean Ops387289 +-Ref: Boolean Ops-Footnote-1391771 +-Node: Conditional Exp391863 +-Node: Function Calls393599 +-Node: Precedence397476 +-Node: Locales401135 +-Node: Expressions Summary402767 +-Node: Patterns and Actions405340 +-Node: Pattern Overview406460 +-Node: Regexp Patterns408137 +-Node: Expression Patterns408679 +-Node: Ranges412460 +-Node: BEGIN/END415568 +-Node: Using BEGIN/END416329 +-Ref: Using BEGIN/END-Footnote-1419065 +-Node: I/O And BEGIN/END419171 +-Node: BEGINFILE/ENDFILE421485 +-Node: Empty424398 +-Node: Using Shell Variables424715 +-Node: Action Overview426989 +-Node: Statements429314 +-Node: If Statement431162 +-Node: While Statement432657 +-Node: Do Statement434685 +-Node: For Statement435833 +-Node: Switch Statement439004 +-Node: Break Statement441390 +-Node: Continue Statement443482 +-Node: Next Statement445309 +-Node: Nextfile Statement447692 +-Node: Exit Statement450344 +-Node: Built-in Variables452747 +-Node: User-modified453880 +-Node: Auto-set461647 +-Ref: Auto-set-Footnote-1477946 +-Ref: Auto-set-Footnote-2478152 +-Node: ARGC and ARGV478208 +-Node: Pattern Action Summary482421 +-Node: Arrays484851 +-Node: Array Basics486180 +-Node: Array Intro487024 +-Ref: figure-array-elements488999 +-Ref: Array Intro-Footnote-1491703 +-Node: Reference to Elements491831 +-Node: Assigning Elements494295 +-Node: Array Example494786 +-Node: Scanning an Array496545 +-Node: Controlling Scanning499567 +-Ref: Controlling Scanning-Footnote-1504966 +-Node: Numeric Array Subscripts505282 +-Node: Uninitialized Subscripts507466 +-Node: Delete509085 +-Ref: Delete-Footnote-1511837 +-Node: Multidimensional511894 +-Node: Multiscanning514989 +-Node: Arrays of Arrays516580 +-Node: Arrays Summary521347 +-Node: Functions523440 +-Node: Built-in524478 +-Node: Calling Built-in525559 +-Node: Numeric Functions527555 +-Ref: Numeric Functions-Footnote-1531583 +-Ref: Numeric Functions-Footnote-2531940 +-Ref: Numeric Functions-Footnote-3531988 +-Node: String Functions532260 +-Ref: String Functions-Footnote-1555918 +-Ref: String Functions-Footnote-2556046 +-Ref: String Functions-Footnote-3556294 +-Node: Gory Details556381 +-Ref: table-sub-escapes558172 +-Ref: table-sub-proposed559691 +-Ref: table-posix-sub561054 +-Ref: table-gensub-escapes562595 +-Ref: Gory Details-Footnote-1563418 +-Node: I/O Functions563572 +-Ref: table-system-return-values570040 +-Ref: I/O Functions-Footnote-1572020 +-Ref: I/O Functions-Footnote-2572168 +-Node: Time Functions572288 +-Ref: Time Functions-Footnote-1582959 +-Ref: Time Functions-Footnote-2583027 +-Ref: Time Functions-Footnote-3583185 +-Ref: Time Functions-Footnote-4583296 +-Ref: Time Functions-Footnote-5583408 +-Ref: Time Functions-Footnote-6583635 +-Node: Bitwise Functions583901 +-Ref: table-bitwise-ops584495 +-Ref: Bitwise Functions-Footnote-1590540 +-Ref: Bitwise Functions-Footnote-2590713 +-Node: Type Functions590904 +-Node: I18N Functions593655 +-Node: User-defined595306 +-Node: Definition Syntax596111 +-Ref: Definition Syntax-Footnote-1601798 +-Node: Function Example601869 +-Ref: Function Example-Footnote-1604791 +-Node: Function Caveats604813 +-Node: Calling A Function605331 +-Node: Variable Scope606289 +-Node: Pass By Value/Reference609283 +-Node: Return Statement612782 +-Node: Dynamic Typing615761 +-Node: Indirect Calls616691 +-Ref: Indirect Calls-Footnote-1626943 +-Node: Functions Summary627071 +-Node: Library Functions629776 +-Ref: Library Functions-Footnote-1633383 +-Ref: Library Functions-Footnote-2633526 +-Node: Library Names633697 +-Ref: Library Names-Footnote-1637157 +-Ref: Library Names-Footnote-2637380 +-Node: General Functions637466 +-Node: Strtonum Function638569 +-Node: Assert Function641591 +-Node: Round Function644917 +-Node: Cliff Random Function646457 +-Node: Ordinal Functions647473 +-Ref: Ordinal Functions-Footnote-1650536 +-Ref: Ordinal Functions-Footnote-2650788 +-Node: Join Function650998 +-Ref: Join Function-Footnote-1652768 +-Node: Getlocaltime Function652968 +-Node: Readfile Function656710 +-Node: Shell Quoting658687 +-Node: Data File Management660088 +-Node: Filetrans Function660720 +-Node: Rewind Function664816 +-Node: File Checking666726 +-Ref: File Checking-Footnote-1668060 +-Node: Empty Files668261 +-Node: Ignoring Assigns670240 +-Node: Getopt Function671790 +-Ref: Getopt Function-Footnote-1683259 +-Node: Passwd Functions683459 +-Ref: Passwd Functions-Footnote-1692298 +-Node: Group Functions692386 +-Ref: Group Functions-Footnote-1700284 +-Node: Walking Arrays700491 +-Node: Library Functions Summary703499 +-Node: Library Exercises704905 +-Node: Sample Programs705370 +-Node: Running Examples706140 +-Node: Clones706868 +-Node: Cut Program708092 +-Node: Egrep Program718021 +-Ref: Egrep Program-Footnote-1725533 +-Node: Id Program725643 +-Node: Split Program729323 +-Ref: Split Program-Footnote-1732781 +-Node: Tee Program732910 +-Node: Uniq Program735700 +-Node: Wc Program743126 +-Ref: Wc Program-Footnote-1747381 +-Node: Miscellaneous Programs747475 +-Node: Dupword Program748688 +-Node: Alarm Program750718 +-Node: Translate Program755573 +-Ref: Translate Program-Footnote-1760138 +-Node: Labels Program760408 +-Ref: Labels Program-Footnote-1763759 +-Node: Word Sorting763843 +-Node: History Sorting767915 +-Node: Extract Program769750 +-Node: Simple Sed777280 +-Node: Igawk Program780354 +-Ref: Igawk Program-Footnote-1794685 +-Ref: Igawk Program-Footnote-2794887 +-Ref: Igawk Program-Footnote-3795009 +-Node: Anagram Program795124 +-Node: Signature Program798186 +-Node: Programs Summary799433 +-Node: Programs Exercises800647 +-Ref: Programs Exercises-Footnote-1804776 +-Node: Advanced Features804867 +-Node: Nondecimal Data806857 +-Node: Array Sorting808448 +-Node: Controlling Array Traversal809148 +-Ref: Controlling Array Traversal-Footnote-1817516 +-Node: Array Sorting Functions817634 +-Ref: Array Sorting Functions-Footnote-1822725 +-Node: Two-way I/O822921 +-Ref: Two-way I/O-Footnote-1829473 +-Ref: Two-way I/O-Footnote-2829660 +-Node: TCP/IP Networking829742 +-Node: Profiling832860 +-Ref: Profiling-Footnote-1841532 +-Node: Advanced Features Summary841855 +-Node: Internationalization843699 +-Node: I18N and L10N845179 +-Node: Explaining gettext845866 +-Ref: Explaining gettext-Footnote-1851758 +-Ref: Explaining gettext-Footnote-2851943 +-Node: Programmer i18n852108 +-Ref: Programmer i18n-Footnote-1857057 +-Node: Translator i18n857106 +-Node: String Extraction857900 +-Ref: String Extraction-Footnote-1859032 +-Node: Printf Ordering859118 +-Ref: Printf Ordering-Footnote-1861904 +-Node: I18N Portability861968 +-Ref: I18N Portability-Footnote-1864424 +-Node: I18N Example864487 +-Ref: I18N Example-Footnote-1867293 +-Node: Gawk I18N867366 +-Node: I18N Summary868011 +-Node: Debugger869352 +-Node: Debugging870375 +-Node: Debugging Concepts870816 +-Node: Debugging Terms872625 +-Node: Awk Debugging875200 +-Node: Sample Debugging Session876106 +-Node: Debugger Invocation876640 +-Node: Finding The Bug878026 +-Node: List of Debugger Commands884504 +-Node: Breakpoint Control885837 +-Node: Debugger Execution Control889531 +-Node: Viewing And Changing Data892893 +-Node: Execution Stack896267 +-Node: Debugger Info897904 +-Node: Miscellaneous Debugger Commands901975 +-Node: Readline Support907037 +-Node: Limitations907933 +-Node: Debugging Summary910042 +-Node: Arbitrary Precision Arithmetic911321 +-Node: Computer Arithmetic912806 +-Ref: table-numeric-ranges916572 +-Ref: table-floating-point-ranges917065 +-Ref: Computer Arithmetic-Footnote-1917723 +-Node: Math Definitions917780 +-Ref: table-ieee-formats921096 +-Ref: Math Definitions-Footnote-1921699 +-Node: MPFR features921804 +-Node: FP Math Caution923522 +-Ref: FP Math Caution-Footnote-1924594 +-Node: Inexactness of computations924963 +-Node: Inexact representation925923 +-Node: Comparing FP Values927283 +-Node: Errors accumulate928365 +-Node: Getting Accuracy929798 +-Node: Try To Round932508 +-Node: Setting precision933407 +-Ref: table-predefined-precision-strings934104 +-Node: Setting the rounding mode935934 +-Ref: table-gawk-rounding-modes936308 +-Ref: Setting the rounding mode-Footnote-1940239 +-Node: Arbitrary Precision Integers940418 +-Ref: Arbitrary Precision Integers-Footnote-1943593 +-Node: Checking for MPFR943742 +-Node: POSIX Floating Point Problems945216 +-Ref: POSIX Floating Point Problems-Footnote-1949087 +-Node: Floating point summary949125 +-Node: Dynamic Extensions951315 +-Node: Extension Intro952868 +-Node: Plugin License954134 +-Node: Extension Mechanism Outline954931 +-Ref: figure-load-extension955370 +-Ref: figure-register-new-function956935 +-Ref: figure-call-new-function958027 +-Node: Extension API Description960089 +-Node: Extension API Functions Introduction961731 +-Node: General Data Types967271 +-Ref: General Data Types-Footnote-1975632 +-Node: Memory Allocation Functions975931 +-Ref: Memory Allocation Functions-Footnote-1980141 +-Node: Constructor Functions980240 +-Node: Registration Functions983826 +-Node: Extension Functions984511 +-Node: Exit Callback Functions989726 +-Node: Extension Version String990976 +-Node: Input Parsers991639 +-Node: Output Wrappers1004360 +-Node: Two-way processors1008872 +-Node: Printing Messages1011137 +-Ref: Printing Messages-Footnote-11012308 +-Node: Updating ERRNO1012461 +-Node: Requesting Values1013200 +-Ref: table-value-types-returned1013937 +-Node: Accessing Parameters1014873 +-Node: Symbol Table Access1016108 +-Node: Symbol table by name1016620 +-Node: Symbol table by cookie1018409 +-Ref: Symbol table by cookie-Footnote-11022594 +-Node: Cached values1022658 +-Ref: Cached values-Footnote-11026194 +-Node: Array Manipulation1026347 +-Ref: Array Manipulation-Footnote-11027438 +-Node: Array Data Types1027475 +-Ref: Array Data Types-Footnote-11030133 +-Node: Array Functions1030225 +-Node: Flattening Arrays1034723 +-Node: Creating Arrays1041699 +-Node: Redirection API1046466 +-Node: Extension API Variables1049299 +-Node: Extension Versioning1050010 +-Ref: gawk-api-version1050439 +-Node: Extension GMP/MPFR Versioning1052170 +-Node: Extension API Informational Variables1053798 +-Node: Extension API Boilerplate1054871 +-Node: Changes from API V11058845 +-Node: Finding Extensions1060417 +-Node: Extension Example1060976 +-Node: Internal File Description1061774 +-Node: Internal File Ops1065854 +-Ref: Internal File Ops-Footnote-11077204 +-Node: Using Internal File Ops1077344 +-Ref: Using Internal File Ops-Footnote-11079727 +-Node: Extension Samples1080001 +-Node: Extension Sample File Functions1081530 +-Node: Extension Sample Fnmatch1089179 +-Node: Extension Sample Fork1090666 +-Node: Extension Sample Inplace1091884 +-Node: Extension Sample Ord1095101 +-Node: Extension Sample Readdir1095937 +-Ref: table-readdir-file-types1096826 +-Node: Extension Sample Revout1097631 +-Node: Extension Sample Rev2way1098220 +-Node: Extension Sample Read write array1098960 +-Node: Extension Sample Readfile1100902 +-Node: Extension Sample Time1101997 +-Node: Extension Sample API Tests1103345 +-Node: gawkextlib1103837 +-Node: Extension summary1106755 +-Node: Extension Exercises1110457 +-Node: Language History1111955 +-Node: V7/SVR3.11113611 +-Node: SVR41115763 +-Node: POSIX1117197 +-Node: BTL1118577 +-Node: POSIX/GNU1119306 +-Node: Feature History1125084 +-Node: Common Extensions1140943 +-Node: Ranges and Locales1142226 +-Ref: Ranges and Locales-Footnote-11146842 +-Ref: Ranges and Locales-Footnote-21146869 +-Ref: Ranges and Locales-Footnote-31147104 +-Node: Contributors1147325 +-Node: History summary1153270 +-Node: Installation1154650 +-Node: Gawk Distribution1155594 +-Node: Getting1156078 +-Node: Extracting1157041 +-Node: Distribution contents1158679 +-Node: Unix Installation1165159 +-Node: Quick Installation1165841 +-Node: Shell Startup Files1168255 +-Node: Additional Configuration Options1169344 +-Node: Configuration Philosophy1171637 +-Node: Non-Unix Installation1174006 +-Node: PC Installation1174466 +-Node: PC Binary Installation1175304 +-Node: PC Compiling1175739 +-Node: PC Using1176856 +-Node: Cygwin1180071 +-Node: MSYS1181170 +-Node: VMS Installation1181671 +-Node: VMS Compilation1182462 +-Ref: VMS Compilation-Footnote-11183691 +-Node: VMS Dynamic Extensions1183749 +-Node: VMS Installation Details1185434 +-Node: VMS Running1187687 +-Node: VMS GNV1191966 +-Node: VMS Old Gawk1192701 +-Node: Bugs1193172 +-Node: Bug address1193835 +-Node: Usenet1196627 +-Node: Maintainers1197404 +-Node: Other Versions1198665 +-Node: Installation summary1205427 +-Node: Notes1206629 +-Node: Compatibility Mode1207494 +-Node: Additions1208276 +-Node: Accessing The Source1209201 +-Node: Adding Code1210638 +-Node: New Ports1216857 +-Node: Derived Files1221345 +-Ref: Derived Files-Footnote-11226991 +-Ref: Derived Files-Footnote-21227026 +-Ref: Derived Files-Footnote-31227624 +-Node: Future Extensions1227738 +-Node: Implementation Limitations1228396 +-Node: Extension Design1229579 +-Node: Old Extension Problems1230733 +-Ref: Old Extension Problems-Footnote-11232251 +-Node: Extension New Mechanism Goals1232308 +-Ref: Extension New Mechanism Goals-Footnote-11235672 +-Node: Extension Other Design Decisions1235861 +-Node: Extension Future Growth1237974 +-Node: Old Extension Mechanism1238810 +-Node: Notes summary1240573 +-Node: Basic Concepts1241755 +-Node: Basic High Level1242436 +-Ref: figure-general-flow1242718 +-Ref: figure-process-flow1243403 +-Ref: Basic High Level-Footnote-11246704 +-Node: Basic Data Typing1246889 +-Node: Glossary1250217 +-Node: Copying1282055 +-Node: GNU Free Documentation License1319598 +-Node: Index1344718 ++Node: Format Modifiers296985 ++Node: Printf Examples303000 ++Node: Redirection305486 ++Node: Special FD312327 ++Ref: Special FD-Footnote-1315495 ++Node: Special Files315569 ++Node: Other Inherited Files316186 ++Node: Special Network317187 ++Node: Special Caveats318047 ++Node: Close Files And Pipes318996 ++Ref: table-close-pipe-return-values325903 ++Ref: Close Files And Pipes-Footnote-1326716 ++Ref: Close Files And Pipes-Footnote-2326864 ++Node: Nonfatal327016 ++Node: Output Summary329354 ++Node: Output Exercises330576 ++Node: Expressions331255 ++Node: Values332443 ++Node: Constants333121 ++Node: Scalar Constants333812 ++Ref: Scalar Constants-Footnote-1334676 ++Node: Nondecimal-numbers334926 ++Node: Regexp Constants337927 ++Node: Using Constant Regexps338453 ++Node: Standard Regexp Constants339075 ++Node: Strong Regexp Constants342263 ++Node: Variables345221 ++Node: Using Variables345878 ++Node: Assignment Options347788 ++Node: Conversion349661 ++Node: Strings And Numbers350185 ++Ref: Strings And Numbers-Footnote-1353248 ++Node: Locale influences conversions353357 ++Ref: table-locale-affects356115 ++Node: All Operators356733 ++Node: Arithmetic Ops357362 ++Node: Concatenation359868 ++Ref: Concatenation-Footnote-1362715 ++Node: Assignment Ops362822 ++Ref: table-assign-ops367813 ++Node: Increment Ops369126 ++Node: Truth Values and Conditions372586 ++Node: Truth Values373660 ++Node: Typing and Comparison374708 ++Node: Variable Typing375528 ++Ref: Variable Typing-Footnote-1381991 ++Ref: Variable Typing-Footnote-2382063 ++Node: Comparison Operators382140 ++Ref: table-relational-ops382559 ++Node: POSIX String Comparison386054 ++Ref: POSIX String Comparison-Footnote-1387749 ++Ref: POSIX String Comparison-Footnote-2387888 ++Node: Boolean Ops387972 ++Ref: Boolean Ops-Footnote-1392454 ++Node: Conditional Exp392546 ++Node: Function Calls394282 ++Node: Precedence398159 ++Node: Locales401818 ++Node: Expressions Summary403450 ++Node: Patterns and Actions406023 ++Node: Pattern Overview407143 ++Node: Regexp Patterns408820 ++Node: Expression Patterns409362 ++Node: Ranges413143 ++Node: BEGIN/END416251 ++Node: Using BEGIN/END417012 ++Ref: Using BEGIN/END-Footnote-1419748 ++Node: I/O And BEGIN/END419854 ++Node: BEGINFILE/ENDFILE422168 ++Node: Empty425081 ++Node: Using Shell Variables425398 ++Node: Action Overview427672 ++Node: Statements429997 ++Node: If Statement431845 ++Node: While Statement433340 ++Node: Do Statement435368 ++Node: For Statement436516 ++Node: Switch Statement439687 ++Node: Break Statement442073 ++Node: Continue Statement444165 ++Node: Next Statement445992 ++Node: Nextfile Statement448375 ++Node: Exit Statement451027 ++Node: Built-in Variables453430 ++Node: User-modified454563 ++Node: Auto-set462330 ++Ref: Auto-set-Footnote-1478629 ++Ref: Auto-set-Footnote-2478835 ++Node: ARGC and ARGV478891 ++Node: Pattern Action Summary483104 ++Node: Arrays485534 ++Node: Array Basics486863 ++Node: Array Intro487707 ++Ref: figure-array-elements489682 ++Ref: Array Intro-Footnote-1492386 ++Node: Reference to Elements492514 ++Node: Assigning Elements494978 ++Node: Array Example495469 ++Node: Scanning an Array497228 ++Node: Controlling Scanning500250 ++Ref: Controlling Scanning-Footnote-1505649 ++Node: Numeric Array Subscripts505965 ++Node: Uninitialized Subscripts508149 ++Node: Delete509768 ++Ref: Delete-Footnote-1512520 ++Node: Multidimensional512577 ++Node: Multiscanning515672 ++Node: Arrays of Arrays517263 ++Node: Arrays Summary522030 ++Node: Functions524123 ++Node: Built-in525161 ++Node: Calling Built-in526242 ++Node: Numeric Functions528238 ++Ref: Numeric Functions-Footnote-1532266 ++Ref: Numeric Functions-Footnote-2532623 ++Ref: Numeric Functions-Footnote-3532671 ++Node: String Functions532943 ++Ref: String Functions-Footnote-1556601 ++Ref: String Functions-Footnote-2556729 ++Ref: String Functions-Footnote-3556977 ++Node: Gory Details557064 ++Ref: table-sub-escapes558855 ++Ref: table-sub-proposed560374 ++Ref: table-posix-sub561737 ++Ref: table-gensub-escapes563278 ++Ref: Gory Details-Footnote-1564101 ++Node: I/O Functions564255 ++Ref: table-system-return-values570723 ++Ref: I/O Functions-Footnote-1572703 ++Ref: I/O Functions-Footnote-2572851 ++Node: Time Functions572971 ++Ref: Time Functions-Footnote-1583642 ++Ref: Time Functions-Footnote-2583710 ++Ref: Time Functions-Footnote-3583868 ++Ref: Time Functions-Footnote-4583979 ++Ref: Time Functions-Footnote-5584091 ++Ref: Time Functions-Footnote-6584318 ++Node: Bitwise Functions584584 ++Ref: table-bitwise-ops585178 ++Ref: Bitwise Functions-Footnote-1591223 ++Ref: Bitwise Functions-Footnote-2591396 ++Node: Type Functions591587 ++Node: I18N Functions594338 ++Node: User-defined595989 ++Node: Definition Syntax596794 ++Ref: Definition Syntax-Footnote-1602481 ++Node: Function Example602552 ++Ref: Function Example-Footnote-1605474 ++Node: Function Caveats605496 ++Node: Calling A Function606014 ++Node: Variable Scope606972 ++Node: Pass By Value/Reference609966 ++Node: Return Statement613465 ++Node: Dynamic Typing616444 ++Node: Indirect Calls617374 ++Ref: Indirect Calls-Footnote-1627626 ++Node: Functions Summary627754 ++Node: Library Functions630459 ++Ref: Library Functions-Footnote-1634066 ++Ref: Library Functions-Footnote-2634209 ++Node: Library Names634380 ++Ref: Library Names-Footnote-1637840 ++Ref: Library Names-Footnote-2638063 ++Node: General Functions638149 ++Node: Strtonum Function639252 ++Node: Assert Function642274 ++Node: Round Function645600 ++Node: Cliff Random Function647140 ++Node: Ordinal Functions648156 ++Ref: Ordinal Functions-Footnote-1651219 ++Ref: Ordinal Functions-Footnote-2651471 ++Node: Join Function651681 ++Ref: Join Function-Footnote-1653451 ++Node: Getlocaltime Function653651 ++Node: Readfile Function657393 ++Node: Shell Quoting659370 ++Node: Data File Management660771 ++Node: Filetrans Function661403 ++Node: Rewind Function665499 ++Node: File Checking667409 ++Ref: File Checking-Footnote-1668743 ++Node: Empty Files668944 ++Node: Ignoring Assigns670923 ++Node: Getopt Function672473 ++Ref: Getopt Function-Footnote-1683942 ++Node: Passwd Functions684142 ++Ref: Passwd Functions-Footnote-1692981 ++Node: Group Functions693069 ++Ref: Group Functions-Footnote-1700967 ++Node: Walking Arrays701174 ++Node: Library Functions Summary704182 ++Node: Library Exercises705588 ++Node: Sample Programs706053 ++Node: Running Examples706823 ++Node: Clones707551 ++Node: Cut Program708775 ++Node: Egrep Program718704 ++Ref: Egrep Program-Footnote-1726216 ++Node: Id Program726326 ++Node: Split Program730006 ++Ref: Split Program-Footnote-1733464 ++Node: Tee Program733593 ++Node: Uniq Program736383 ++Node: Wc Program743809 ++Ref: Wc Program-Footnote-1748064 ++Node: Miscellaneous Programs748158 ++Node: Dupword Program749371 ++Node: Alarm Program751401 ++Node: Translate Program756256 ++Ref: Translate Program-Footnote-1760821 ++Node: Labels Program761091 ++Ref: Labels Program-Footnote-1764442 ++Node: Word Sorting764526 ++Node: History Sorting768598 ++Node: Extract Program770433 ++Node: Simple Sed777963 ++Node: Igawk Program781037 ++Ref: Igawk Program-Footnote-1795368 ++Ref: Igawk Program-Footnote-2795570 ++Ref: Igawk Program-Footnote-3795692 ++Node: Anagram Program795807 ++Node: Signature Program798869 ++Node: Programs Summary800116 ++Node: Programs Exercises801330 ++Ref: Programs Exercises-Footnote-1805459 ++Node: Advanced Features805550 ++Node: Nondecimal Data807540 ++Node: Array Sorting809131 ++Node: Controlling Array Traversal809831 ++Ref: Controlling Array Traversal-Footnote-1818199 ++Node: Array Sorting Functions818317 ++Ref: Array Sorting Functions-Footnote-1823408 ++Node: Two-way I/O823604 ++Ref: Two-way I/O-Footnote-1830156 ++Ref: Two-way I/O-Footnote-2830343 ++Node: TCP/IP Networking830425 ++Node: Profiling833543 ++Ref: Profiling-Footnote-1842215 ++Node: Advanced Features Summary842538 ++Node: Internationalization844382 ++Node: I18N and L10N845862 ++Node: Explaining gettext846549 ++Ref: Explaining gettext-Footnote-1852441 ++Ref: Explaining gettext-Footnote-2852626 ++Node: Programmer i18n852791 ++Ref: Programmer i18n-Footnote-1857740 ++Node: Translator i18n857789 ++Node: String Extraction858583 ++Ref: String Extraction-Footnote-1859715 ++Node: Printf Ordering859801 ++Ref: Printf Ordering-Footnote-1862587 ++Node: I18N Portability862651 ++Ref: I18N Portability-Footnote-1865107 ++Node: I18N Example865170 ++Ref: I18N Example-Footnote-1867976 ++Node: Gawk I18N868049 ++Node: I18N Summary868694 ++Node: Debugger870035 ++Node: Debugging871058 ++Node: Debugging Concepts871499 ++Node: Debugging Terms873308 ++Node: Awk Debugging875883 ++Node: Sample Debugging Session876789 ++Node: Debugger Invocation877323 ++Node: Finding The Bug878709 ++Node: List of Debugger Commands885187 ++Node: Breakpoint Control886520 ++Node: Debugger Execution Control890214 ++Node: Viewing And Changing Data893576 ++Node: Execution Stack896950 ++Node: Debugger Info898587 ++Node: Miscellaneous Debugger Commands902658 ++Node: Readline Support907720 ++Node: Limitations908616 ++Node: Debugging Summary910725 ++Node: Arbitrary Precision Arithmetic912004 ++Node: Computer Arithmetic913489 ++Ref: table-numeric-ranges917255 ++Ref: table-floating-point-ranges917748 ++Ref: Computer Arithmetic-Footnote-1918406 ++Node: Math Definitions918463 ++Ref: table-ieee-formats921779 ++Ref: Math Definitions-Footnote-1922382 ++Node: MPFR features922487 ++Node: FP Math Caution924205 ++Ref: FP Math Caution-Footnote-1925277 ++Node: Inexactness of computations925646 ++Node: Inexact representation926606 ++Node: Comparing FP Values927966 ++Node: Errors accumulate929048 ++Node: Getting Accuracy930481 ++Node: Try To Round933191 ++Node: Setting precision934090 ++Ref: table-predefined-precision-strings934787 ++Node: Setting the rounding mode936617 ++Ref: table-gawk-rounding-modes936991 ++Ref: Setting the rounding mode-Footnote-1940922 ++Node: Arbitrary Precision Integers941101 ++Ref: Arbitrary Precision Integers-Footnote-1944276 ++Node: Checking for MPFR944425 ++Node: POSIX Floating Point Problems945899 ++Ref: POSIX Floating Point Problems-Footnote-1949770 ++Node: Floating point summary949808 ++Node: Dynamic Extensions951998 ++Node: Extension Intro953551 ++Node: Plugin License954817 ++Node: Extension Mechanism Outline955614 ++Ref: figure-load-extension956053 ++Ref: figure-register-new-function957618 ++Ref: figure-call-new-function958710 ++Node: Extension API Description960772 ++Node: Extension API Functions Introduction962414 ++Node: General Data Types967954 ++Ref: General Data Types-Footnote-1976315 ++Node: Memory Allocation Functions976614 ++Ref: Memory Allocation Functions-Footnote-1980824 ++Node: Constructor Functions980923 ++Node: Registration Functions984509 ++Node: Extension Functions985194 ++Node: Exit Callback Functions990409 ++Node: Extension Version String991659 ++Node: Input Parsers992322 ++Node: Output Wrappers1005043 ++Node: Two-way processors1009555 ++Node: Printing Messages1011820 ++Ref: Printing Messages-Footnote-11012991 ++Node: Updating ERRNO1013144 ++Node: Requesting Values1013883 ++Ref: table-value-types-returned1014620 ++Node: Accessing Parameters1015556 ++Node: Symbol Table Access1016791 ++Node: Symbol table by name1017303 ++Node: Symbol table by cookie1019092 ++Ref: Symbol table by cookie-Footnote-11023277 ++Node: Cached values1023341 ++Ref: Cached values-Footnote-11026877 ++Node: Array Manipulation1027030 ++Ref: Array Manipulation-Footnote-11028121 ++Node: Array Data Types1028158 ++Ref: Array Data Types-Footnote-11030816 ++Node: Array Functions1030908 ++Node: Flattening Arrays1035406 ++Node: Creating Arrays1042382 ++Node: Redirection API1047149 ++Node: Extension API Variables1049982 ++Node: Extension Versioning1050693 ++Ref: gawk-api-version1051122 ++Node: Extension GMP/MPFR Versioning1052853 ++Node: Extension API Informational Variables1054481 ++Node: Extension API Boilerplate1055554 ++Node: Changes from API V11059528 ++Node: Finding Extensions1061100 ++Node: Extension Example1061659 ++Node: Internal File Description1062457 ++Node: Internal File Ops1066537 ++Ref: Internal File Ops-Footnote-11077887 ++Node: Using Internal File Ops1078027 ++Ref: Using Internal File Ops-Footnote-11080410 ++Node: Extension Samples1080684 ++Node: Extension Sample File Functions1082213 ++Node: Extension Sample Fnmatch1089862 ++Node: Extension Sample Fork1091349 ++Node: Extension Sample Inplace1092567 ++Node: Extension Sample Ord1095784 ++Node: Extension Sample Readdir1096620 ++Ref: table-readdir-file-types1097509 ++Node: Extension Sample Revout1098314 ++Node: Extension Sample Rev2way1098903 ++Node: Extension Sample Read write array1099643 ++Node: Extension Sample Readfile1101585 ++Node: Extension Sample Time1102680 ++Node: Extension Sample API Tests1104028 ++Node: gawkextlib1104520 ++Node: Extension summary1107438 ++Node: Extension Exercises1111140 ++Node: Language History1112638 ++Node: V7/SVR3.11114294 ++Node: SVR41116446 ++Node: POSIX1117880 ++Node: BTL1119260 ++Node: POSIX/GNU1119989 ++Node: Feature History1125767 ++Node: Common Extensions1141626 ++Node: Ranges and Locales1142909 ++Ref: Ranges and Locales-Footnote-11147525 ++Ref: Ranges and Locales-Footnote-21147552 ++Ref: Ranges and Locales-Footnote-31147787 ++Node: Contributors1148008 ++Node: History summary1153953 ++Node: Installation1155333 ++Node: Gawk Distribution1156277 ++Node: Getting1156761 ++Node: Extracting1157724 ++Node: Distribution contents1159362 ++Node: Unix Installation1165842 ++Node: Quick Installation1166524 ++Node: Shell Startup Files1168938 ++Node: Additional Configuration Options1170027 ++Node: Configuration Philosophy1172320 ++Node: Non-Unix Installation1174689 ++Node: PC Installation1175149 ++Node: PC Binary Installation1175987 ++Node: PC Compiling1176422 ++Node: PC Using1177539 ++Node: Cygwin1180754 ++Node: MSYS1181853 ++Node: VMS Installation1182354 ++Node: VMS Compilation1183145 ++Ref: VMS Compilation-Footnote-11184374 ++Node: VMS Dynamic Extensions1184432 ++Node: VMS Installation Details1186117 ++Node: VMS Running1188370 ++Node: VMS GNV1192649 ++Node: VMS Old Gawk1193384 ++Node: Bugs1193855 ++Node: Bug address1194518 ++Node: Usenet1197310 ++Node: Maintainers1198087 ++Node: Other Versions1199348 ++Node: Installation summary1206110 ++Node: Notes1207312 ++Node: Compatibility Mode1208177 ++Node: Additions1208959 ++Node: Accessing The Source1209884 ++Node: Adding Code1211321 ++Node: New Ports1217540 ++Node: Derived Files1222028 ++Ref: Derived Files-Footnote-11227674 ++Ref: Derived Files-Footnote-21227709 ++Ref: Derived Files-Footnote-31228307 ++Node: Future Extensions1228421 ++Node: Implementation Limitations1229079 ++Node: Extension Design1230262 ++Node: Old Extension Problems1231416 ++Ref: Old Extension Problems-Footnote-11232934 ++Node: Extension New Mechanism Goals1232991 ++Ref: Extension New Mechanism Goals-Footnote-11236355 ++Node: Extension Other Design Decisions1236544 ++Node: Extension Future Growth1238657 ++Node: Old Extension Mechanism1239493 ++Node: Notes summary1241256 ++Node: Basic Concepts1242438 ++Node: Basic High Level1243119 ++Ref: figure-general-flow1243401 ++Ref: figure-process-flow1244086 ++Ref: Basic High Level-Footnote-11247387 ++Node: Basic Data Typing1247572 ++Node: Glossary1250900 ++Node: Copying1282738 ++Node: GNU Free Documentation License1320281 ++Node: Index1345401 +  + End Tag Table +diff --git a/doc/gawk.texi b/doc/gawk.texi +index 7b69b52..7dfa3b3 100644 +--- a/doc/gawk.texi ++++ b/doc/gawk.texi +@@ -9557,6 +9557,25 @@ the field width. Here is a list of the format-control letters: + + @c @asis for docbook to come out right + @table @asis ++@item @code{%a}, @code{%A} ++A floating point number of the form ++[@code{-}]@code{0x@var{h}.@var{hhhh}p+-@var{dd}} ++(C99 hexadecimal floating point format). ++For @code{%A}, ++uppercase letters are used instead of lowercase ones. ++ ++@quotation NOTE ++While the current POSIX standard requires support for @code{%a} ++and @code{%A} in @command{awk}, as far as we know, no other version ++of @command{awk} actually implements it. It's use is thus highly ++nonportable! ++ ++Furthermore, these formats are not available on any system where the ++underlying C library @code{printf()} function does not support them. As ++of this writing, among current systems, only OpenVMS is known to not ++support them. ++@end quotation ++ + @item @code{%c} + Print a number as a character; thus, @samp{printf "%c", + 65} outputs the letter @samp{A}. The output for a string value is +diff --git a/doc/gawktexi.in b/doc/gawktexi.in +index 6203e1a..f2cb710 100644 +--- a/doc/gawktexi.in ++++ b/doc/gawktexi.in +@@ -9156,6 +9156,25 @@ the field width. Here is a list of the format-control letters: + + @c @asis for docbook to come out right + @table @asis ++@item @code{%a}, @code{%A} ++A floating point number of the form ++[@code{-}]@code{0x@var{h}.@var{hhhh}p+-@var{dd}} ++(C99 hexadecimal floating point format). ++For @code{%A}, ++uppercase letters are used instead of lowercase ones. ++ ++@quotation NOTE ++While the current POSIX standard requires support for @code{%a} ++and @code{%A} in @command{awk}, as far as we know, no other version ++of @command{awk} actually implements it. It's use is thus highly ++nonportable! ++ ++Furthermore, these formats are not available on any system where the ++underlying C library @code{printf()} function does not support them. As ++of this writing, among current systems, only OpenVMS is known to not ++support them. ++@end quotation ++ + @item @code{%c} + Print a number as a character; thus, @samp{printf "%c", + 65} outputs the letter @samp{A}. The output for a string value is +diff --git a/doc/wordlist b/doc/wordlist +index 3c3c7e9..3763056 100644 +--- a/doc/wordlist ++++ b/doc/wordlist +@@ -865,6 +865,7 @@ dayname + db + dcgettext + dcngettext ++dd + ddd + de + deallocations +@@ -1132,6 +1133,7 @@ helpfull + helplib + hfil + hh ++hhhh + hhob + histsort + hlp +diff --git a/doc/wordlist2 b/doc/wordlist2 +index 9275fdb..7bf7ad3 100644 +--- a/doc/wordlist2 ++++ b/doc/wordlist2 +@@ -60,6 +60,7 @@ distclean + docbook + du + dvi ++elled + emph + en + env +diff --git a/pc/config.h b/pc/config.h +index de2b7ec..2ec5352 100644 +--- a/pc/config.h ++++ b/pc/config.h +@@ -473,6 +473,9 @@ + /* Define to the version of this package. */ + #define PACKAGE_VERSION "4.2.1" + ++/* Define to 1 if *printf supports %a format */ ++#define PRINTF_HAS_A_FORMAT 1 ++ + /* Define to 1 if *printf supports %F format */ + #ifdef __DJGPP__ + #define PRINTF_HAS_F_FORMAT 1 +diff --git a/pc/config.sed b/pc/config.sed +index 5b3cc32..a7ba878 100644 +--- a/pc/config.sed ++++ b/pc/config.sed +@@ -273,6 +273,8 @@ s/^#undef HAVE_VPRINTF *$/#define HAVE_VPRINTF 1/ + #ifdef __DJGPP__\ + #define HAVE__BOOL 1\ + #endif ++/^#undef PRINTF_HAS_A_FORMAT *$/c\ ++#define PRINTF_HAS_A_FORMAT 1 + /^#undef PRINTF_HAS_F_FORMAT *$/c\ + #ifdef __DJGPP__\ + #define PRINTF_HAS_F_FORMAT 1\ +-- +2.14.4 + diff --git a/gawk-4.2.1-001-remove-the-tail-recursion-optimization.patch b/gawk-4.2.1-001-remove-the-tail-recursion-optimization.patch new file mode 100644 index 0000000..0063c28 --- /dev/null +++ b/gawk-4.2.1-001-remove-the-tail-recursion-optimization.patch @@ -0,0 +1,309 @@ +From 47316d294571673a8dbf1e9e435893e2660f46a8 Mon Sep 17 00:00:00 2001 +From: "Arnold D. Robbins" +Date: Mon, 26 Mar 2018 10:45:01 +0300 +Subject: [PATCH] Remove the tail recursion optimization. + +--- + awk.h | 4 ---- + awkgram.y | 27 ++------------------------- + eval.c | 49 +++++++------------------------------------------ + test/Makefile.am | 4 +++- + test/Makefile.in | 9 ++++++++- + test/Maketests | 5 +++++ + test/tailrecurse.awk | 15 +++++++++++++++ + test/tailrecurse.ok | 5 +++++ + 8 files changed, 45 insertions(+), 73 deletions(-) + create mode 100644 test/tailrecurse.awk + create mode 100644 test/tailrecurse.ok + +diff --git a/awk.h b/awk.h +index 3b351c2..36e71f2 100644 +--- a/awk.h ++++ b/awk.h +@@ -527,7 +527,6 @@ typedef struct exp_node { + #define func_node sub.nodep.x.extra + #define prev_frame_size sub.nodep.reflags + #define reti sub.nodep.l.li +-#define num_tail_calls sub.nodep.cnt + + /* Node_var: */ + #define var_value lnode +@@ -862,9 +861,6 @@ typedef struct exp_instruction { + /* Op_func_call, Op_func */ + #define func_body x.xn + +-/* Op_func_call */ +-#define tail_call d.dl +- + /* Op_subscript */ + #define sub_count d.dl + +diff --git a/awkgram.y b/awkgram.y +index ad830a5..caed09e 100644 +--- a/awkgram.y ++++ b/awkgram.y +@@ -993,20 +993,9 @@ non_compound_stmt + $$ = list_create($1); + (void) list_prepend($$, instruction(Op_push_i)); + $$->nexti->memory = dupnode(Nnull_string); +- } else { +- if (do_optimize +- && $3->lasti->opcode == Op_func_call +- && strcmp($3->lasti->func_name, in_function) == 0 +- ) { +- /* Do tail recursion optimization. Tail +- * call without a return value is recognized +- * in mk_function(). +- */ +- ($3->lasti + 1)->tail_call = true; +- } +- ++ } else + $$ = list_append($3, $1); +- } ++ + $$ = add_pending_comment($$); + } + | simple_stmt statement_term +@@ -4736,18 +4725,6 @@ mk_function(INSTRUCTION *fi, INSTRUCTION *def) + thisfunc = fi->func_body; + assert(thisfunc != NULL); + +- if (do_optimize && def->lasti->opcode == Op_pop) { +- /* tail call which does not return any value. */ +- +- INSTRUCTION *t; +- +- for (t = def->nexti; t->nexti != def->lasti; t = t->nexti) +- ; +- if (t->opcode == Op_func_call +- && strcmp(t->func_name, thisfunc->vname) == 0) +- (t + 1)->tail_call = true; +- } +- + /* add any pre-function comment to start of action for profile.c */ + + if (function_comment != NULL) { +diff --git a/eval.c b/eval.c +index 6ece236..34ba174 100644 +--- a/eval.c ++++ b/eval.c +@@ -674,7 +674,7 @@ void + dump_fcall_stack(FILE *fp) + { + NODE *f, *func; +- long i = 0, j, k = 0; ++ long i = 0, k = 0; + + if (fcall_count == 0) + return; +@@ -682,15 +682,13 @@ dump_fcall_stack(FILE *fp) + + /* current frame */ + func = frame_ptr->func_node; +- for (j = 0; j <= frame_ptr->num_tail_calls; j++) +- fprintf(fp, "\t# %3ld. %s\n", k++, func->vname); ++ fprintf(fp, "\t# %3ld. %s\n", k++, func->vname); + + /* outer frames except main */ + for (i = 1; i < fcall_count; i++) { + f = fcall_list[i]; + func = f->func_node; +- for (j = 0; j <= f->num_tail_calls; j++) +- fprintf(fp, "\t# %3ld. %s\n", k++, func->vname); ++ fprintf(fp, "\t# %3ld. %s\n", k++, func->vname); + } + + fprintf(fp, "\t# %3ld. -- main --\n", k); +@@ -1242,38 +1240,16 @@ setup_frame(INSTRUCTION *pc) + NODE *m, *f, *fp; + NODE **sp = NULL; + int pcount, arg_count, i, j; +- bool tail_optimize = false; + + f = pc->func_body; + pcount = f->param_cnt; + fp = f->fparms; + arg_count = (pc + 1)->expr_count; + +- /* tail recursion optimization */ +- tail_optimize = ((pc + 1)->tail_call && do_optimize +- && ! do_debug && ! do_profile); +- +- if (tail_optimize) { +- /* free local vars of calling frame */ +- +- NODE *func; +- int n; +- +- func = frame_ptr->func_node; +- for (n = func->param_cnt, sp = frame_ptr->stack; n > 0; n--) { +- r = *sp++; +- if (r->type == Node_var) /* local variable */ +- DEREF(r->var_value); +- else if (r->type == Node_var_array) /* local array */ +- assoc_clear(r); +- } +- sp = frame_ptr->stack; +- +- } else if (pcount > 0) { ++ if (pcount > 0) { + ezalloc(sp, NODE **, pcount * sizeof(NODE *), "setup_frame"); + } + +- + /* check for extra args */ + if (arg_count > pcount) { + warning( +@@ -1287,13 +1263,9 @@ setup_frame(INSTRUCTION *pc) + } + + for (i = 0, j = arg_count - 1; i < pcount; i++, j--) { +- if (tail_optimize) +- r = sp[i]; +- else { +- getnode(r); +- memset(r, 0, sizeof(NODE)); +- sp[i] = r; +- } ++ getnode(r); ++ memset(r, 0, sizeof(NODE)); ++ sp[i] = r; + + if (i >= arg_count) { + /* local variable */ +@@ -1348,11 +1320,6 @@ setup_frame(INSTRUCTION *pc) + + stack_adj(-arg_count); /* adjust stack pointer */ + +- if (tail_optimize) { +- frame_ptr->num_tail_calls++; +- return f->code_ptr; +- } +- + if (pc->opcode == Op_indirect_func_call) { + r = POP(); /* indirect var */ + DEREF(r); +@@ -1372,7 +1339,6 @@ setup_frame(INSTRUCTION *pc) + frame_ptr->stack = sp; + frame_ptr->prev_frame_size = (stack_ptr - stack_bottom); /* size of the previous stack frame */ + frame_ptr->func_node = f; +- frame_ptr->num_tail_calls = 0; + frame_ptr->vname = NULL; + frame_ptr->reti = pc; /* on return execute pc->nexti */ + +@@ -1774,7 +1740,6 @@ init_interpret() + frame_ptr->type = Node_frame; + frame_ptr->stack = NULL; + frame_ptr->func_node = NULL; /* in main */ +- frame_ptr->num_tail_calls = 0; + frame_ptr->vname = NULL; + + /* initialize true and false nodes */ +diff --git a/test/Makefile.am b/test/Makefile.am +index bf1dbd3..40e25b2 100644 +--- a/test/Makefile.am ++++ b/test/Makefile.am +@@ -1134,6 +1134,8 @@ EXTRA_DIST = \ + synerr1.ok \ + synerr2.awk \ + synerr2.ok \ ++ tailrecurse.awk \ ++ tailrecurse.ok \ + testext.ok \ + time.awk \ + time.ok \ +@@ -1253,7 +1255,7 @@ BASIC_TESTS = \ + sigpipe1 sortempty sortglos splitargv splitarr \ + splitdef splitvar splitwht status-close strcat1 strnum1 strnum2 strtod \ + subamp subback subi18n subsepnm subslash substr swaplns synerr1 synerr2 \ +- tradanch tweakfld \ ++ tailrecurse tradanch tweakfld \ + uninit2 uninit3 uninit4 uninit5 uninitialized unterm uparrfs uplus \ + wideidx wideidx2 widesub widesub2 widesub3 widesub4 wjposer1 \ + zero2 zeroe0 zeroflag +diff --git a/test/Makefile.in b/test/Makefile.in +index f96151b..74405f8 100644 +--- a/test/Makefile.in ++++ b/test/Makefile.in +@@ -1392,6 +1392,8 @@ EXTRA_DIST = \ + synerr1.ok \ + synerr2.awk \ + synerr2.ok \ ++ tailrecurse.awk \ ++ tailrecurse.ok \ + testext.ok \ + time.awk \ + time.ok \ +@@ -1510,7 +1512,7 @@ BASIC_TESTS = \ + sigpipe1 sortempty sortglos splitargv splitarr \ + splitdef splitvar splitwht status-close strcat1 strnum1 strnum2 strtod \ + subamp subback subi18n subsepnm subslash substr swaplns synerr1 synerr2 \ +- tradanch tweakfld \ ++ tailrecurse tradanch tweakfld \ + uninit2 uninit3 uninit4 uninit5 uninitialized unterm uparrfs uplus \ + wideidx wideidx2 widesub widesub2 widesub3 widesub4 wjposer1 \ + zero2 zeroe0 zeroflag +@@ -3919,6 +3921,11 @@ synerr2: + @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + ++tailrecurse: ++ @echo $@ ++ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ ++ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ ++ + uninit2: + @echo $@ + @AWKPATH="$(srcdir)" $(AWK) -f $@.awk --lint >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ +diff --git a/test/Maketests b/test/Maketests +index e449dd3..4a90e3e 100644 +--- a/test/Maketests ++++ b/test/Maketests +@@ -1002,6 +1002,11 @@ synerr2: + @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + ++tailrecurse: ++ @echo $@ ++ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ ++ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ ++ + uninit2: + @echo $@ + @AWKPATH="$(srcdir)" $(AWK) -f $@.awk --lint >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ +diff --git a/test/tailrecurse.awk b/test/tailrecurse.awk +new file mode 100644 +index 0000000..b287d16 +--- /dev/null ++++ b/test/tailrecurse.awk +@@ -0,0 +1,15 @@ ++BEGIN { ++ abc(2) ++} ++ ++ ++function abc(c, A, B) ++{ ++ print "abc(" c ", " length(A) ")" ++ if (! c--) { ++ return ++ } ++ B[""] ++ print length(B) ++ return abc(c, B) ++} +diff --git a/test/tailrecurse.ok b/test/tailrecurse.ok +new file mode 100644 +index 0000000..73ce1ed +--- /dev/null ++++ b/test/tailrecurse.ok +@@ -0,0 +1,5 @@ ++abc(2, 0) ++1 ++abc(1, 1) ++1 ++abc(0, 1) +-- +2.14.4 + diff --git a/gawk-4.2.1-002-copy-MPZ-MPFR-bits-also-in-r_dupnode.patch b/gawk-4.2.1-002-copy-MPZ-MPFR-bits-also-in-r_dupnode.patch new file mode 100644 index 0000000..af71827 --- /dev/null +++ b/gawk-4.2.1-002-copy-MPZ-MPFR-bits-also-in-r_dupnode.patch @@ -0,0 +1,208 @@ +From 0fafaee9bb38a3ea4b8be4009e9ce99334460ddd Mon Sep 17 00:00:00 2001 +From: "Arnold D. Robbins" +Date: Mon, 2 Apr 2018 16:37:17 +0300 +Subject: [PATCH] Copy MPZ/MPFR bits also, in r_dupnode. + +--- + interpret.h | 27 ++++++++++++++++++--------- + node.c | 20 ++++++++++++++++++-- + test/Makefile.am | 12 ++++++++++-- + test/Makefile.in | 12 ++++++++++-- + test/mpfrfield.awk | 14 ++++++++++++++ + test/mpfrfield.in | 10 ++++++++++ + test/mpfrfield.ok | 1 + + 7 files changed, 81 insertions(+), 15 deletions(-) + create mode 100644 test/mpfrfield.awk + create mode 100644 test/mpfrfield.in + create mode 100644 test/mpfrfield.ok + +diff --git a/interpret.h b/interpret.h +index 96e2c89..20fcb7a 100644 +--- a/interpret.h ++++ b/interpret.h +@@ -32,16 +32,25 @@ + * valref 1, that effectively means that this is an assignment like "$n = $n", + * so a no-op, other than triggering $0 reconstitution. + */ +-#define UNFIELD(l, r) \ +-{ \ +- /* if was a field, turn it into a var */ \ +- if ((r->flags & MALLOC) != 0 || r->valref == 1) { \ +- l = r; \ +- } else { \ +- l = dupnode(r); \ +- DEREF(r); \ +- } \ ++ ++// not a macro so we can step into it with a debugger ++#ifndef UNFIELD_DEFINED ++#define UNFIELD_DEFINED 1 ++static inline void ++unfield(NODE **l, NODE **r) ++{ ++ /* if was a field, turn it into a var */ ++ if (((*r)->flags & MALLOC) != 0 || (*r)->valref == 1) { ++ (*l) = (*r); ++ } else { ++ (*l) = dupnode(*r); ++ DEREF(*r); ++ } + } ++ ++#define UNFIELD(l, r) unfield(& (l), & (r)) ++#endif ++ + int + r_interpret(INSTRUCTION *code) + { +diff --git a/node.c b/node.c +index add959f..fcd2bf3 100644 +--- a/node.c ++++ b/node.c +@@ -306,8 +306,24 @@ r_dupnode(NODE *n) + } + #endif + +- getnode(r); +- *r = *n; ++#ifdef HAVE_MPFR ++ if ((n->flags & MPZN) != 0) { ++ r = mpg_integer(); ++ mpz_set(r->mpg_i, n->mpg_i); ++ r->flags = n->flags; ++ } else if ((n->flags & MPFN) != 0) { ++ r = mpg_float(); ++ int tval = mpfr_set(r->mpg_numbr, n->mpg_numbr, ROUND_MODE); ++ IEEE_FMT(r->mpg_numbr, tval); ++ r->flags = n->flags; ++ } else { ++#endif ++ getnode(r); ++ *r = *n; ++#ifdef HAVE_MPFR ++ } ++#endif ++ + r->flags |= MALLOC; + r->valref = 1; + /* +diff --git a/test/Makefile.am b/test/Makefile.am +index 40e25b2..93a6ee5 100644 +--- a/test/Makefile.am ++++ b/test/Makefile.am +@@ -655,6 +655,9 @@ EXTRA_DIST = \ + mpfrbigint.ok \ + mpfrexprange.awk \ + mpfrexprange.ok \ ++ mpfrfield.awk \ ++ mpfrfield.in \ ++ mpfrfield.ok \ + mpfrieee.awk \ + mpfrieee.ok \ + mpfrmemok1.awk \ +@@ -1302,8 +1305,8 @@ INET_TESTS = inetdayu inetdayt inetechu inetecht + + MACHINE_TESTS = double1 double2 fmtspcl intformat + +-MPFR_TESTS = mpfrbigint mpfrexprange mpfrieee mpfrmemok1 mpfrnegzero \ +- mpfrnr mpfrrem mpfrrnd mpfrrndeval mpfrsort mpfrsqrt \ ++MPFR_TESTS = mpfrbigint mpfrexprange mpfrfield mpfrieee mpfrmemok1 \ ++ mpfrnegzero mpfrnr mpfrrem mpfrrnd mpfrrndeval mpfrsort mpfrsqrt \ + mpfrstrtonum mpgforcenum mpfruplus + + LOCALE_CHARSET_TESTS = \ +@@ -2148,6 +2151,11 @@ mpfrmemok1: + @$(AWK) -p- -M -f "$(srcdir)"/$@.awk 2>&1 | sed 1d > _$@ + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + ++mpfrfield: ++ @echo $@ ++ @$(AWK) -M -f "$(srcdir)"/$@.awk "$(srcdir)"/$@.in > _$@ 2>&1 ++ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ ++ + jarebug:: + @echo $@ + @"$(srcdir)"/$@.sh "$(AWKPROG)" "$(srcdir)"/$@.awk "$(srcdir)"/$@.in "_$@" +diff --git a/test/Makefile.in b/test/Makefile.in +index 74405f8..2358988 100644 +--- a/test/Makefile.in ++++ b/test/Makefile.in +@@ -913,6 +913,9 @@ EXTRA_DIST = \ + mpfrbigint.ok \ + mpfrexprange.awk \ + mpfrexprange.ok \ ++ mpfrfield.awk \ ++ mpfrfield.in \ ++ mpfrfield.ok \ + mpfrieee.awk \ + mpfrieee.ok \ + mpfrmemok1.awk \ +@@ -1555,8 +1558,8 @@ ARRAYDEBUG_TESTS = arrdbg + EXTRA_TESTS = inftest regtest ignrcas3 + INET_TESTS = inetdayu inetdayt inetechu inetecht + MACHINE_TESTS = double1 double2 fmtspcl intformat +-MPFR_TESTS = mpfrbigint mpfrexprange mpfrieee mpfrmemok1 mpfrnegzero \ +- mpfrnr mpfrrem mpfrrnd mpfrrndeval mpfrsort mpfrsqrt \ ++MPFR_TESTS = mpfrbigint mpfrexprange mpfrfield mpfrieee mpfrmemok1 \ ++ mpfrnegzero mpfrnr mpfrrem mpfrrnd mpfrrndeval mpfrsort mpfrsqrt \ + mpfrstrtonum mpgforcenum mpfruplus + + LOCALE_CHARSET_TESTS = \ +@@ -2588,6 +2591,11 @@ mpfrmemok1: + @$(AWK) -p- -M -f "$(srcdir)"/$@.awk 2>&1 | sed 1d > _$@ + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + ++mpfrfield: ++ @echo $@ ++ @$(AWK) -M -f "$(srcdir)"/$@.awk "$(srcdir)"/$@.in > _$@ 2>&1 ++ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ ++ + jarebug:: + @echo $@ + @"$(srcdir)"/$@.sh "$(AWKPROG)" "$(srcdir)"/$@.awk "$(srcdir)"/$@.in "_$@" +diff --git a/test/mpfrfield.awk b/test/mpfrfield.awk +new file mode 100644 +index 0000000..35a97b7 +--- /dev/null ++++ b/test/mpfrfield.awk +@@ -0,0 +1,14 @@ ++#! /bin/gawk -Mf ++ ++NR == 1 { ++ min = $1 ++} ++ ++{ ++ if ($1 < min) ++ min = $1 ++} ++ ++END { ++ print "min", min ++} +diff --git a/test/mpfrfield.in b/test/mpfrfield.in +new file mode 100644 +index 0000000..05d3344 +--- /dev/null ++++ b/test/mpfrfield.in +@@ -0,0 +1,10 @@ ++7 ++9 ++1 ++3 ++9 ++1 ++9 ++5 ++0 ++8 +diff --git a/test/mpfrfield.ok b/test/mpfrfield.ok +new file mode 100644 +index 0000000..3736de4 +--- /dev/null ++++ b/test/mpfrfield.ok +@@ -0,0 +1 @@ ++min 0 +-- +2.14.4 + diff --git a/gawk-4.2.1-003-fix-rebuilding-records-if-using-API-parser.patch b/gawk-4.2.1-003-fix-rebuilding-records-if-using-API-parser.patch new file mode 100644 index 0000000..f5740e0 --- /dev/null +++ b/gawk-4.2.1-003-fix-rebuilding-records-if-using-API-parser.patch @@ -0,0 +1,129 @@ +From 50f617427403434dcca156fb081c1bdc7eb714b7 Mon Sep 17 00:00:00 2001 +From: "Arnold D. Robbins" +Date: Tue, 17 Apr 2018 15:44:57 +0300 +Subject: [PATCH] Fix problem with rebuilding records if using API parser. + +--- + field.c | 5 +++++ + test/Makefile.am | 10 +++++++++- + test/Makefile.in | 10 +++++++++- + test/readdir_retest.awk | 7 +++++++ + 4 files changed, 30 insertions(+), 2 deletions(-) + create mode 100644 test/readdir_retest.awk + +diff --git a/field.c b/field.c +index 0d7e633..5296324 100644 +--- a/field.c ++++ b/field.c +@@ -338,6 +338,11 @@ reset_record() + { + fields_arr[0] = force_string(fields_arr[0]); + purge_record(); ++ if (api_parser_override) { ++ api_parser_override = false; ++ parse_field = normal_parse_field; ++ update_PROCINFO_str("FS", current_field_sep_str()); ++ } + } + + static void +diff --git a/test/Makefile.am b/test/Makefile.am +index 93a6ee5..f554606 100644 +--- a/test/Makefile.am ++++ b/test/Makefile.am +@@ -906,6 +906,7 @@ EXTRA_DIST = \ + readbuf.ok \ + readdir.awk \ + readdir0.awk \ ++ readdir_retest.awk \ + readfile2.awk \ + readfile2.ok \ + rebrackloc.awk \ +@@ -1321,7 +1322,7 @@ SHLIB_TESTS = \ + getfile \ + inplace1 inplace2 inplace3 \ + ordchr ordchr2 \ +- readdir readdir_test readfile readfile2 revout \ ++ readdir readdir_test readdir_retest readfile readfile2 revout \ + revtwoway rwarray \ + testext time + +@@ -2279,6 +2280,12 @@ readdir_test: + @$(AWK) -lreaddir_test '{printf "[%s] [%s] [%s] [%s]\n", $$1, $$2, $$3, $$4}' "$(top_srcdir)" > _$@ + @-$(CMP) $@.ok _$@ && rm -f $@.ok _$@ + ++readdir_retest: ++ @echo $@ ++ @$(AWK) -lreaddir -F/ -f $@.awk "$(top_srcdir)" > $@.ok ++ @$(AWK) -lreaddir_test -F/ -f $@.awk "$(top_srcdir)" > _$@ ++ @-$(CMP) $@.ok _$@ && rm -f $@.ok _$@ ++ + fts: + @case `uname` in \ + IRIX) \ +@@ -2500,6 +2507,7 @@ Maketests: $(srcdir)/Makefile.am $(srcdir)/Gentests + clean-local: + rm -fr _* core core.* fmtspcl.ok junk strftime.ok test1 test2 \ + seq *~ readfile.ok fork.tmp.* testext.awk fts.ok readdir.ok \ ++ readdir_test.ok readdir_retest.ok \ + mmap8k.ok profile1.ok + + # An attempt to print something that can be grepped for in build logs +diff --git a/test/Makefile.in b/test/Makefile.in +index 2358988..4133b58 100644 +--- a/test/Makefile.in ++++ b/test/Makefile.in +@@ -1164,6 +1164,7 @@ EXTRA_DIST = \ + readbuf.ok \ + readdir.awk \ + readdir0.awk \ ++ readdir_retest.awk \ + readfile2.awk \ + readfile2.ok \ + rebrackloc.awk \ +@@ -1574,7 +1575,7 @@ SHLIB_TESTS = \ + getfile \ + inplace1 inplace2 inplace3 \ + ordchr ordchr2 \ +- readdir readdir_test readfile readfile2 revout \ ++ readdir readdir_test readdir_retest readfile readfile2 revout \ + revtwoway rwarray \ + testext time + +@@ -2719,6 +2720,12 @@ readdir_test: + @$(AWK) -lreaddir_test '{printf "[%s] [%s] [%s] [%s]\n", $$1, $$2, $$3, $$4}' "$(top_srcdir)" > _$@ + @-$(CMP) $@.ok _$@ && rm -f $@.ok _$@ + ++readdir_retest: ++ @echo $@ ++ @$(AWK) -lreaddir -F/ -f $@.awk "$(top_srcdir)" > $@.ok ++ @$(AWK) -lreaddir_test -F/ -f $@.awk "$(top_srcdir)" > _$@ ++ @-$(CMP) $@.ok _$@ && rm -f $@.ok _$@ ++ + fts: + @case `uname` in \ + IRIX) \ +@@ -4654,6 +4661,7 @@ Maketests: $(srcdir)/Makefile.am $(srcdir)/Gentests + clean-local: + rm -fr _* core core.* fmtspcl.ok junk strftime.ok test1 test2 \ + seq *~ readfile.ok fork.tmp.* testext.awk fts.ok readdir.ok \ ++ readdir_test.ok readdir_retest.ok \ + mmap8k.ok profile1.ok + + # An attempt to print something that can be grepped for in build logs +diff --git a/test/readdir_retest.awk b/test/readdir_retest.awk +new file mode 100644 +index 0000000..079a993 +--- /dev/null ++++ b/test/readdir_retest.awk +@@ -0,0 +1,7 @@ ++# Test field values after reparsing ++FNR == 1 { record1 = $0 } ++{ ++ printf "[%s] [%s] [%s] [%s]\n", $1, $2, $3, $4 ++ $0 = record1 ++ printf "[%s] [%s] [%s] [%s]\n", $1, $2, $3, $4 ++} +-- +2.14.4 + diff --git a/gawk-4.2.1-004-fix-a-corner-case-with-EPIPE-to-stdout-stderr.patch b/gawk-4.2.1-004-fix-a-corner-case-with-EPIPE-to-stdout-stderr.patch new file mode 100644 index 0000000..0671fd4 --- /dev/null +++ b/gawk-4.2.1-004-fix-a-corner-case-with-EPIPE-to-stdout-stderr.patch @@ -0,0 +1,116 @@ +From 06fe8e801efc0e6a098d93cf104157fb4ef705e8 Mon Sep 17 00:00:00 2001 +From: "Arnold D. Robbins" +Date: Sun, 17 Jun 2018 21:52:28 +0300 +Subject: [PATCH] Fix a corner case with EPIPE to stdout/stderr. + +--- + awk.h | 2 +- + debug.c | 4 ++-- + interpret.h | 6 +++++- + io.c | 9 ++++++++- + 4 files changed, 16 insertions(+), 5 deletions(-) + +diff --git a/awk.h b/awk.h +index 36e71f2..cdf683d 100644 +--- a/awk.h ++++ b/awk.h +@@ -1581,7 +1581,7 @@ extern struct redirect *redirect_string(const char *redir_exp_str, + int *errflg, int extfd, bool failure_fatal); + extern NODE *do_close(int nargs); + extern int flush_io(void); +-extern int close_io(bool *stdio_problem); ++extern int close_io(bool *stdio_problem, bool *got_EPIPE); + typedef enum { CLOSE_ALL, CLOSE_TO, CLOSE_FROM } two_way_close_type; + extern int close_rp(struct redirect *rp, two_way_close_type how); + extern int devopen_simple(const char *name, const char *mode, bool try_real_open); +diff --git a/debug.c b/debug.c +index 3e76ae6..a587d8f 100644 +--- a/debug.c ++++ b/debug.c +@@ -5398,11 +5398,11 @@ save_options(const char *file) + static void + close_all() + { +- bool stdio_problem; ++ bool stdio_problem, got_EPIPE; + struct command_source *cs; + + (void) nextfile(& curfile, true); /* close input data file */ +- (void) close_io(& stdio_problem); ++ (void) close_io(& stdio_problem, & got_EPIPE); + if (cur_srcfile->fd != INVALID_HANDLE) { + close(cur_srcfile->fd); + cur_srcfile->fd = INVALID_HANDLE; +diff --git a/interpret.h b/interpret.h +index 20fcb7a..8408a53 100644 +--- a/interpret.h ++++ b/interpret.h +@@ -110,6 +110,7 @@ top: + case Op_atexit: + { + bool stdio_problem = false; ++ bool got_EPIPE = false; + + /* avoid false source indications */ + source = NULL; +@@ -125,7 +126,7 @@ top: + * and pipes, in that it doesn't affect their exit status. + * So we no longer do either. + */ +- (void) close_io(& stdio_problem); ++ (void) close_io(& stdio_problem, & got_EPIPE); + /* + * However, we do want to exit non-zero if there was a problem + * with stdout/stderr, so we reinstate a slightly different +@@ -135,6 +136,9 @@ top: + exit_val = 1; + + close_extensions(); ++ ++ if (got_EPIPE) ++ die_via_sigpipe(); + } + break; + +diff --git a/io.c b/io.c +index 1a1d8cc..faccb4b 100644 +--- a/io.c ++++ b/io.c +@@ -1474,12 +1474,13 @@ flush_io() + /* close_io --- close all open files, called when exiting */ + + int +-close_io(bool *stdio_problem) ++close_io(bool *stdio_problem, bool *got_EPIPE) + { + struct redirect *rp; + struct redirect *next; + int status = 0; + ++ *stdio_problem = *got_EPIPE = false; + errno = 0; + for (rp = red_head; rp != NULL; rp = next) { + next = rp->next; +@@ -1505,6 +1506,9 @@ close_io(bool *stdio_problem) + #endif + if (errno != EPIPE) + warning(_("error writing standard output (%s)"), strerror(errno)); ++ else ++ *got_EPIPE = true; ++ + status++; + *stdio_problem = true; + } +@@ -1515,6 +1519,9 @@ close_io(bool *stdio_problem) + #endif + if (errno != EPIPE) + warning(_("error writing standard error (%s)"), strerror(errno)); ++ else ++ *got_EPIPE = true; ++ + status++; + *stdio_problem = true; + } +-- +2.14.4 + diff --git a/gawk.spec b/gawk.spec index 1571b92..fe8d56e 100644 --- a/gawk.spec +++ b/gawk.spec @@ -14,13 +14,18 @@ Summary(tr.UTF-8): GNU araçları metin düzenleyici Summary(uk.UTF-8): GNU версія утиліти обробки текстів awk Name: gawk Version: 4.2.1 -Release: 1 +Release: 2 License: GPL v3+ Group: Applications/Text Source0: http://ftp.gnu.org/gnu/gawk/%{name}-%{version}.tar.lz # Source0-md5: 4b1c1b18f40b5a4bc50e929480b06f89 Source1: http://www.mif.pg.gda.pl/homepages/ankry/man-PLD/%{name}-non-english-man-pages.tar.bz2 # Source1-md5: 80753d75be0f469f70e8c90e75121a9c +Patch100: gawk-4.2.1-000-add-support-for-a-and-A-in-printf.patch +Patch101: gawk-4.2.1-001-remove-the-tail-recursion-optimization.patch +Patch102: gawk-4.2.1-002-copy-MPZ-MPFR-bits-also-in-r_dupnode.patch +Patch103: gawk-4.2.1-003-fix-rebuilding-records-if-using-API-parser.patch +Patch104: gawk-4.2.1-004-fix-a-corner-case-with-EPIPE-to-stdout-stderr.patch Patch0: %{name}-info.patch Patch1: %{name}-shutup.patch Patch2: no-pty-test.patch @@ -120,6 +125,12 @@ Ten pakiet zawiera pliki nagłówkowe dla gawka. %prep %setup -q +%patch100 -p1 +%patch101 -p1 +%patch102 -p1 +%patch103 -p1 +%patch104 -p1 + %patch0 -p1 %patch1 -p1 %patch2 -p1