aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2014-08-03 22:09:27 +0300
committerArnold D. Robbins <arnold@skeeve.com>2014-08-03 22:09:27 +0300
commit4bfa1b9c2e5ef3bb08eb107bd9aca7a8748ce209 (patch)
treed879293b279feb4abe51d55b1230c2dffaae8731
parentd3bd5c88e7505063348d88604180d3e1e6e0f5a9 (diff)
parent8f2f7ef2872a9a95dc1506504b60225ef98944f1 (diff)
downloadegawk-4bfa1b9c2e5ef3bb08eb107bd9aca7a8748ce209.tar.gz
egawk-4bfa1b9c2e5ef3bb08eb107bd9aca7a8748ce209.tar.bz2
egawk-4bfa1b9c2e5ef3bb08eb107bd9aca7a8748ce209.zip
Merge branch 'gawk-4.1-stable'
-rw-r--r--ChangeLog12
-rw-r--r--builtin.c3
-rw-r--r--doc/ChangeLog10
-rw-r--r--doc/gawk.info864
-rw-r--r--doc/gawk.texi6
-rw-r--r--doc/gawktexi.in6
-rw-r--r--gawkapi.h4
-rw-r--r--interpret.h7
-rw-r--r--io.c6
9 files changed, 472 insertions, 446 deletions
diff --git a/ChangeLog b/ChangeLog
index a1bf3ac4..9f6ced7f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2014-08-03 Arnold D. Robbins <arnold@skeeve.com>
+
+ * builtin.c (format_tree): Don't need to check return value of
+ wctombr for -2. Thanks to Eli Zaretskii for pointing this out.
+
+ Unrelated:
+
+ * gawkapi.h: Fix doc for API get_record - errcode needs to
+ be greater than zero.
+ * interpret.h (r_interpret): Move setting of ERRNO to here, from ...
+ * io.c (inrec): ... here. Makes the code cleaner.
+
2014-07-31 Arnold D. Robbins <arnold@skeeve.com>
* builtin.c (format_tree): Make %c handling more sane on Windows.
diff --git a/builtin.c b/builtin.c
index 585d53f1..778760d9 100644
--- a/builtin.c
+++ b/builtin.c
@@ -1081,8 +1081,7 @@ check_pos:
count = wcrtomb(buf, wc, & mbs);
if (count == 0
- || count == (size_t)-1
- || count == (size_t)-2) {
+ || count == (size_t) -1) {
if (do_lint)
lintwarn(
_("[s]printf: value %g is not a valid wide character"),
diff --git a/doc/ChangeLog b/doc/ChangeLog
index 9bf0b156..757c1790 100644
--- a/doc/ChangeLog
+++ b/doc/ChangeLog
@@ -1,3 +1,13 @@
+2014-08-03 Arnold D. Robbins <arnold@skeeve.com>
+
+ * gawktexi.in: For sprintf %c document that if value is a valid
+ wide character, gawk uses the low 8 bits of the value.
+
+ Unrelated:
+
+ * gawktexi.in: Fix doc for API get_record - errcode needs to
+ be greater than zero.
+
2014-07-24 Arnold D. Robbins <arnold@skeeve.com>
* gawktexi.in (Numeric Functions): For `div()', clarify
diff --git a/doc/gawk.info b/doc/gawk.info
index e6c9a5d4..88f0a6fb 100644
--- a/doc/gawk.info
+++ b/doc/gawk.info
@@ -6275,7 +6275,9 @@ width. Here is a list of the format-control letters:
valid wide character and then to print the multibyte encoding
of that character. Similarly, when printing a numeric value,
`gawk' allows the value to be within the numeric range of
- values that can be held in a wide character.
+ values that can be held in a wide character. If the
+ conversion to multibyte encoding fails, `gawk' uses the low
+ eight bits of the value as the character to print.
Other `awk' versions generally restrict themselves to printing
the first byte of a string or to numeric values within the
@@ -23198,10 +23200,10 @@ need to test for a `NULL' value. `gawk' sets `*errcode' to zero, so
there is no need to set it unless an error occurs.
If an error does occur, the function should return `EOF' and set
-`*errcode' to a non-zero value. In that case, if `*errcode' does not
-equal -1, `gawk' automatically updates the `ERRNO' variable based on
-the value of `*errcode'. (In general, setting `*errcode = errno'
-should do the right thing.)
+`*errcode' to a value greater than zero. In that case, if `*errcode'
+does not equal zero, `gawk' automatically updates the `ERRNO' variable
+based on the value of `*errcode'. (In general, setting `*errcode =
+errno' should do the right thing.)
As an alternative to supplying a function that returns an input
record, you may instead supply a function that simply reads bytes, and
@@ -34113,431 +34115,431 @@ Node: OFMT271658
Node: Printf273016
Node: Basic Printf273922
Node: Control Letters275461
-Node: Format Modifiers279313
-Node: Printf Examples285340
-Node: Redirection287804
-Node: Special Files294776
-Node: Special FD295307
-Ref: Special FD-Footnote-1298931
-Node: Special Network299005
-Node: Special Caveats299855
-Node: Close Files And Pipes300651
-Ref: Close Files And Pipes-Footnote-1307812
-Ref: Close Files And Pipes-Footnote-2307960
-Node: Output Summary308110
-Node: Output exercises309107
-Node: Expressions309787
-Node: Values310972
-Node: Constants311648
-Node: Scalar Constants312328
-Ref: Scalar Constants-Footnote-1313187
-Node: Nondecimal-numbers313437
-Node: Regexp Constants316437
-Node: Using Constant Regexps316912
-Node: Variables319982
-Node: Using Variables320637
-Node: Assignment Options322361
-Node: Conversion324236
-Node: Strings And Numbers324760
-Ref: Strings And Numbers-Footnote-1327822
-Node: Locale influences conversions327931
-Ref: table-locale-affects330648
-Node: All Operators331236
-Node: Arithmetic Ops331866
-Node: Concatenation334371
-Ref: Concatenation-Footnote-1337167
-Node: Assignment Ops337287
-Ref: table-assign-ops342270
-Node: Increment Ops343587
-Node: Truth Values and Conditions347025
-Node: Truth Values348108
-Node: Typing and Comparison349157
-Node: Variable Typing349950
-Ref: Variable Typing-Footnote-1353850
-Node: Comparison Operators353972
-Ref: table-relational-ops354382
-Node: POSIX String Comparison357932
-Ref: POSIX String Comparison-Footnote-1359016
-Node: Boolean Ops359154
-Ref: Boolean Ops-Footnote-1363224
-Node: Conditional Exp363315
-Node: Function Calls365042
-Node: Precedence368922
-Node: Locales372591
-Node: Expressions Summary374222
-Node: Patterns and Actions376763
-Node: Pattern Overview377879
-Node: Regexp Patterns379556
-Node: Expression Patterns380099
-Node: Ranges383880
-Node: BEGIN/END386986
-Node: Using BEGIN/END387748
-Ref: Using BEGIN/END-Footnote-1390484
-Node: I/O And BEGIN/END390590
-Node: BEGINFILE/ENDFILE392875
-Node: Empty395806
-Node: Using Shell Variables396123
-Node: Action Overview398406
-Node: Statements400733
-Node: If Statement402581
-Node: While Statement404079
-Node: Do Statement406123
-Node: For Statement407279
-Node: Switch Statement410431
-Node: Break Statement412534
-Node: Continue Statement414589
-Node: Next Statement416382
-Node: Nextfile Statement418772
-Node: Exit Statement421427
-Node: Built-in Variables423831
-Node: User-modified424958
-Ref: User-modified-Footnote-1432647
-Node: Auto-set432709
-Ref: Auto-set-Footnote-1445628
-Ref: Auto-set-Footnote-2445833
-Node: ARGC and ARGV445889
-Node: Pattern Action Summary449743
-Node: Arrays451966
-Node: Array Basics453515
-Node: Array Intro454341
-Ref: figure-array-elements456314
-Node: Reference to Elements458721
-Node: Assigning Elements460994
-Node: Array Example461485
-Node: Scanning an Array463217
-Node: Controlling Scanning466232
-Ref: Controlling Scanning-Footnote-1471405
-Node: Delete471721
-Ref: Delete-Footnote-1474486
-Node: Numeric Array Subscripts474543
-Node: Uninitialized Subscripts476726
-Node: Multidimensional478351
-Node: Multiscanning481444
-Node: Arrays of Arrays483033
-Node: Arrays Summary487696
-Node: Functions489801
-Node: Built-in490674
-Node: Calling Built-in491752
-Node: Numeric Functions493740
-Ref: Numeric Functions-Footnote-1498376
-Ref: Numeric Functions-Footnote-2498733
-Ref: Numeric Functions-Footnote-3498781
-Node: String Functions499050
-Ref: String Functions-Footnote-1522061
-Ref: String Functions-Footnote-2522190
-Ref: String Functions-Footnote-3522438
-Node: Gory Details522525
-Ref: table-sub-escapes524194
-Ref: table-sub-posix-92525548
-Ref: table-sub-proposed526899
-Ref: table-posix-sub528253
-Ref: table-gensub-escapes529798
-Ref: Gory Details-Footnote-1530974
-Ref: Gory Details-Footnote-2531025
-Node: I/O Functions531176
-Ref: I/O Functions-Footnote-1538299
-Node: Time Functions538446
-Ref: Time Functions-Footnote-1548910
-Ref: Time Functions-Footnote-2548978
-Ref: Time Functions-Footnote-3549136
-Ref: Time Functions-Footnote-4549247
-Ref: Time Functions-Footnote-5549359
-Ref: Time Functions-Footnote-6549586
-Node: Bitwise Functions549852
-Ref: table-bitwise-ops550414
-Ref: Bitwise Functions-Footnote-1554659
-Node: Type Functions554843
-Node: I18N Functions555985
-Node: User-defined557630
-Node: Definition Syntax558434
-Ref: Definition Syntax-Footnote-1563613
-Node: Function Example563682
-Ref: Function Example-Footnote-1566326
-Node: Function Caveats566348
-Node: Calling A Function566866
-Node: Variable Scope567821
-Node: Pass By Value/Reference570809
-Node: Return Statement574317
-Node: Dynamic Typing577301
-Node: Indirect Calls578230
-Node: Functions Summary587943
-Node: Library Functions590482
-Ref: Library Functions-Footnote-1594100
-Ref: Library Functions-Footnote-2594243
-Node: Library Names594414
-Ref: Library Names-Footnote-1597887
-Ref: Library Names-Footnote-2598107
-Node: General Functions598193
-Node: Strtonum Function599221
-Node: Assert Function602001
-Node: Round Function605327
-Node: Cliff Random Function606868
-Node: Ordinal Functions607884
-Ref: Ordinal Functions-Footnote-1610961
-Ref: Ordinal Functions-Footnote-2611213
-Node: Join Function611424
-Ref: Join Function-Footnote-1613195
-Node: Getlocaltime Function613395
-Node: Readfile Function617131
-Node: Data File Management618970
-Node: Filetrans Function619602
-Node: Rewind Function623671
-Node: File Checking625058
-Ref: File Checking-Footnote-1626190
-Node: Empty Files626391
-Node: Ignoring Assigns628370
-Node: Getopt Function629924
-Ref: Getopt Function-Footnote-1641227
-Node: Passwd Functions641430
-Ref: Passwd Functions-Footnote-1650409
-Node: Group Functions650497
-Ref: Group Functions-Footnote-1658438
-Node: Walking Arrays658651
-Node: Library Functions Summary660254
-Node: Library exercises661642
-Node: Sample Programs662922
-Node: Running Examples663692
-Node: Clones664420
-Node: Cut Program665644
-Node: Egrep Program675512
-Ref: Egrep Program-Footnote-1683483
-Node: Id Program683593
-Node: Split Program687257
-Ref: Split Program-Footnote-1690795
-Node: Tee Program690923
-Node: Uniq Program693730
-Node: Wc Program701160
-Ref: Wc Program-Footnote-1705425
-Node: Miscellaneous Programs705517
-Node: Dupword Program706730
-Node: Alarm Program708761
-Node: Translate Program713575
-Ref: Translate Program-Footnote-1717966
-Ref: Translate Program-Footnote-2718236
-Node: Labels Program718370
-Ref: Labels Program-Footnote-1721741
-Node: Word Sorting721825
-Node: History Sorting725868
-Node: Extract Program727704
-Node: Simple Sed735240
-Node: Igawk Program738302
-Ref: Igawk Program-Footnote-1752613
-Ref: Igawk Program-Footnote-2752814
-Node: Anagram Program752952
-Node: Signature Program756020
-Node: Programs Summary757267
-Node: Programs Exercises758482
-Node: Advanced Features762133
-Node: Nondecimal Data764081
-Node: Array Sorting765658
-Node: Controlling Array Traversal766355
-Node: Array Sorting Functions774635
-Ref: Array Sorting Functions-Footnote-1778542
-Node: Two-way I/O778736
-Ref: Two-way I/O-Footnote-1784252
-Node: TCP/IP Networking784334
-Node: Profiling787178
-Node: Advanced Features Summary794729
-Node: Internationalization796593
-Node: I18N and L10N798073
-Node: Explaining gettext798759
-Ref: Explaining gettext-Footnote-1803899
-Ref: Explaining gettext-Footnote-2804083
-Node: Programmer i18n804248
-Node: Translator i18n808473
-Node: String Extraction809267
-Ref: String Extraction-Footnote-1810228
-Node: Printf Ordering810314
-Ref: Printf Ordering-Footnote-1813096
-Node: I18N Portability813160
-Ref: I18N Portability-Footnote-1815609
-Node: I18N Example815672
-Ref: I18N Example-Footnote-1818394
-Node: Gawk I18N818466
-Node: I18N Summary819104
-Node: Debugger820443
-Node: Debugging821465
-Node: Debugging Concepts821906
-Node: Debugging Terms823762
-Node: Awk Debugging826359
-Node: Sample Debugging Session827251
-Node: Debugger Invocation827771
-Node: Finding The Bug829104
-Node: List of Debugger Commands835586
-Node: Breakpoint Control836918
-Node: Debugger Execution Control840582
-Node: Viewing And Changing Data843942
-Node: Execution Stack847300
-Node: Debugger Info848813
-Node: Miscellaneous Debugger Commands852807
-Node: Readline Support857991
-Node: Limitations858883
-Node: Debugging Summary861157
-Node: Arbitrary Precision Arithmetic862321
-Node: Computer Arithmetic863650
-Ref: Computer Arithmetic-Footnote-1868037
-Node: Math Definitions868094
-Ref: table-ieee-formats870978
-Node: MPFR features871482
-Node: FP Math Caution873124
-Ref: FP Math Caution-Footnote-1874165
-Node: Inexactness of computations874534
-Node: Inexact representation875482
-Node: Comparing FP Values876837
-Node: Errors accumulate877801
-Node: Getting Accuracy879234
-Node: Try To Round881893
-Node: Setting precision882792
-Ref: table-predefined-precision-strings883474
-Node: Setting the rounding mode885267
-Ref: table-gawk-rounding-modes885631
-Ref: Setting the rounding mode-Footnote-1889085
-Node: Arbitrary Precision Integers889264
-Ref: Arbitrary Precision Integers-Footnote-1893059
-Node: POSIX Floating Point Problems893208
-Ref: POSIX Floating Point Problems-Footnote-1897084
-Node: Floating point summary897122
-Node: Dynamic Extensions899339
-Node: Extension Intro900891
-Node: Plugin License902156
-Node: Extension Mechanism Outline902841
-Ref: figure-load-extension903265
-Ref: figure-load-new-function904750
-Ref: figure-call-new-function905752
-Node: Extension API Description907736
-Node: Extension API Functions Introduction909186
-Node: General Data Types914051
-Ref: General Data Types-Footnote-1919744
-Node: Requesting Values920043
-Ref: table-value-types-returned920780
-Node: Memory Allocation Functions921738
-Ref: Memory Allocation Functions-Footnote-1924485
-Node: Constructor Functions924581
-Node: Registration Functions926339
-Node: Extension Functions927024
-Node: Exit Callback Functions929326
-Node: Extension Version String930575
-Node: Input Parsers931225
-Node: Output Wrappers941028
-Node: Two-way processors945544
-Node: Printing Messages947748
-Ref: Printing Messages-Footnote-1948825
-Node: Updating `ERRNO'948977
-Node: Accessing Parameters949716
-Node: Symbol Table Access950946
-Node: Symbol table by name951460
-Node: Symbol table by cookie953436
-Ref: Symbol table by cookie-Footnote-1957569
-Node: Cached values957632
-Ref: Cached values-Footnote-1961136
-Node: Array Manipulation961227
-Ref: Array Manipulation-Footnote-1962325
-Node: Array Data Types962364
-Ref: Array Data Types-Footnote-1965067
-Node: Array Functions965159
-Node: Flattening Arrays969033
-Node: Creating Arrays975885
-Node: Extension API Variables980616
-Node: Extension Versioning981252
-Node: Extension API Informational Variables983153
-Node: Extension API Boilerplate984239
-Node: Finding Extensions988043
-Node: Extension Example988603
-Node: Internal File Description989333
-Node: Internal File Ops993424
-Ref: Internal File Ops-Footnote-11004856
-Node: Using Internal File Ops1004996
-Ref: Using Internal File Ops-Footnote-11007343
-Node: Extension Samples1007611
-Node: Extension Sample File Functions1009135
-Node: Extension Sample Fnmatch1016703
-Node: Extension Sample Fork1018185
-Node: Extension Sample Inplace1019398
-Node: Extension Sample Ord1021073
-Node: Extension Sample Readdir1021909
-Ref: table-readdir-file-types1022765
-Node: Extension Sample Revout1023564
-Node: Extension Sample Rev2way1024155
-Node: Extension Sample Read write array1024896
-Node: Extension Sample Readfile1026775
-Node: Extension Sample API Tests1027875
-Node: Extension Sample Time1028400
-Node: gawkextlib1029715
-Node: Extension summary1032528
-Node: Extension Exercises1036221
-Node: Language History1036943
-Node: V7/SVR3.11038586
-Node: SVR41040906
-Node: POSIX1042348
-Node: BTL1043734
-Node: POSIX/GNU1044468
-Node: Feature History1050067
-Node: Common Extensions1063197
-Node: Ranges and Locales1064509
-Ref: Ranges and Locales-Footnote-11069126
-Ref: Ranges and Locales-Footnote-21069153
-Ref: Ranges and Locales-Footnote-31069387
-Node: Contributors1069608
-Node: History summary1075033
-Node: Installation1076402
-Node: Gawk Distribution1077353
-Node: Getting1077837
-Node: Extracting1078661
-Node: Distribution contents1080303
-Node: Unix Installation1086073
-Node: Quick Installation1086690
-Node: Additional Configuration Options1089132
-Node: Configuration Philosophy1090870
-Node: Non-Unix Installation1093221
-Node: PC Installation1093679
-Node: PC Binary Installation1094990
-Node: PC Compiling1096838
-Ref: PC Compiling-Footnote-11099837
-Node: PC Testing1099942
-Node: PC Using1101118
-Node: Cygwin1105276
-Node: MSYS1106085
-Node: VMS Installation1106599
-Node: VMS Compilation1107395
-Ref: VMS Compilation-Footnote-11108617
-Node: VMS Dynamic Extensions1108675
-Node: VMS Installation Details1110048
-Node: VMS Running1112300
-Node: VMS GNV1115134
-Node: VMS Old Gawk1115857
-Node: Bugs1116327
-Node: Other Versions1120331
-Node: Installation summary1126586
-Node: Notes1127642
-Node: Compatibility Mode1128507
-Node: Additions1129289
-Node: Accessing The Source1130214
-Node: Adding Code1131650
-Node: New Ports1137828
-Node: Derived Files1142309
-Ref: Derived Files-Footnote-11147390
-Ref: Derived Files-Footnote-21147424
-Ref: Derived Files-Footnote-31148020
-Node: Future Extensions1148134
-Node: Implementation Limitations1148740
-Node: Extension Design1149988
-Node: Old Extension Problems1151142
-Ref: Old Extension Problems-Footnote-11152659
-Node: Extension New Mechanism Goals1152716
-Ref: Extension New Mechanism Goals-Footnote-11156076
-Node: Extension Other Design Decisions1156265
-Node: Extension Future Growth1158371
-Node: Old Extension Mechanism1159207
-Node: Notes summary1160969
-Node: Basic Concepts1162155
-Node: Basic High Level1162836
-Ref: figure-general-flow1163108
-Ref: figure-process-flow1163707
-Ref: Basic High Level-Footnote-11166936
-Node: Basic Data Typing1167121
-Node: Glossary1170449
-Node: Copying1195601
-Node: GNU Free Documentation License1233157
-Node: Index1258293
+Node: Format Modifiers279452
+Node: Printf Examples285479
+Node: Redirection287943
+Node: Special Files294915
+Node: Special FD295446
+Ref: Special FD-Footnote-1299070
+Node: Special Network299144
+Node: Special Caveats299994
+Node: Close Files And Pipes300790
+Ref: Close Files And Pipes-Footnote-1307951
+Ref: Close Files And Pipes-Footnote-2308099
+Node: Output Summary308249
+Node: Output exercises309246
+Node: Expressions309926
+Node: Values311111
+Node: Constants311787
+Node: Scalar Constants312467
+Ref: Scalar Constants-Footnote-1313326
+Node: Nondecimal-numbers313576
+Node: Regexp Constants316576
+Node: Using Constant Regexps317051
+Node: Variables320121
+Node: Using Variables320776
+Node: Assignment Options322500
+Node: Conversion324375
+Node: Strings And Numbers324899
+Ref: Strings And Numbers-Footnote-1327961
+Node: Locale influences conversions328070
+Ref: table-locale-affects330787
+Node: All Operators331375
+Node: Arithmetic Ops332005
+Node: Concatenation334510
+Ref: Concatenation-Footnote-1337306
+Node: Assignment Ops337426
+Ref: table-assign-ops342409
+Node: Increment Ops343726
+Node: Truth Values and Conditions347164
+Node: Truth Values348247
+Node: Typing and Comparison349296
+Node: Variable Typing350089
+Ref: Variable Typing-Footnote-1353989
+Node: Comparison Operators354111
+Ref: table-relational-ops354521
+Node: POSIX String Comparison358071
+Ref: POSIX String Comparison-Footnote-1359155
+Node: Boolean Ops359293
+Ref: Boolean Ops-Footnote-1363363
+Node: Conditional Exp363454
+Node: Function Calls365181
+Node: Precedence369061
+Node: Locales372730
+Node: Expressions Summary374361
+Node: Patterns and Actions376902
+Node: Pattern Overview378018
+Node: Regexp Patterns379695
+Node: Expression Patterns380238
+Node: Ranges384019
+Node: BEGIN/END387125
+Node: Using BEGIN/END387887
+Ref: Using BEGIN/END-Footnote-1390623
+Node: I/O And BEGIN/END390729
+Node: BEGINFILE/ENDFILE393014
+Node: Empty395945
+Node: Using Shell Variables396262
+Node: Action Overview398545
+Node: Statements400872
+Node: If Statement402720
+Node: While Statement404218
+Node: Do Statement406262
+Node: For Statement407418
+Node: Switch Statement410570
+Node: Break Statement412673
+Node: Continue Statement414728
+Node: Next Statement416521
+Node: Nextfile Statement418911
+Node: Exit Statement421566
+Node: Built-in Variables423970
+Node: User-modified425097
+Ref: User-modified-Footnote-1432786
+Node: Auto-set432848
+Ref: Auto-set-Footnote-1445767
+Ref: Auto-set-Footnote-2445972
+Node: ARGC and ARGV446028
+Node: Pattern Action Summary449882
+Node: Arrays452105
+Node: Array Basics453654
+Node: Array Intro454480
+Ref: figure-array-elements456453
+Node: Reference to Elements458860
+Node: Assigning Elements461133
+Node: Array Example461624
+Node: Scanning an Array463356
+Node: Controlling Scanning466371
+Ref: Controlling Scanning-Footnote-1471544
+Node: Delete471860
+Ref: Delete-Footnote-1474625
+Node: Numeric Array Subscripts474682
+Node: Uninitialized Subscripts476865
+Node: Multidimensional478490
+Node: Multiscanning481583
+Node: Arrays of Arrays483172
+Node: Arrays Summary487835
+Node: Functions489940
+Node: Built-in490813
+Node: Calling Built-in491891
+Node: Numeric Functions493879
+Ref: Numeric Functions-Footnote-1498515
+Ref: Numeric Functions-Footnote-2498872
+Ref: Numeric Functions-Footnote-3498920
+Node: String Functions499189
+Ref: String Functions-Footnote-1522200
+Ref: String Functions-Footnote-2522329
+Ref: String Functions-Footnote-3522577
+Node: Gory Details522664
+Ref: table-sub-escapes524333
+Ref: table-sub-posix-92525687
+Ref: table-sub-proposed527038
+Ref: table-posix-sub528392
+Ref: table-gensub-escapes529937
+Ref: Gory Details-Footnote-1531113
+Ref: Gory Details-Footnote-2531164
+Node: I/O Functions531315
+Ref: I/O Functions-Footnote-1538438
+Node: Time Functions538585
+Ref: Time Functions-Footnote-1549049
+Ref: Time Functions-Footnote-2549117
+Ref: Time Functions-Footnote-3549275
+Ref: Time Functions-Footnote-4549386
+Ref: Time Functions-Footnote-5549498
+Ref: Time Functions-Footnote-6549725
+Node: Bitwise Functions549991
+Ref: table-bitwise-ops550553
+Ref: Bitwise Functions-Footnote-1554798
+Node: Type Functions554982
+Node: I18N Functions556124
+Node: User-defined557769
+Node: Definition Syntax558573
+Ref: Definition Syntax-Footnote-1563752
+Node: Function Example563821
+Ref: Function Example-Footnote-1566465
+Node: Function Caveats566487
+Node: Calling A Function567005
+Node: Variable Scope567960
+Node: Pass By Value/Reference570948
+Node: Return Statement574456
+Node: Dynamic Typing577440
+Node: Indirect Calls578369
+Node: Functions Summary588082
+Node: Library Functions590621
+Ref: Library Functions-Footnote-1594239
+Ref: Library Functions-Footnote-2594382
+Node: Library Names594553
+Ref: Library Names-Footnote-1598026
+Ref: Library Names-Footnote-2598246
+Node: General Functions598332
+Node: Strtonum Function599360
+Node: Assert Function602140
+Node: Round Function605466
+Node: Cliff Random Function607007
+Node: Ordinal Functions608023
+Ref: Ordinal Functions-Footnote-1611100
+Ref: Ordinal Functions-Footnote-2611352
+Node: Join Function611563
+Ref: Join Function-Footnote-1613334
+Node: Getlocaltime Function613534
+Node: Readfile Function617270
+Node: Data File Management619109
+Node: Filetrans Function619741
+Node: Rewind Function623810
+Node: File Checking625197
+Ref: File Checking-Footnote-1626329
+Node: Empty Files626530
+Node: Ignoring Assigns628509
+Node: Getopt Function630063
+Ref: Getopt Function-Footnote-1641366
+Node: Passwd Functions641569
+Ref: Passwd Functions-Footnote-1650548
+Node: Group Functions650636
+Ref: Group Functions-Footnote-1658577
+Node: Walking Arrays658790
+Node: Library Functions Summary660393
+Node: Library exercises661781
+Node: Sample Programs663061
+Node: Running Examples663831
+Node: Clones664559
+Node: Cut Program665783
+Node: Egrep Program675651
+Ref: Egrep Program-Footnote-1683622
+Node: Id Program683732
+Node: Split Program687396
+Ref: Split Program-Footnote-1690934
+Node: Tee Program691062
+Node: Uniq Program693869
+Node: Wc Program701299
+Ref: Wc Program-Footnote-1705564
+Node: Miscellaneous Programs705656
+Node: Dupword Program706869
+Node: Alarm Program708900
+Node: Translate Program713714
+Ref: Translate Program-Footnote-1718105
+Ref: Translate Program-Footnote-2718375
+Node: Labels Program718509
+Ref: Labels Program-Footnote-1721880
+Node: Word Sorting721964
+Node: History Sorting726007
+Node: Extract Program727843
+Node: Simple Sed735379
+Node: Igawk Program738441
+Ref: Igawk Program-Footnote-1752752
+Ref: Igawk Program-Footnote-2752953
+Node: Anagram Program753091
+Node: Signature Program756159
+Node: Programs Summary757406
+Node: Programs Exercises758621
+Node: Advanced Features762272
+Node: Nondecimal Data764220
+Node: Array Sorting765797
+Node: Controlling Array Traversal766494
+Node: Array Sorting Functions774774
+Ref: Array Sorting Functions-Footnote-1778681
+Node: Two-way I/O778875
+Ref: Two-way I/O-Footnote-1784391
+Node: TCP/IP Networking784473
+Node: Profiling787317
+Node: Advanced Features Summary794868
+Node: Internationalization796732
+Node: I18N and L10N798212
+Node: Explaining gettext798898
+Ref: Explaining gettext-Footnote-1804038
+Ref: Explaining gettext-Footnote-2804222
+Node: Programmer i18n804387
+Node: Translator i18n808612
+Node: String Extraction809406
+Ref: String Extraction-Footnote-1810367
+Node: Printf Ordering810453
+Ref: Printf Ordering-Footnote-1813235
+Node: I18N Portability813299
+Ref: I18N Portability-Footnote-1815748
+Node: I18N Example815811
+Ref: I18N Example-Footnote-1818533
+Node: Gawk I18N818605
+Node: I18N Summary819243
+Node: Debugger820582
+Node: Debugging821604
+Node: Debugging Concepts822045
+Node: Debugging Terms823901
+Node: Awk Debugging826498
+Node: Sample Debugging Session827390
+Node: Debugger Invocation827910
+Node: Finding The Bug829243
+Node: List of Debugger Commands835725
+Node: Breakpoint Control837057
+Node: Debugger Execution Control840721
+Node: Viewing And Changing Data844081
+Node: Execution Stack847439
+Node: Debugger Info848952
+Node: Miscellaneous Debugger Commands852946
+Node: Readline Support858130
+Node: Limitations859022
+Node: Debugging Summary861296
+Node: Arbitrary Precision Arithmetic862460
+Node: Computer Arithmetic863789
+Ref: Computer Arithmetic-Footnote-1868176
+Node: Math Definitions868233
+Ref: table-ieee-formats871117
+Node: MPFR features871621
+Node: FP Math Caution873263
+Ref: FP Math Caution-Footnote-1874304
+Node: Inexactness of computations874673
+Node: Inexact representation875621
+Node: Comparing FP Values876976
+Node: Errors accumulate877940
+Node: Getting Accuracy879373
+Node: Try To Round882032
+Node: Setting precision882931
+Ref: table-predefined-precision-strings883613
+Node: Setting the rounding mode885406
+Ref: table-gawk-rounding-modes885770
+Ref: Setting the rounding mode-Footnote-1889224
+Node: Arbitrary Precision Integers889403
+Ref: Arbitrary Precision Integers-Footnote-1893198
+Node: POSIX Floating Point Problems893347
+Ref: POSIX Floating Point Problems-Footnote-1897223
+Node: Floating point summary897261
+Node: Dynamic Extensions899478
+Node: Extension Intro901030
+Node: Plugin License902295
+Node: Extension Mechanism Outline902980
+Ref: figure-load-extension903404
+Ref: figure-load-new-function904889
+Ref: figure-call-new-function905891
+Node: Extension API Description907875
+Node: Extension API Functions Introduction909325
+Node: General Data Types914190
+Ref: General Data Types-Footnote-1919883
+Node: Requesting Values920182
+Ref: table-value-types-returned920919
+Node: Memory Allocation Functions921877
+Ref: Memory Allocation Functions-Footnote-1924624
+Node: Constructor Functions924720
+Node: Registration Functions926478
+Node: Extension Functions927163
+Node: Exit Callback Functions929465
+Node: Extension Version String930714
+Node: Input Parsers931364
+Node: Output Wrappers941178
+Node: Two-way processors945694
+Node: Printing Messages947898
+Ref: Printing Messages-Footnote-1948975
+Node: Updating `ERRNO'949127
+Node: Accessing Parameters949866
+Node: Symbol Table Access951096
+Node: Symbol table by name951610
+Node: Symbol table by cookie953586
+Ref: Symbol table by cookie-Footnote-1957719
+Node: Cached values957782
+Ref: Cached values-Footnote-1961286
+Node: Array Manipulation961377
+Ref: Array Manipulation-Footnote-1962475
+Node: Array Data Types962514
+Ref: Array Data Types-Footnote-1965217
+Node: Array Functions965309
+Node: Flattening Arrays969183
+Node: Creating Arrays976035
+Node: Extension API Variables980766
+Node: Extension Versioning981402
+Node: Extension API Informational Variables983303
+Node: Extension API Boilerplate984389
+Node: Finding Extensions988193
+Node: Extension Example988753
+Node: Internal File Description989483
+Node: Internal File Ops993574
+Ref: Internal File Ops-Footnote-11005006
+Node: Using Internal File Ops1005146
+Ref: Using Internal File Ops-Footnote-11007493
+Node: Extension Samples1007761
+Node: Extension Sample File Functions1009285
+Node: Extension Sample Fnmatch1016853
+Node: Extension Sample Fork1018335
+Node: Extension Sample Inplace1019548
+Node: Extension Sample Ord1021223
+Node: Extension Sample Readdir1022059
+Ref: table-readdir-file-types1022915
+Node: Extension Sample Revout1023714
+Node: Extension Sample Rev2way1024305
+Node: Extension Sample Read write array1025046
+Node: Extension Sample Readfile1026925
+Node: Extension Sample API Tests1028025
+Node: Extension Sample Time1028550
+Node: gawkextlib1029865
+Node: Extension summary1032678
+Node: Extension Exercises1036371
+Node: Language History1037093
+Node: V7/SVR3.11038736
+Node: SVR41041056
+Node: POSIX1042498
+Node: BTL1043884
+Node: POSIX/GNU1044618
+Node: Feature History1050217
+Node: Common Extensions1063347
+Node: Ranges and Locales1064659
+Ref: Ranges and Locales-Footnote-11069276
+Ref: Ranges and Locales-Footnote-21069303
+Ref: Ranges and Locales-Footnote-31069537
+Node: Contributors1069758
+Node: History summary1075183
+Node: Installation1076552
+Node: Gawk Distribution1077503
+Node: Getting1077987
+Node: Extracting1078811
+Node: Distribution contents1080453
+Node: Unix Installation1086223
+Node: Quick Installation1086840
+Node: Additional Configuration Options1089282
+Node: Configuration Philosophy1091020
+Node: Non-Unix Installation1093371
+Node: PC Installation1093829
+Node: PC Binary Installation1095140
+Node: PC Compiling1096988
+Ref: PC Compiling-Footnote-11099987
+Node: PC Testing1100092
+Node: PC Using1101268
+Node: Cygwin1105426
+Node: MSYS1106235
+Node: VMS Installation1106749
+Node: VMS Compilation1107545
+Ref: VMS Compilation-Footnote-11108767
+Node: VMS Dynamic Extensions1108825
+Node: VMS Installation Details1110198
+Node: VMS Running1112450
+Node: VMS GNV1115284
+Node: VMS Old Gawk1116007
+Node: Bugs1116477
+Node: Other Versions1120481
+Node: Installation summary1126736
+Node: Notes1127792
+Node: Compatibility Mode1128657
+Node: Additions1129439
+Node: Accessing The Source1130364
+Node: Adding Code1131800
+Node: New Ports1137978
+Node: Derived Files1142459
+Ref: Derived Files-Footnote-11147540
+Ref: Derived Files-Footnote-21147574
+Ref: Derived Files-Footnote-31148170
+Node: Future Extensions1148284
+Node: Implementation Limitations1148890
+Node: Extension Design1150138
+Node: Old Extension Problems1151292
+Ref: Old Extension Problems-Footnote-11152809
+Node: Extension New Mechanism Goals1152866
+Ref: Extension New Mechanism Goals-Footnote-11156226
+Node: Extension Other Design Decisions1156415
+Node: Extension Future Growth1158521
+Node: Old Extension Mechanism1159357
+Node: Notes summary1161119
+Node: Basic Concepts1162305
+Node: Basic High Level1162986
+Ref: figure-general-flow1163258
+Ref: figure-process-flow1163857
+Ref: Basic High Level-Footnote-11167086
+Node: Basic Data Typing1167271
+Node: Glossary1170599
+Node: Copying1195751
+Node: GNU Free Documentation License1233307
+Node: Index1258443

End Tag Table
diff --git a/doc/gawk.texi b/doc/gawk.texi
index 1fb343de..b4c167ae 100644
--- a/doc/gawk.texi
+++ b/doc/gawk.texi
@@ -9022,6 +9022,8 @@ and then to print the multibyte encoding of that character.
Similarly, when printing a numeric value, @command{gawk} allows the
value to be within the numeric range of values that can be held
in a wide character.
+If the conversion to multibyte encoding fails, @command{gawk}
+uses the low eight bits of the value as the character to print.
Other @command{awk} versions generally restrict themselves to printing
the first byte of a string or to numeric values within the range of
@@ -31872,8 +31874,8 @@ need to test for a @code{NULL} value. @command{gawk} sets @code{*errcode}
to zero, so there is no need to set it unless an error occurs.
If an error does occur, the function should return @code{EOF} and set
-@code{*errcode} to a non-zero value. In that case, if @code{*errcode}
-does not equal @minus{}1, @command{gawk} automatically updates
+@code{*errcode} to a value greater than zero. In that case, if @code{*errcode}
+does not equal zero, @command{gawk} automatically updates
the @code{ERRNO} variable based on the value of @code{*errcode}.
(In general, setting @samp{*errcode = errno} should do the right thing.)
diff --git a/doc/gawktexi.in b/doc/gawktexi.in
index 93139a04..5d599d5e 100644
--- a/doc/gawktexi.in
+++ b/doc/gawktexi.in
@@ -8641,6 +8641,8 @@ and then to print the multibyte encoding of that character.
Similarly, when printing a numeric value, @command{gawk} allows the
value to be within the numeric range of values that can be held
in a wide character.
+If the conversion to multibyte encoding fails, @command{gawk}
+uses the low eight bits of the value as the character to print.
Other @command{awk} versions generally restrict themselves to printing
the first byte of a string or to numeric values within the range of
@@ -30987,8 +30989,8 @@ need to test for a @code{NULL} value. @command{gawk} sets @code{*errcode}
to zero, so there is no need to set it unless an error occurs.
If an error does occur, the function should return @code{EOF} and set
-@code{*errcode} to a non-zero value. In that case, if @code{*errcode}
-does not equal @minus{}1, @command{gawk} automatically updates
+@code{*errcode} to a value greater than zero. In that case, if @code{*errcode}
+does not equal zero, @command{gawk} automatically updates
the @code{ERRNO} variable based on the value of @code{*errcode}.
(In general, setting @samp{*errcode = errno} should do the right thing.)
diff --git a/gawkapi.h b/gawkapi.h
index 5ccadc21..090cf797 100644
--- a/gawkapi.h
+++ b/gawkapi.h
@@ -142,8 +142,8 @@ typedef struct awk_input {
* so there is no need to set it unless an error occurs.
*
* If an error does occur, the function should return EOF and set
- * *errcode to a non-zero value. In that case, if *errcode does not
- * equal -1, gawk will automatically update the ERRNO variable based
+ * *errcode to a positive value. In that case, if *errcode is greater
+ * than zero, gawk will automatically update the ERRNO variable based
* on the value of *errcode (e.g., setting *errcode = errno should do
* the right thing).
*/
diff --git a/interpret.h b/interpret.h
index ff9ba768..c26a9d46 100644
--- a/interpret.h
+++ b/interpret.h
@@ -1192,9 +1192,12 @@ match_re:
}
if (! inrec(curfile, & errcode)) {
- if (errcode > 0 && (do_traditional || ! pc->has_endfile))
- fatal(_("error reading input file `%s': %s"),
+ if (errcode > 0) {
+ update_ERRNO_int(errcode);
+ if (do_traditional || ! pc->has_endfile)
+ fatal(_("error reading input file `%s': %s"),
curfile->public.name, strerror(errcode));
+ }
JUMPTO(ni);
} /* else
diff --git a/io.c b/io.c
index 45b5015f..7930904d 100644
--- a/io.c
+++ b/io.c
@@ -590,16 +590,12 @@ inrec(IOBUF *iop, int *errcode)
if (cnt == EOF) {
retval = false;
- if (*errcode > 0)
- update_ERRNO_int(*errcode);
} else {
INCREMENT_REC(NR);
INCREMENT_REC(FNR);
set_record(begin, cnt);
- if (*errcode > 0) {
- update_ERRNO_int(*errcode);
+ if (*errcode > 0)
retval = false;
- }
}
return retval;