diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2011-08-10 23:00:53 +0300 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2011-08-10 23:00:53 +0300 |
commit | ee77c260899fdce1cec5cf51053ccdb107f76d62 (patch) | |
tree | 10d32755f9c6a0e4795d9a8ef2bb16470652ea10 /field.c | |
parent | b8c993f5a867f38fa9edd343d7d90b4b36800be2 (diff) | |
download | egawk-ee77c260899fdce1cec5cf51053ccdb107f76d62.tar.gz egawk-ee77c260899fdce1cec5cf51053ccdb107f76d62.tar.bz2 egawk-ee77c260899fdce1cec5cf51053ccdb107f76d62.zip |
Fix bug with FPAT.
Diffstat (limited to 'field.c')
-rw-r--r-- | field.c | 15 |
1 files changed, 10 insertions, 5 deletions
@@ -849,7 +849,8 @@ get_field(long requested, Func_ptr *assign) if (assign != NULL) field0_valid = FALSE; /* $0 needs reconstruction */ #else - /* keep things uniform. Also, mere intention of assigning something + /* + * Keep things uniform. Also, mere intention of assigning something * to $n should not make $0 invalid. Makes sense to invalidate $0 * after the actual assignment is performed. Not a real issue in * the interpreter otherwise, but causes problem in the @@ -1584,9 +1585,6 @@ fpat_parse_field(long up_to, /* parse only up to this field number */ memset(&mbs, 0, sizeof(mbstate_t)); #endif - if (in_middle) - regex_flags |= RE_NO_BOL; - if (up_to == UNLIMITED) nf = 0; @@ -1596,7 +1594,13 @@ fpat_parse_field(long up_to, /* parse only up to this field number */ if (rp == NULL) /* use FPAT */ rp = FPAT_regexp; - eosflag = non_empty = FALSE; + if (in_middle) { + regex_flags |= RE_NO_BOL; + non_empty = rp->non_empty; + } else + non_empty = FALSE; + + eosflag = FALSE; need_to_set_sep = TRUE; start = scan; while (research(rp, scan, 0, (end - scan), regex_flags) != -1 @@ -1675,5 +1679,6 @@ fpat_parse_field(long up_to, /* parse only up to this field number */ } *buf = scan; + rp->non_empty = non_empty; return nf; } |