aboutsummaryrefslogtreecommitdiffstats
path: root/awklib/eg/lib/zerofile.awk
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2010-07-16 13:22:00 +0300
committerArnold D. Robbins <arnold@skeeve.com>2010-07-16 13:22:00 +0300
commit6cc7d587a710606d3fe52222707739c7cc1b8651 (patch)
tree2b6360852d8f966bd83eeb6efd8af90f8e9b83f9 /awklib/eg/lib/zerofile.awk
parente888f1834b88270590b7e04d64c03c75863e4565 (diff)
downloadegawk-6cc7d587a710606d3fe52222707739c7cc1b8651.tar.gz
egawk-6cc7d587a710606d3fe52222707739c7cc1b8651.tar.bz2
egawk-6cc7d587a710606d3fe52222707739c7cc1b8651.zip
Move to gawk-3.1.3.
Diffstat (limited to 'awklib/eg/lib/zerofile.awk')
-rw-r--r--awklib/eg/lib/zerofile.awk19
1 files changed, 19 insertions, 0 deletions
diff --git a/awklib/eg/lib/zerofile.awk b/awklib/eg/lib/zerofile.awk
new file mode 100644
index 00000000..01926fdd
--- /dev/null
+++ b/awklib/eg/lib/zerofile.awk
@@ -0,0 +1,19 @@
+# zerofile.awk --- library file to process empty input files
+#
+# Arnold Robbins, arnold@gnu.org, Public Domain
+# June 2003
+
+BEGIN { Argind = 0 }
+
+ARGIND > Argind + 1 {
+ for (Argind++; Argind < ARGIND; Argind++)
+ zerofile(ARGV[Argind], Argind)
+}
+
+ARGIND != Argind { Argind = ARGIND }
+
+END {
+ if (ARGIND > Argind)
+ for (Argind++; Argind <= ARGIND; Argind++)
+ zerofile(ARGV[Argind], Argind)
+}