diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2010-07-16 12:45:40 +0300 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2010-07-16 12:45:40 +0300 |
commit | 558ba97bdeac5a68bb9248a5c4cdf2feeb24e771 (patch) | |
tree | 5c03c98edb9c5488103a6ffdef047e590e0b35b9 /awklib/igawk.save | |
parent | 8c042f99cc7465c86351d21331a129111b75345d (diff) | |
download | egawk-558ba97bdeac5a68bb9248a5c4cdf2feeb24e771.tar.gz egawk-558ba97bdeac5a68bb9248a5c4cdf2feeb24e771.tar.bz2 egawk-558ba97bdeac5a68bb9248a5c4cdf2feeb24e771.zip |
Move to gawk-3.0.1.
Diffstat (limited to 'awklib/igawk.save')
-rwxr-xr-x | awklib/igawk.save | 120 |
1 files changed, 0 insertions, 120 deletions
diff --git a/awklib/igawk.save b/awklib/igawk.save deleted file mode 100755 index 87412aa8..00000000 --- a/awklib/igawk.save +++ /dev/null @@ -1,120 +0,0 @@ -#! /bin/sh - -# igawk --- like gawk but do @include processing -# Arnold Robbins, arnold@gnu.ai.mit.edu, Public Domain -# July 1993 - -if [ "$1" = debug ] -then - set -x - shift -else - # cleanup on exit, hangup, interrupt, quit, termination - trap 'rm -f /tmp/ig.[se].$$' 0 1 2 3 15 -fi - -while [ $# -ne 0 ] # loop over arguments -do - case $1 in - --) shift; break;; - - -W) shift - set -- -W"$@" - continue;; - - -[vF]) opts="$opts $1 '$2'" - shift;; - - -[vF]*) opts="$opts '$1'" ;; - - -f) echo @include "$2" >> /tmp/ig.s.$$ - shift;; - - -f*) f=`echo "$1" | sed 's/-f//'` - echo @include "$f" >> /tmp/ig.s.$$ ;; - - -?file=*) # -Wfile or --file - f=`echo "$1" | sed 's/-.file=//'` - echo @include "$f" >> /tmp/ig.s.$$ ;; - - -?file) # get arg, $2 - echo @include "$2" >> /tmp/ig.s.$$ - shift;; - - -?source=*) # -Wsource or --source - t=`echo "$1" | sed 's/-.source=//'` - echo "$t" >> /tmp/ig.s.$$ ;; - - -?source) # get arg, $2 - echo "$2" >> /tmp/ig.s.$$ - shift;; - - --*) opts="$opts '$1'" ;; - - *) break;; - esac - - shift -done - -if [ ! -s /tmp/ig.s.$$ ] -then - echo "$1" > /tmp/ig.s.$$ - shift -fi - -# at this point, /tmp/ig.s.$$ has the program -gawk -- ' -# process @include directives - -function pathto(file, i, t, junk) -{ - if (index(file, "/") != 0) - return file - - for (i = 1; i <= ndirs; i++) { - t = (pathlist[i] "/" file) - if ((getline junk < t) > 0) { - # found it - close(t) - return t - } - } - return "" -} -BEGIN { - path = ENVIRON["AWKPATH"] - ndirs = split(path, pathlist, ":") - for (i = 1; i <= ndirs; i++) { - if (pathlist[i] == "") - pathlist[i] = "." - } - stackptr = 0 - input[stackptr] = ARGV[1] # ARGV[1] is first file - - for (; stackptr >= 0; stackptr--) { - while ((getline < input[stackptr]) > 0) { - if (tolower($1) != "@include") { - print - continue - } - fpath = pathto($2) - if (fpath == "") { - printf("igawk:%s:%d: cannot find %s\n", \ - input[stackptr], FNR, $2) > "/dev/stderr" - continue - } - if (! (fpath in processed)) { - processed[fpath] = input[stackptr] - input[++stackptr] = fpath - } else - print $2, "included in", input[stackptr], \ - "already included in", \ - processed[fpath] > "/dev/stderr" - } - close(input[stackptr]) - } -}' /tmp/ig.s.$$ > /tmp/ig.e.$$ -eval gawk -f /tmp/ig.e.$$ $opts -- "$@" - -exit $? |