From 23ee359b08fbdacc546ab84414eb9c63b6a2005d Mon Sep 17 00:00:00 2001 From: Tim Rice Date: Thu, 11 Sep 2003 22:32:17 -0700 Subject: [regress/agent-ptrace.sh regress/dynamic-forward.sh regress/sftp-cmds.sh regress/stderr-after-eof.sh regress/test-exec.sh] no longer depends on which(1). patch by dtucker@ --- ChangeLog | 5 ++++- regress/agent-ptrace.sh | 4 ++-- regress/dynamic-forward.sh | 4 ++-- regress/sftp-cmds.sh | 2 +- regress/stderr-after-eof.sh | 8 ++++---- regress/test-exec.sh | 17 ++++++++++++++++- 6 files changed, 29 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index 39303b67f..6bc8182cc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,9 @@ - (tim) [configure.ac] Move libgen tests to before libwrap to unbreak UnixWare 2.03 using --with-tcp-wrappers. - (tim) [configure.ac] Prefer setuid/setgid on UnixWare and Open Server. + - (tim) [regress/agent-ptrace.sh regress/dynamic-forward.sh + regress/sftp-cmds.sh regress/stderr-after-eof.sh regress/test-exec.sh] + no longer depends on which(1). patch by dtucker@ 20030910 - (dtucker) [configure.ac] Bug #636: Add support for Cray's new X1 machine. @@ -1067,4 +1070,4 @@ - Fix sshd BindAddress and -b options for systems using fake-getaddrinfo. Report from murple@murple.net, diagnosis from dtucker@zip.com.au -$Id: ChangeLog,v 1.2981 2003/09/12 05:24:36 tim Exp $ +$Id: ChangeLog,v 1.2982 2003/09/12 05:32:17 tim Exp $ diff --git a/regress/agent-ptrace.sh b/regress/agent-ptrace.sh index 4124f5844..b9d86a29d 100644 --- a/regress/agent-ptrace.sh +++ b/regress/agent-ptrace.sh @@ -3,7 +3,7 @@ tid="disallow agent ptrace attach" -if [ -x "`which uname 2>&1`" ]; then +if have_prog uname ; then case `uname` in Linux|HP-UX|SunOS|NetBSD|AIX|CYGWIN*) echo "skipped (not supported on this platform)" @@ -12,7 +12,7 @@ if [ -x "`which uname 2>&1`" ]; then esac fi -if [ ! -x "`which gdb 2>&1`" ]; then +if ! have_prog gdb ; then echo "skipped (gdb not found)" exit 0 fi diff --git a/regress/dynamic-forward.sh b/regress/dynamic-forward.sh index 0f175b2d9..2b0b825d0 100644 --- a/regress/dynamic-forward.sh +++ b/regress/dynamic-forward.sh @@ -7,9 +7,9 @@ PORT=4242 FWDPORT=4243 DATA=/bin/ls${EXEEXT} -if [ -x "`which nc 2>&1`" ] && nc -h 2>&1 | grep "x proxy address" >/dev/null; then +if have_prog nc && nc -h 2>&1 | grep "x proxy address" >/dev/null; then proxycmd="nc -x 127.0.0.1:$FWDPORT -X" -elif [ -x "`which connect 2>&1`" ]; then +elif have_prog connect; then proxycmd="connect -S 127.0.0.1:$FWDPORT -" else echo "skipped (no suitable ProxyCommand found)" diff --git a/regress/sftp-cmds.sh b/regress/sftp-cmds.sh index 1237720f9..1256aeb2d 100644 --- a/regress/sftp-cmds.sh +++ b/regress/sftp-cmds.sh @@ -17,7 +17,7 @@ do fi done -if [ -x "`which uname 2>&1`" ] +if have_prog uname then case `uname` in CYGWIN*) diff --git a/regress/stderr-after-eof.sh b/regress/stderr-after-eof.sh index ae9cf8d98..05a5ea56d 100644 --- a/regress/stderr-after-eof.sh +++ b/regress/stderr-after-eof.sh @@ -7,13 +7,13 @@ DATA=/etc/motd DATA=${OBJ}/data COPY=${OBJ}/copy -if [ -x "`which md5sum 2>&1`" ]; then +if have_prog md5sum; then CHECKSUM=md5sum -elif [ -x "`which openssl 2>&1`" ]; then +elif have_prog openssl; then CHECKSUM="openssl md5" -elif [ -x "`which cksum 2>&1`" ]; then +elif have_prog cksum; then CHECKSUM=cksum -elif [ -x "`which sum 2>&1`" ]; then +elif have_prog sum; then CHECKSUM=sum else fatal "No checksum program available, aborting $tid test" diff --git a/regress/test-exec.sh b/regress/test-exec.sh index b5ef3bc7c..cc7ea67fe 100644 --- a/regress/test-exec.sh +++ b/regress/test-exec.sh @@ -6,7 +6,7 @@ PORT=4242 if [ -x /usr/ucb/whoami ]; then USER=`/usr/ucb/whoami` -elif [ -x "`which whoami 2>&1`" ]; then +elif whoami >/dev/null 2>&1; then USER=`whoami` else USER=`id -un` @@ -89,6 +89,21 @@ echon() fi } +have_prog() +{ + saved_IFS="$IFS" + IFS=":" + for i in $PATH + do + if [ -x $i/$1 ]; then + IFS="$saved_IFS" + return 0 + fi + done + IFS="$saved_IFS" + return 1 +} + cleanup () { if [ -f $PIDFILE ]; then -- cgit v1.2.3