diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2015-04-05 11:20:41 +0300 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2015-04-05 11:20:41 +0300 |
commit | 4de12ef40f9ea9a0b715903cfe6da51b97eedb77 (patch) | |
tree | 84a0c8d117e9a2a629e186a1fe22ebe185e5d6a4 /awklib/eg/lib/inplace.awk | |
parent | 14da33f5ac17b4adfd15ddb12c07715741bd1b1f (diff) | |
parent | dbf9d5a4fc4b6d6340912395f020019576ed37f6 (diff) | |
download | egawk-4de12ef40f9ea9a0b715903cfe6da51b97eedb77.tar.gz egawk-4de12ef40f9ea9a0b715903cfe6da51b97eedb77.tar.bz2 egawk-4de12ef40f9ea9a0b715903cfe6da51b97eedb77.zip |
Merge branch 'master' into cmake
Diffstat (limited to 'awklib/eg/lib/inplace.awk')
-rw-r--r-- | awklib/eg/lib/inplace.awk | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/awklib/eg/lib/inplace.awk b/awklib/eg/lib/inplace.awk index 6403a228..d1574654 100644 --- a/awklib/eg/lib/inplace.awk +++ b/awklib/eg/lib/inplace.awk @@ -5,10 +5,15 @@ # Please set INPLACE_SUFFIX to make a backup copy. For example, you may # want to set INPLACE_SUFFIX to .bak on the command line or in a BEGIN rule. +# N.B. We call inplace_end() in the BEGINFILE and END rules so that any +# actions in an ENDFILE rule will be redirected as expected. + BEGINFILE { - inplace_begin(FILENAME, INPLACE_SUFFIX) + if (_inplace_filename != "") + inplace_end(_inplace_filename, INPLACE_SUFFIX) + inplace_begin(_inplace_filename = FILENAME, INPLACE_SUFFIX) } -ENDFILE { +END { inplace_end(FILENAME, INPLACE_SUFFIX) } |