diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2014-05-09 11:59:29 +0300 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2014-05-09 11:59:29 +0300 |
commit | 40694fc1c11bae6fac8e809a6a4c161c12cc37b7 (patch) | |
tree | 0b7858a44f30c13c0fd0da1423ea965c6b9240b6 /io.c | |
parent | 12857707435f1d4bf9adf33b6fbfd57ff91529a7 (diff) | |
download | egawk-40694fc1c11bae6fac8e809a6a4c161c12cc37b7.tar.gz egawk-40694fc1c11bae6fac8e809a6a4c161c12cc37b7.tar.bz2 egawk-40694fc1c11bae6fac8e809a6a4c161c12cc37b7.zip |
Fix in read_a_record for short file with RS=regex.
Diffstat (limited to 'io.c')
-rw-r--r-- | io.c | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -206,6 +206,7 @@ typedef enum { CLOSE_ALL, CLOSE_TO, CLOSE_FROM } two_way_close_type; #define at_eof(iop) (((iop)->flag & IOP_AT_EOF) != 0) #define has_no_data(iop) ((iop)->dataend == NULL) #define no_data_left(iop) ((iop)->off >= (iop)->dataend) +#define buffer_has_all_data(iop) ((iop)->dataend - (iop)->off == (iop)->public.sbuf.st_size) /* * The key point to the design is to split out the code that searches through @@ -3474,6 +3475,8 @@ get_a_record(char **out, /* pointer to pointer to data */ iop->flag &= ~IOP_AT_START; if (ret == REC_OK) break; + if (ret == TERMNEAREND && buffer_has_all_data(iop)) + break; /* need to add more data to buffer */ /* shift data down in buffer */ |