[arch-general] [PATCH 03/48] Simplify the code that clears USECOLOR.
Victor Lowther
victor.lowther at gmail.com
Wed Jun 30 17:47:42 EDT 2010
---
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
More information about the arch-general
mailing list