aboutsummaryrefslogtreecommitdiffstats
path: root/field.c
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2020-04-02 09:20:49 +0300
committerArnold D. Robbins <arnold@skeeve.com>2020-04-02 09:20:49 +0300
commit0e98924f51b869cbf5dd6d9ddf345dedfbafc395 (patch)
tree7594428f8556e3a1a59144304ebaccc8c4b8d4f1 /field.c
parent958c79056346932e18ed2e7e12eb6f6bd8331f58 (diff)
downloadegawk-0e98924f51b869cbf5dd6d9ddf345dedfbafc395.tar.gz
egawk-0e98924f51b869cbf5dd6d9ddf345dedfbafc395.tar.bz2
egawk-0e98924f51b869cbf5dd6d9ddf345dedfbafc395.zip
Bug fix in field.c.
Diffstat (limited to 'field.c')
-rw-r--r--field.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/field.c b/field.c
index efbc7092..80495862 100644
--- a/field.c
+++ b/field.c
@@ -463,7 +463,9 @@ re_parse_field(long up_to, /* parse only up to this field number */
if (len == 0)
return nf;
- if (RS_is_null && default_FS) {
+ bool default_field_splitting = (RS_is_null && default_FS);
+
+ if (default_field_splitting) {
sep = scan;
while (scan < end && (*scan == ' ' || *scan == '\t' || *scan == '\n'))
scan++;
@@ -504,7 +506,7 @@ re_parse_field(long up_to, /* parse only up to this field number */
(long) (REEND(rp, scan) - RESTART(rp, scan)), sep_arr);
scan += REEND(rp, scan);
field = scan;
- if (scan == end) /* FS at end of record */
+ if (scan == end && ! default_field_splitting) /* FS at end of record */
(*set)(++nf, field, 0L, n);
}
if (nf != up_to && scan < end) {