diff options
Diffstat (limited to 'awklib/eg/lib')
-rw-r--r-- | awklib/eg/lib/grcat.c | 2 | ||||
-rw-r--r-- | awklib/eg/lib/zerofile.awk | 19 |
2 files changed, 20 insertions, 1 deletions
diff --git a/awklib/eg/lib/grcat.c b/awklib/eg/lib/grcat.c index c022dc7e..83567142 100644 --- a/awklib/eg/lib/grcat.c +++ b/awklib/eg/lib/grcat.c @@ -12,7 +12,7 @@ #if HAVE_CONFIG_H #include <config.h> #endif - + #if defined (STDC_HEADERS) #include <stdlib.h> #endif 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) +} |