summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--doc/ChangeLog5
-rw-r--r--doc/gawk.info250
-rw-r--r--doc/gawk.texi4
-rw-r--r--doc/gawktexi.in4
-rw-r--r--gawkapi.h4
-rw-r--r--interpret.h7
-rw-r--r--io.c6
8 files changed, 149 insertions, 138 deletions
diff --git a/ChangeLog b/ChangeLog
index 6d7a2dac..ba56b20a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,13 @@
* 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>
diff --git a/doc/ChangeLog b/doc/ChangeLog
index 1b71b0ed..6f88e3a4 100644
--- a/doc/ChangeLog
+++ b/doc/ChangeLog
@@ -3,6 +3,11 @@
* 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-04 Arnold D. Robbins <arnold@skeeve.com>
* gawktexi.in (Bracket Expressions): Add a note about how to
diff --git a/doc/gawk.info b/doc/gawk.info
index e1b07c80..8ca20ccc 100644
--- a/doc/gawk.info
+++ b/doc/gawk.info
@@ -23161,10 +23161,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
@@ -34379,126 +34379,126 @@ Node: Extension Functions925557
Node: Exit Callback Functions927859
Node: Extension Version String929108
Node: Input Parsers929758
-Node: Output Wrappers939561
-Node: Two-way processors944077
-Node: Printing Messages946281
-Ref: Printing Messages-Footnote-1947358
-Node: Updating `ERRNO'947510
-Node: Accessing Parameters948249
-Node: Symbol Table Access949479
-Node: Symbol table by name949993
-Node: Symbol table by cookie951969
-Ref: Symbol table by cookie-Footnote-1956102
-Node: Cached values956165
-Ref: Cached values-Footnote-1959669
-Node: Array Manipulation959760
-Ref: Array Manipulation-Footnote-1960858
-Node: Array Data Types960897
-Ref: Array Data Types-Footnote-1963600
-Node: Array Functions963692
-Node: Flattening Arrays967566
-Node: Creating Arrays974418
-Node: Extension API Variables979149
-Node: Extension Versioning979785
-Node: Extension API Informational Variables981686
-Node: Extension API Boilerplate982772
-Node: Finding Extensions986576
-Node: Extension Example987136
-Node: Internal File Description987866
-Node: Internal File Ops991957
-Ref: Internal File Ops-Footnote-11003389
-Node: Using Internal File Ops1003529
-Ref: Using Internal File Ops-Footnote-11005876
-Node: Extension Samples1006144
-Node: Extension Sample File Functions1007668
-Node: Extension Sample Fnmatch1015236
-Node: Extension Sample Fork1016718
-Node: Extension Sample Inplace1017931
-Node: Extension Sample Ord1019606
-Node: Extension Sample Readdir1020442
-Ref: table-readdir-file-types1021298
-Node: Extension Sample Revout1022097
-Node: Extension Sample Rev2way1022688
-Node: Extension Sample Read write array1023429
-Node: Extension Sample Readfile1025308
-Node: Extension Sample API Tests1026408
-Node: Extension Sample Time1026933
-Node: gawkextlib1028248
-Node: Extension summary1031061
-Node: Extension Exercises1034754
-Node: Language History1035476
-Node: V7/SVR3.11037119
-Node: SVR41039439
-Node: POSIX1040881
-Node: BTL1042267
-Node: POSIX/GNU1043001
-Node: Feature History1048600
-Node: Common Extensions1061730
-Node: Ranges and Locales1063042
-Ref: Ranges and Locales-Footnote-11067659
-Ref: Ranges and Locales-Footnote-21067686
-Ref: Ranges and Locales-Footnote-31067920
-Node: Contributors1068141
-Node: History summary1073566
-Node: Installation1074935
-Node: Gawk Distribution1075886
-Node: Getting1076370
-Node: Extracting1077194
-Node: Distribution contents1078836
-Node: Unix Installation1084553
-Node: Quick Installation1085170
-Node: Additional Configuration Options1087612
-Node: Configuration Philosophy1089350
-Node: Non-Unix Installation1091701
-Node: PC Installation1092159
-Node: PC Binary Installation1093470
-Node: PC Compiling1095318
-Ref: PC Compiling-Footnote-11098317
-Node: PC Testing1098422
-Node: PC Using1099598
-Node: Cygwin1103756
-Node: MSYS1104565
-Node: VMS Installation1105079
-Node: VMS Compilation1105875
-Ref: VMS Compilation-Footnote-11107097
-Node: VMS Dynamic Extensions1107155
-Node: VMS Installation Details1108528
-Node: VMS Running1110780
-Node: VMS GNV1113614
-Node: VMS Old Gawk1114337
-Node: Bugs1114807
-Node: Other Versions1118811
-Node: Installation summary1125066
-Node: Notes1126122
-Node: Compatibility Mode1126987
-Node: Additions1127769
-Node: Accessing The Source1128694
-Node: Adding Code1130130
-Node: New Ports1136308
-Node: Derived Files1140789
-Ref: Derived Files-Footnote-11145870
-Ref: Derived Files-Footnote-21145904
-Ref: Derived Files-Footnote-31146500
-Node: Future Extensions1146614
-Node: Implementation Limitations1147220
-Node: Extension Design1148468
-Node: Old Extension Problems1149622
-Ref: Old Extension Problems-Footnote-11151139
-Node: Extension New Mechanism Goals1151196
-Ref: Extension New Mechanism Goals-Footnote-11154556
-Node: Extension Other Design Decisions1154745
-Node: Extension Future Growth1156851
-Node: Old Extension Mechanism1157687
-Node: Notes summary1159449
-Node: Basic Concepts1160635
-Node: Basic High Level1161316
-Ref: figure-general-flow1161588
-Ref: figure-process-flow1162187
-Ref: Basic High Level-Footnote-11165416
-Node: Basic Data Typing1165601
-Node: Glossary1168929
-Node: Copying1194081
-Node: GNU Free Documentation License1231637
-Node: Index1256773
+Node: Output Wrappers939572
+Node: Two-way processors944088
+Node: Printing Messages946292
+Ref: Printing Messages-Footnote-1947369
+Node: Updating `ERRNO'947521
+Node: Accessing Parameters948260
+Node: Symbol Table Access949490
+Node: Symbol table by name950004
+Node: Symbol table by cookie951980
+Ref: Symbol table by cookie-Footnote-1956113
+Node: Cached values956176
+Ref: Cached values-Footnote-1959680
+Node: Array Manipulation959771
+Ref: Array Manipulation-Footnote-1960869
+Node: Array Data Types960908
+Ref: Array Data Types-Footnote-1963611
+Node: Array Functions963703
+Node: Flattening Arrays967577
+Node: Creating Arrays974429
+Node: Extension API Variables979160
+Node: Extension Versioning979796
+Node: Extension API Informational Variables981697
+Node: Extension API Boilerplate982783
+Node: Finding Extensions986587
+Node: Extension Example987147
+Node: Internal File Description987877
+Node: Internal File Ops991968
+Ref: Internal File Ops-Footnote-11003400
+Node: Using Internal File Ops1003540
+Ref: Using Internal File Ops-Footnote-11005887
+Node: Extension Samples1006155
+Node: Extension Sample File Functions1007679
+Node: Extension Sample Fnmatch1015247
+Node: Extension Sample Fork1016729
+Node: Extension Sample Inplace1017942
+Node: Extension Sample Ord1019617
+Node: Extension Sample Readdir1020453
+Ref: table-readdir-file-types1021309
+Node: Extension Sample Revout1022108
+Node: Extension Sample Rev2way1022699
+Node: Extension Sample Read write array1023440
+Node: Extension Sample Readfile1025319
+Node: Extension Sample API Tests1026419
+Node: Extension Sample Time1026944
+Node: gawkextlib1028259
+Node: Extension summary1031072
+Node: Extension Exercises1034765
+Node: Language History1035487
+Node: V7/SVR3.11037130
+Node: SVR41039450
+Node: POSIX1040892
+Node: BTL1042278
+Node: POSIX/GNU1043012
+Node: Feature History1048611
+Node: Common Extensions1061741
+Node: Ranges and Locales1063053
+Ref: Ranges and Locales-Footnote-11067670
+Ref: Ranges and Locales-Footnote-21067697
+Ref: Ranges and Locales-Footnote-31067931
+Node: Contributors1068152
+Node: History summary1073577
+Node: Installation1074946
+Node: Gawk Distribution1075897
+Node: Getting1076381
+Node: Extracting1077205
+Node: Distribution contents1078847
+Node: Unix Installation1084564
+Node: Quick Installation1085181
+Node: Additional Configuration Options1087623
+Node: Configuration Philosophy1089361
+Node: Non-Unix Installation1091712
+Node: PC Installation1092170
+Node: PC Binary Installation1093481
+Node: PC Compiling1095329
+Ref: PC Compiling-Footnote-11098328
+Node: PC Testing1098433
+Node: PC Using1099609
+Node: Cygwin1103767
+Node: MSYS1104576
+Node: VMS Installation1105090
+Node: VMS Compilation1105886
+Ref: VMS Compilation-Footnote-11107108
+Node: VMS Dynamic Extensions1107166
+Node: VMS Installation Details1108539
+Node: VMS Running1110791
+Node: VMS GNV1113625
+Node: VMS Old Gawk1114348
+Node: Bugs1114818
+Node: Other Versions1118822
+Node: Installation summary1125077
+Node: Notes1126133
+Node: Compatibility Mode1126998
+Node: Additions1127780
+Node: Accessing The Source1128705
+Node: Adding Code1130141
+Node: New Ports1136319
+Node: Derived Files1140800
+Ref: Derived Files-Footnote-11145881
+Ref: Derived Files-Footnote-21145915
+Ref: Derived Files-Footnote-31146511
+Node: Future Extensions1146625
+Node: Implementation Limitations1147231
+Node: Extension Design1148479
+Node: Old Extension Problems1149633
+Ref: Old Extension Problems-Footnote-11151150
+Node: Extension New Mechanism Goals1151207
+Ref: Extension New Mechanism Goals-Footnote-11154567
+Node: Extension Other Design Decisions1154756
+Node: Extension Future Growth1156862
+Node: Old Extension Mechanism1157698
+Node: Notes summary1159460
+Node: Basic Concepts1160646
+Node: Basic High Level1161327
+Ref: figure-general-flow1161599
+Ref: figure-process-flow1162198
+Ref: Basic High Level-Footnote-11165427
+Node: Basic Data Typing1165612
+Node: Glossary1168940
+Node: Copying1194092
+Node: GNU Free Documentation License1231648
+Node: Index1256784

End Tag Table
diff --git a/doc/gawk.texi b/doc/gawk.texi
index ab98dda3..b9cecd04 100644
--- a/doc/gawk.texi
+++ b/doc/gawk.texi
@@ -31830,8 +31830,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 7039325b..f13a6f3e 100644
--- a/doc/gawktexi.in
+++ b/doc/gawktexi.in
@@ -30945,8 +30945,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;