lsb-functions: stricter argument checks in some functions
authorFrank Terbeck <ft@grml.org>
Mon, 17 Sep 2007 21:33:54 +0000 (23:33 +0200)
committerFrank Terbeck <ft@grml.org>
Mon, 17 Sep 2007 21:33:54 +0000 (23:33 +0200)
etc/grml/lsb-functions

index 35901be..895e578 100644 (file)
@@ -182,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
@@ -200,7 +199,7 @@ 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 ))
 }
@@ -210,7 +209,7 @@ 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 ))
 }
@@ -221,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" '')"
 }