diff options
Diffstat (limited to 'awklib')
-rw-r--r-- | awklib/ChangeLog | 5 | ||||
-rw-r--r-- | awklib/eg/lib/inplace.awk | 18 | ||||
-rw-r--r-- | awklib/eg/network/coreserv.awk | 2 | ||||
-rw-r--r-- | awklib/extract.awk | 21 |
4 files changed, 31 insertions, 15 deletions
diff --git a/awklib/ChangeLog b/awklib/ChangeLog index f0e82f5b..791c25f6 100644 --- a/awklib/ChangeLog +++ b/awklib/ChangeLog @@ -1,3 +1,8 @@ +2015-06-19 Arnold D. Robbins <arnold@skeeve.com> + + * extract.awk: Sync with current version in the doc. Thanks to + Antonio Columbo for pointing this out. + 2015-05-19 Arnold D. Robbins <arnold@skeeve.com> * 4.1.3: Release tar ball made. diff --git a/awklib/eg/lib/inplace.awk b/awklib/eg/lib/inplace.awk index d1574654..15a83f58 100644 --- a/awklib/eg/lib/inplace.awk +++ b/awklib/eg/lib/inplace.awk @@ -5,15 +5,29 @@ # 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. +# By default, each filename on the command line will be edited inplace. +# But you can selectively disable this by adding an inplace=0 argument +# prior to files that you do not want to process this way. You can then +# reenable it later on the commandline by putting inplace=1 before files +# that you wish to be subject to inplace editing. + # 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. +BEGIN { + inplace = 1 # enabled by default +} + BEGINFILE { if (_inplace_filename != "") inplace_end(_inplace_filename, INPLACE_SUFFIX) - inplace_begin(_inplace_filename = FILENAME, INPLACE_SUFFIX) + if (inplace) + inplace_begin(_inplace_filename = FILENAME, INPLACE_SUFFIX) + else + _inplace_filename = "" } END { - inplace_end(FILENAME, INPLACE_SUFFIX) + if (_inplace_filename != "") + inplace_end(_inplace_filename, INPLACE_SUFFIX) } diff --git a/awklib/eg/network/coreserv.awk b/awklib/eg/network/coreserv.awk index 348568e0..a5c8b1ed 100644 --- a/awklib/eg/network/coreserv.awk +++ b/awklib/eg/network/coreserv.awk @@ -1,7 +1,7 @@ # CGI Library and core of a web server # # Juergen Kahrs, Juergen.Kahrs@vr-web.de -# with Arnold Robbins, arnold@gnu.org +# with Arnold Robbins, arnold@skeeve.com # September 2000 # Global arrays diff --git a/awklib/extract.awk b/awklib/extract.awk index 1b052e73..2662574b 100644 --- a/awklib/extract.awk +++ b/awklib/extract.awk @@ -1,16 +1,14 @@ -# extract.awk --- extract files and run programs -# from texinfo files +# extract.awk --- extract files and run programs from Texinfo files # -# Arnold Robbins, arnold@gnu.org, Public Domain +# Arnold Robbins, arnold@skeeve.com, Public Domain # May 1993 # Revised September 2000 BEGIN { IGNORECASE = 1 } -/^@c(omment)?[ \t]+system/ \ -{ +/^@c(omment)?[ \t]+system/ { if (NF < 3) { - e = (FILENAME ":" FNR) + e = ("extract: " FILENAME ":" FNR) e = (e ": badly formed `system' line") print e > "/dev/stderr" next @@ -19,15 +17,14 @@ BEGIN { IGNORECASE = 1 } $2 = "" stat = system($0) if (stat != 0) { - e = (FILENAME ":" FNR) + e = ("extract: " FILENAME ":" FNR) e = (e ": warning: system returned " stat) print e > "/dev/stderr" } } -/^@c(omment)?[ \t]+file/ \ -{ +/^@c(omment)?[ \t]+file/ { if (NF != 3) { - e = (FILENAME ":" FNR ": badly formed `file' line") + e = ("extract: " FILENAME ":" FNR ": badly formed `file' line") print e > "/dev/stderr" next } @@ -65,8 +62,8 @@ BEGIN { IGNORECASE = 1 } } function unexpected_eof() { - printf("%s:%d: unexpected EOF or error\n", - FILENAME, FNR) > "/dev/stderr" + printf("extract: %s:%d: unexpected EOF or error\n", + FILENAME, FNR) > "/dev/stderr" exit 1 } |