aboutsummaryrefslogtreecommitdiffstats
path: root/field.c
diff options
context:
space:
mode:
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) {