FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > ArchLinux > ArchLinux General Discussion

 
 
LinkBack Thread Tools
 
Old 06-30-2010, 09:47 PM
Victor Lowther
 
Default Simplify the code that clears USECOLOR.

---
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
 

Thread Tools




All times are GMT. The time now is 04:35 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org