Determine if shell is color capable dynamically

Use tput to test for color support in the terminal. If found, use
it by default in the run.sh scripts. If not, don't.

Signed-off-by: Darren Hart <dvhltc@us.ibm.com>
diff --git a/functional/run.sh b/functional/run.sh
index d32d6fd..01aea59 100755
--- a/functional/run.sh
+++ b/functional/run.sh
@@ -35,35 +35,35 @@
 echo 
 # requeue pi testing
 # without timeouts
-./futex_requeue_pi
-./futex_requeue_pi -c -b
-./futex_requeue_pi -c -b -l
-./futex_requeue_pi -c -b -o
-./futex_requeue_pi -c -l
-./futex_requeue_pi -c -o
+./futex_requeue_pi $COLOR
+./futex_requeue_pi $COLOR -b
+./futex_requeue_pi $COLOR -b -l
+./futex_requeue_pi $COLOR -b -o
+./futex_requeue_pi $COLOR -l
+./futex_requeue_pi $COLOR -o
 # with timeouts
-./futex_requeue_pi -c -b -l -t 5000
-./futex_requeue_pi -c -l -t 5000
-./futex_requeue_pi -c -b -l -t 500000
-./futex_requeue_pi -c -l -t 500000
-./futex_requeue_pi -c -b -t 5000
-./futex_requeue_pi -c -t 5000
-./futex_requeue_pi -c -b -t 500000
-./futex_requeue_pi -c -t 500000
-./futex_requeue_pi -c -b -o -t 5000
-./futex_requeue_pi -c -l -t 5000
-./futex_requeue_pi -c -b -o -t 500000
-./futex_requeue_pi -c -l -t 500000
+./futex_requeue_pi $COLOR -b -l -t 5000
+./futex_requeue_pi $COLOR -l -t 5000
+./futex_requeue_pi $COLOR -b -l -t 500000
+./futex_requeue_pi $COLOR -l -t 500000
+./futex_requeue_pi $COLOR -b -t 5000
+./futex_requeue_pi $COLOR -t 5000
+./futex_requeue_pi $COLOR -b -t 500000
+./futex_requeue_pi $COLOR -t 500000
+./futex_requeue_pi $COLOR -b -o -t 5000
+./futex_requeue_pi $COLOR -l -t 5000
+./futex_requeue_pi $COLOR -b -o -t 500000
+./futex_requeue_pi $COLOR -l -t 500000
 # with long timeout
-./futex_requeue_pi -c -b -l -t 2000000000
-./futex_requeue_pi -c -l -t 2000000000
+./futex_requeue_pi $COLOR -b -l -t 2000000000
+./futex_requeue_pi $COLOR -l -t 2000000000
 
 
 echo 
-./futex_requeue_pi_mismatched_ops -c
+./futex_requeue_pi_mismatched_ops $COLOR
 
 echo 
-./futex_requeue_pi_signal_restart -c
+./futex_requeue_pi_signal_restart $COLOR
 
 echo 
-./futex_wait_timeout -c
+./futex_wait_timeout $COLOR
diff --git a/run.sh b/run.sh
index 0c54a74..a85f821 100755
--- a/run.sh
+++ b/run.sh
@@ -33,6 +33,14 @@
 #
 ###############################################################################
 
+COLOR=""
+tput setf 7
+if [ $? -eq 0 ]; then
+    COLOR="-c"
+    tput sgr0
+fi
+export COLOR
+
 (cd functional; ./run.sh)
 (cd performance; ./run.sh)
 (cd stress; ./run.sh)