tags 327388 + patch
thanks

This patch wil solve the problem, by checing for tput and expr every
time the log functions want to decide if fancy outout is available or
not.

--- /lib/lsb/init-functions.orig  2005-08-12 22:26:09.000000000 +0200
+++ /lib/lsb/init-functions 2005-09-14 13:30:11.000000000 +0200
@@ -122,20 +122,24 @@
     fi
 }

-TPUT=/usr/bin/tput
-EXPR=/usr/bin/expr
-if [ -x $TPUT ] && [ -x $EXPR ] && $TPUT hpa 60 >/dev/null 2>&1; then
-    FANCYTTY=1
-else
-    FANCYTTY=0
-fi
+log_use_fancy_output() {
+    TPUT=/usr/bin/tput
+    EXPR=/usr/bin/expr
+    if [ -x $TPUT ] && [ -x $EXPR ] && $TPUT hpa 60 >/dev/null 2>&1; then
+       FANCYTTY=1
+       true
+    else
+       FANCYTTY=0
+       false
+    fi
+}

 log_success_msg () {
     echo "$@"
 }

 log_failure_msg () {
-    if [ $FANCYTTY -eq 1 ]; then
+    if log_use_fancy_output; then
         RED=`$TPUT setaf 1`
         NORMAL=`$TPUT op`
         echo "$RED*$NORMAL $@"
@@ -145,7 +149,7 @@
 }

 log_warning_msg () {
-    if [ $FANCYTTY -eq 1 ]; then
+    if log_use_fancy_output; then
         YELLOW=`$TPUT setaf 3`
         NORMAL=`$TPUT op`
         echo "$YELLOW*$NORMAL $@"
@@ -232,8 +236,8 @@
     [ -z "$1" ] && return 1

     # Only do the fancy stuff if we have an appropriate terminal
-    # and if /usr is already mounted
-    if [ $FANCYTTY -eq 1 ]; then
+    # and if /usr is currently mounted
+    if log_use_fancy_output; then
         RED=`$TPUT setaf 1`
         NORMAL=`$TPUT op`
         if [ $1 -eq 0 ]; then


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to