diff options
author | jlam <jlam> | 2004-01-29 07:14:30 +0000 |
---|---|---|
committer | jlam <jlam> | 2004-01-29 07:14:30 +0000 |
commit | dbd17fb68bf493fba37599fd27e7ae3f8890c8ca (patch) | |
tree | 904d21bf9c8a684849ff07c81e1f63ce6eaeb1e4 /mk/buildlink3/buffer | |
parent | 5ec859c4070010eb38f8767ff577e29be00fe6d5 (diff) | |
download | pkgsrc-dbd17fb68bf493fba37599fd27e7ae3f8890c8ca.tar.gz |
Use a stack instead of the broken implementation of a circular list for the
argument buffer.
Diffstat (limited to 'mk/buildlink3/buffer')
-rw-r--r-- | mk/buildlink3/buffer | 50 |
1 files changed, 17 insertions, 33 deletions
diff --git a/mk/buildlink3/buffer b/mk/buildlink3/buffer index 65e562f16d6..52df6f4d8b4 100644 --- a/mk/buildlink3/buffer +++ b/mk/buildlink3/buffer @@ -1,12 +1,10 @@ -# $NetBSD: buffer,v 1.4 2004/01/27 08:23:45 jlam Exp $ +# $NetBSD: buffer,v 1.5 2004/01/29 07:14:30 jlam Exp $ # -# Fill the buffer if it's empty, and shift the arguments. The next -# argument checked by the cache and logic files is taken from the -# first non-empty buffer. We avoid using "eval" so that we can skip -# having to specially quote the argument using "sed". +# Push arguments onto the argument stack and shift the arguments. The +# next argument checked by the cache and logic files is take from the +# the top of the stack. # -case ${buf1}${buf2}${buf3}${buf4}${buf5} in -"") +if $test -z "$depth"; then arg="$1"; shift # # Marshall any group of consecutive arguments into a single @@ -41,16 +39,8 @@ case ${buf1}${buf2}${buf3}${buf4}${buf5} in while $test $# -gt 0; do case "$dirlist" in "$1"|"$1 "*) ;; - *" $1 "*|*" $1") ;; - *) dirlist="$dirlist $1" - if $test -z "$buf1"; then buf1="$R$1" - elif $test -z "$buf2"; then buf2="$R$1" - elif $test -z "$buf3"; then buf3="$R$1" - elif $test -z "$buf4"; then buf4="$R$1" - elif $test -z "$buf5"; then buf5="$R$1" - else exit 2 - fi - ;; + *" $1 "*|*" $1") ;; + *) dirlist="$1 $dirlist" ;; esac shift done @@ -58,25 +48,19 @@ case ${buf1}${buf2}${buf3}${buf4}${buf5} in if $test -n "$allargs"; then set -- $allargs fi + for dir in $dirlist; do + depth=${depth}0 + eval stack${depth}="\$R\$dir" + done ;; *) - if $test -z "$buf1"; then buf1="$arg" - elif $test -z "$buf2"; then buf2="$arg" - elif $test -z "$buf3"; then buf3="$arg" - elif $test -z "$buf4"; then buf4="$arg" - elif $test -z "$buf5"; then buf5="$arg" - else exit 2 - fi + depth=${depth}0 + eval stack${depth}="\$arg" ;; esac - ;; -esac +fi # -# Re-fetch $arg from the first non-empty buffer. +# Re-fetch $arg from the top of the stack. # -if $test -n "$buf1"; then arg="$buf1"; buf1= -elif $test -n "$buf2"; then arg="$buf2"; buf2= -elif $test -n "$buf3"; then arg="$buf3"; buf3= -elif $test -n "$buf4"; then arg="$buf4"; buf4= -elif $test -n "$buf5"; then arg="$buf5"; buf5= -fi +eval arg="\$stack${depth}" +depth=${depth%0} |