summaryrefslogtreecommitdiffstats
path: root/config.tests/unix/which.test
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2011-07-10 15:24:15 -0500
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2011-07-10 15:24:15 -0500
commitbd0f3345a938b35ce6a12f6150373b0955b8dd12 (patch)
tree7a520322212d48ebcb9fbe1087e7fca28b76185c /config.tests/unix/which.test
downloadqt3-bd0f3345a938b35ce6a12f6150373b0955b8dd12.tar.gz
qt3-bd0f3345a938b35ce6a12f6150373b0955b8dd12.zip
Add Qt3 development HEAD version
Diffstat (limited to 'config.tests/unix/which.test')
-rwxr-xr-xconfig.tests/unix/which.test39
1 files changed, 39 insertions, 0 deletions
diff --git a/config.tests/unix/which.test b/config.tests/unix/which.test
new file mode 100755
index 0000000..37c858c
--- /dev/null
+++ b/config.tests/unix/which.test
@@ -0,0 +1,39 @@
+#!/bin/sh
+
+HOME=/dev/null
+export HOME
+
+unset which
+
+WHICH=`which which 2>/dev/null`
+if echo $WHICH | grep 'shell built-in command' >/dev/null 2>&1; then
+ WHICH=which
+elif [ -z "$WHICH" ]; then
+ if which which >/dev/null 2>&1; then
+ WHICH=which
+ else
+ for a in /usr/ucb /usr/bin /bin /usr/local/bin; do
+ if [ -x $a/which ]; then
+ WHICH=$a/which
+ break;
+ fi
+ done
+ fi
+fi
+
+if [ -z "$WHICH" ]; then
+ IFS=:
+ for a in $PATH; do
+ if [ -x $a/$1 ]; then
+ echo "$a/$1"
+ exit 0
+ fi
+ done
+else
+ a=`"$WHICH" "$1" 2>/dev/null`
+ if [ ! -z "$a" -a -x "$a" ]; then
+ echo "$a"
+ exit 0
+ fi
+fi
+exit 1