diff options
author | Jari Aalto <jari.aalto@cante.net> | 2001-04-06 19:14:31 +0000 |
---|---|---|
committer | Jari Aalto <jari.aalto@cante.net> | 2009-09-12 16:46:53 +0000 |
commit | 28ef6c316f1aff914bb95ac09787a3c83c1815fd (patch) | |
tree | 2812fe7ffc9beec4f99856906ddfcafda54cf16a /support/rlvers.sh | |
parent | bb70624e964126b7ac4ff085ba163a9c35ffa18f (diff) | |
download | bash-28ef6c316f1aff914bb95ac09787a3c83c1815fd.tar.gz |
Imported from ../bash-2.05.tar.gz.
Diffstat (limited to 'support/rlvers.sh')
-rwxr-xr-x | support/rlvers.sh | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/support/rlvers.sh b/support/rlvers.sh index ea85afa4..a6d751f3 100755 --- a/support/rlvers.sh +++ b/support/rlvers.sh @@ -5,17 +5,22 @@ # PROGNAME=`basename $0` -TDIR=/tmp/rlvers + +: ${TMPDIR:=/tmp} +TDIR=$TMPDIR/rlvers # defaults CC=cc RL_LIBDIR=/usr/local/lib +RL_INCDIR=/usr/local/include TERMCAP_LIB="-ltermcap" +# cannot rely on the presence of getopts while [ $# -gt 0 ]; do case "$1" in -C) shift ; CC="$1"; shift ;; + -I) shift ; RL_INCDIR="$1" ; shift ;; -L) shift ; RL_LIBDIR="$1" ; shift ;; -T) shift ; TERMCAP_LIB="$1" ; shift ;; -v) shift ; verbose=y ;; @@ -64,7 +69,15 @@ main() } EOF -if eval ${CC} -L${RL_LIBDIR} -o $TDIR/rlvers $TDIR/rlvers.c -lreadline ${TERMCAP_LIB}; +opwd=`pwd` + +cd $TDIR || { + echo "${PROGNAME}: cannot cd to $TDIR" >&2 + echo 0 + exit 1 +} + +if eval ${CC} -L${RL_LIBDIR} -I${RL_INCDIR} -o $TDIR/rlvers $TDIR/rlvers.c -lreadline ${TERMCAP_LIB}; then v=`$TDIR/rlvers` else @@ -80,4 +93,5 @@ unknown | "") echo 0 ;; *) echo "$v" ;; esac +cd $opwd exit 0 |