Hack for broken 'printf' in some lightweight shells

git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@4814 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb
This commit is contained in:
teastep 2006-11-08 16:30:25 +00:00
parent 3a4f17e70a
commit aafbe86404

View File

@ -1203,6 +1203,7 @@ do_log_rule_limit() # $1 = log level, $2 = chain, $3 = display Chain $4 = dispos
local command=${7:--A}
local prefix
local base=$(chain_base $displayChain)
local pf
limit="${5:-$LOGLIMIT}" # Do this here rather than in the declaration above to appease /bin/ash.
@ -1214,11 +1215,16 @@ do_log_rule_limit() # $1 = log level, $2 = chain, $3 = display Chain $4 = dispos
fi
if [ -n "$LOGRULENUMBERS" ]; then
#
# Hack for broken printf on some lightweight shells
#
[ $(printf "%d" 1) = "1" ] && pf=printf || pf=$(mywhich printf)
eval rulenum=\$${base}_logrules
rulenum=${rulenum:-1}
prefix="$(printf "$LOGFORMAT" $displayChain $rulenum $disposition)${tag}"
prefix="$($pf "$LOGFORMAT" $displayChain $rulenum $disposition)${tag}"
rulenum=$(($rulenum + 1))
eval ${base}_logrules=$rulenum