Another update of /etc/grml/screenrc_acpi
[grml-etc-core.git] / etc / grml / lsb-functions
index 11ddbcf..2aa0c77 100644 (file)
@@ -100,7 +100,7 @@ log_end_msg() {
     if _have_tput ; then
         COLS="$("$TPUT" cols)"
         if [ -n "$COLS" ]; then
-            COL=$(( "$COLS" - 7 ))
+            COL=$(( $COLS - 7 ))
         else
             COL=73
         fi
@@ -143,6 +143,7 @@ RC_DOT_PATTERN=''
 if [ -r /proc/cmdline ] ; then
     grep -q ' nocolor' /proc/cmdline && RC_NOCOLOR='yes'
 fi
+[ -n "$NOCOLORS" ] && RC_NOCOLOR='yes'
 RC_NOCOLOR="${RC_NOCOLOR:-no}"
 
 # Can the terminal handle endcols?
@@ -156,7 +157,7 @@ if [ -z "${COLS}" ] || [ "${COLS}" -le 0 ] ; then
 fi
 
 if [ "${RC_ENDCOL}" = "yes" ]; then
-    ENDCOL="\e[A\e[$(( "${COLS}" - 8 ))G"
+    ENDCOL="\e[A\e[$(( ${COLS} - 8 ))G"
 else
     ENDCOL=''
 fi
@@ -181,12 +182,11 @@ esyslog() {
     local pri
     local tag
 
+    [ "$#" -le 2 ] && return 0
     if [ -x /usr/bin/logger ] ; then
         pri="$1"
         tag="$2"
-
         shift 2
-        [ "$#" -eq 0 ] && return 0
 
         /usr/bin/logger -p "${pri}" -t "${tag}" -- "$@"
     fi
@@ -199,9 +199,9 @@ esyslog() {
 #    increase the indent used for e-commands.
 #
 eindent() {
-    local i="$1"
+    local i="${1:-0}"
     [ "$i" -gt 0 ] || i="${RC_DEFAULT_INDENT}"
-    esetdent $(( ${#RC_INDENTATION} + "$i" ))
+    esetdent $(( ${#RC_INDENTATION} + $i ))
 }
 
 # void eoutdent(int num)
@@ -209,9 +209,9 @@ eindent() {
 #    decrease the indent used for e-commands.
 #
 eoutdent() {
-    local i="$1"
+    local i="${1:-0}"
     [ "$i" -gt 0 ] || i="${RC_DEFAULT_INDENT}"
-    esetdent $(( ${#RC_INDENTATION} - "$i" ))
+    esetdent $(( ${#RC_INDENTATION} - $i ))
 }
 
 # void esetdent(int num)
@@ -220,7 +220,7 @@ eoutdent() {
 #    num defaults to 0
 #
 esetdent() {
-    local i="$1"
+    local i="${1:-0}"
     [ "$i" -lt 0 ] && i=0
     RC_INDENTATION="$(printf "%${i}s" '')"
 }
@@ -295,7 +295,7 @@ ebegin() {
     [ "${RC_QUIET_STDOUT}" = "yes" ] && return 0
 
     if [ -n "${RC_DOT_PATTERN}" ]; then
-        dots="$(printf "%$(( "$COLS" - 3 - ${#RC_INDENTATION} - ${#msg} - 7 ))s" '')"
+        dots="$(printf "%$(( $COLS - 3 - ${#RC_INDENTATION} - ${#msg} - 7 ))s" '')"
         while [ "${dots#${spaces}}" != "${dots}" ] ; do
             dots="${dots#${spaces}}${RC_DOT_PATTERN}"
         done
@@ -337,7 +337,7 @@ _eend() {
         printf "${ENDCOL}  ${msg}\n"
     else
         [ "${LAST_E_CMD}" = "ebegin" ] || LAST_E_LEN=0
-        printf "%$(( "${COLS}" - "${LAST_E_LEN}" - 6 ))s%b\n" '' "${msg}"
+        printf "%$(( ${COLS} - ${LAST_E_LEN} - 6 ))s%b\n" '' "${msg}"
     fi
 
     return "${retval}"