diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2020-08-25 09:59:49 +0300 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2020-08-25 09:59:49 +0300 |
commit | ab992f649d6e8b40f86eb0f31f4b04daf12c0c8d (patch) | |
tree | e7e93fae9390290d012404237905fb48c2c2d31f /interpret.h | |
parent | 0dcd39b002cff7785c38ce535f6e57d4208fefa6 (diff) | |
download | egawk-ab992f649d6e8b40f86eb0f31f4b04daf12c0c8d.tar.gz egawk-ab992f649d6e8b40f86eb0f31f4b04daf12c0c8d.tar.bz2 egawk-ab992f649d6e8b40f86eb0f31f4b04daf12c0c8d.zip |
Clear out the record and fields at start of BEGINFILE rule.
Diffstat (limited to 'interpret.h')
-rw-r--r-- | interpret.h | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/interpret.h b/interpret.h index efbf9b23..fedf5255 100644 --- a/interpret.h +++ b/interpret.h @@ -108,7 +108,13 @@ top: switch (op) { case Op_rule: - currule = pc->in_rule; /* for sole use in Op_K_next, Op_K_nextfile, Op_K_getline */ + currule = pc->in_rule; /* for use in Op_K_next, Op_K_nextfile, Op_K_getline */ + // 8/2020: See node BEGINFILE/ENDFILE in the manual. We clear the record + // since conceptually we are before reading a new record from the + // upcoming file but haven't read it yet. + if (currule == BEGINFILE) + set_record("", 0, NULL); + /* fall through */ case Op_func: source = pc->source_file; |