[PATCH 03/48] Simplify the code that clears USECOLOR.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



---
 functions |   21 +++++++--------------
 1 files changed, 7 insertions(+), 14 deletions(-)

diff --git a/functions b/functions
index a9acf6f..6df8c5e 100644
--- a/functions
+++ b/functions
@@ -13,7 +13,7 @@ elif [[ -t 0 ]]; then
     # stty gives "rows cols"; strip the rows number, we just want columns
     STAT_COL="${STAT_COL##* }"
 elif /bin/tput cols &>/dev/null; then
-  # is /usr/share/terminfo already mounted, and TERM recognized?
+    # is /usr/share/terminfo already mounted, and TERM recognized?
     STAT_COL=$(/bin/tput cols)
 fi
 if ((STAT_COL==0)); then
@@ -27,19 +27,12 @@ STAT_COL=$(($STAT_COL - 13))
 
 # disable colors on broken terminals
 TERM_COLORS="$(/bin/tput colors 2>/dev/null)"
-if [ $? = 3 ]; then
-	TERM_COLORS=8
-elif [ -n "${TERM_COLORS}" ]; then
-	case "${TERM_COLORS}" in
-		*[!0-9]*)
-			USECOLOR=""
-			;;
-		*)
-			[ "${TERM_COLORS}" -lt 8 ] && USECOLOR=""
-			;;
-	esac
-else
-	USECOLOR=""
+if (($? != 3)); then
+    case $TERM_COLORS in
+	*[!0-9]*) USECOLOR="";;
+	[0-7])    USECOLOR="";;
+	'')       USECOLOR="";;
+    esac
 fi
 unset TERM_COLORS
 
-- 
1.7.1



[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux