Hi Derek, a couple of nits, if I may:
* Derek Price wrote on Thu, Sep 25, 2008 at 12:11:27AM CEST: > --- gnulib-tool.orig 2008-09-24 17:48:53.000000000 -0400 > +++ gnulib-tool 2008-09-24 18:02:27.000000000 -0400 > +# Treat the shell variable with name $1 like a space delimited stack and > +# append the rest of $@ > +func_push () > +{ > + var=$1 > + shift > + for e in ${1+"$@"}; do Simpler, and likewise portable, written as for e do Another instance below. > + if eval "test -n \"\$$1\""; then > + func_append $var " " > + fi > + func_append $var "$e" > + done > +} > + > +# Using $1 as a separator, join the rest of $@, then echo the result. > +# > +# e.g. `join ", " a b c d e f' yields: > +# > +# a, b, c, d, e, f > +func_join () > +{ > + sep=$1 > + out=$2 > + shift > + shift > + for e in ${1+"$@"}; do > + func_append out "$sep" > + func_append out "$e" Why not simply func_append out "$sep$e" that ought to be faster. > + done > + echo $out echo "$out" ? > +} > + > +# Wrap $1 at $3 characters, prefixing each line with $2, then echo it. > +# > +# $3 (wrap length) defaults to 80. > +# > +# e.g. `wrap "a b c d e f g h i j k xxxxxxxxxxxxxxxxxx" "gnulib: " 14' > yields: > +# > +# gnulib: a b c > +# gnulib: d e f > +# gnulib: g h i > +# gnulib: j k > +# gnulib: > +# xxxxxxxxxxxxxxxxxx > +func_wrap () > +{ > + prefix=$2 > + plen=`echo "$prefix" |wc -c` FWIW, I prefer spaces around '|', just like GCS recommends spaces around operators in C. But that's just me. > + if test -z "$3"; then > + len=80 > + fi > + len=`expr $len - $plen` > + echo "$1" |sed -e "s#.\\{1,$len\\} #&\\n$prefix#g" -e "s#^#$prefix&#" In the replacement part of a sed "s" command, a newline is portably entered as: backslash newline (literally!), not as backslash n. The latter is portable in the BRE part. > +} > + Cheers, Ralf