diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2015-03-27 06:40:45 +0300 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2015-03-27 06:40:45 +0300 |
commit | 3fad6ad12e1637c4e1b72fbeaf0265f44da0cf27 (patch) | |
tree | 8e83597d27430370914142150647e11c07410e0b /awklib/eg/lib | |
parent | 603eb56251817ac19491b7671ed01402b2d7399c (diff) | |
parent | 7d3d7d27391db40c0561ea47e6b8a5a1ae24c6fb (diff) | |
download | egawk-3fad6ad12e1637c4e1b72fbeaf0265f44da0cf27.tar.gz egawk-3fad6ad12e1637c4e1b72fbeaf0265f44da0cf27.tar.bz2 egawk-3fad6ad12e1637c4e1b72fbeaf0265f44da0cf27.zip |
Merge branch 'master' into wasted-byte
Diffstat (limited to 'awklib/eg/lib')
-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) } |