aboutsummaryrefslogtreecommitdiffstats
path: root/io.c
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2014-07-31 20:29:38 +0300
committerArnold D. Robbins <arnold@skeeve.com>2014-07-31 20:29:38 +0300
commitd60fb05cc5db4f1ee1176a9ed7f053011f8521aa (patch)
tree2471e5d7757a3aad0f9fbf6722964a30ae1b01ee /io.c
parentcafa8fcd5a5d593f4638b199fbf5f94a006a4aac (diff)
parent54146e27c8fd7756a944d0e168aa969624567b55 (diff)
downloadegawk-d60fb05cc5db4f1ee1176a9ed7f053011f8521aa.tar.gz
egawk-d60fb05cc5db4f1ee1176a9ed7f053011f8521aa.tar.bz2
egawk-d60fb05cc5db4f1ee1176a9ed7f053011f8521aa.zip
Merge branch 'master' into comment
Diffstat (limited to 'io.c')
-rw-r--r--io.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/io.c b/io.c
index 57d4af22..45b5015f 100644
--- a/io.c
+++ b/io.c
@@ -574,12 +574,12 @@ set_NR()
/* inrec --- This reads in a record from the input file */
-int
+bool
inrec(IOBUF *iop, int *errcode)
{
char *begin;
int cnt;
- int retval = 0;
+ bool retval = true;
if (at_eof(iop) && no_data_left(iop))
cnt = EOF;
@@ -589,13 +589,17 @@ inrec(IOBUF *iop, int *errcode)
cnt = get_a_record(& begin, iop, errcode);
if (cnt == EOF) {
- retval = 1;
+ 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);
+ retval = false;
+ }
}
return retval;