SVN: rc-scripts/trunk/rc.d/init.d/functions
glen
glen at pld-linux.org
Sun Sep 17 17:01:48 CEST 2006
Author: glen
Date: Sun Sep 17 17:01:47 2006
New Revision: 7764
Modified:
rc-scripts/trunk/rc.d/init.d/functions
Log:
Use buggy awk-printf wrapper only if /bin/printf is not available.
Modified: rc-scripts/trunk/rc.d/init.d/functions
==============================================================================
--- rc-scripts/trunk/rc.d/init.d/functions (original)
+++ rc-scripts/trunk/rc.d/init.d/functions Sun Sep 17 17:01:47 2006
@@ -200,22 +200,25 @@
fi
}
-# printf equivalent
-printf_()
-{
- typeset text m
- text="$1" ;
- shift ;
- if [ $# -gt 0 ]; then
- m="$1";
- shift;
- while [ $# -gt 0 ]; do
- m="$m\",\"$1" ;
- shift ;
- done
- fi
- awk "BEGIN {printf \"$text\", \"$m\"; }"
-}
+if [ ! -x /bin/printf ]; then
+ # printf equivalent
+ # FIXME: buggy when single or double quotes in message!
+ printf()
+ {
+ typeset text m
+ text="$1"
+ shift
+ if [ $# -gt 0 ]; then
+ m="$1"
+ shift
+ while [ $# -gt 0 ]; do
+ m="$m\",\"$1"
+ shift
+ done
+ fi
+ awk "BEGIN {printf \"$text\", \"$m\"; }"
+ }
+fi
# National language support function
nls()
@@ -251,9 +254,9 @@
printf "$message" "$@"
elif [ -x /bin/gettext -o -x /usr/bin/gettext ]; then
text=$(TEXTDOMAINDIR="/etc/sysconfig/locale" gettext -e --domain="${NLS_DOMAIN:-rc-scripts}" "$message")
- printf_ "$text" "$@"
+ printf "$text" "$@"
else
- printf_ "$message" "$@"
+ printf "$message" "$@"
fi
echo -en "$msg_echo"
More information about the pld-cvs-commit
mailing list