]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
test for 'printf'
authorMark Andrews <marka@isc.org>
Wed, 4 Oct 2017 08:18:56 +0000 (19:18 +1100)
committerMark Andrews <marka@isc.org>
Wed, 4 Oct 2017 08:18:56 +0000 (19:18 +1100)
bin/tests/system/conf.sh.in

index 61df6750d5e617ac174432a1b0f827be0496f6b2..65192a54c22db9a745b0dfa2ba3f6d364c699502 100644 (file)
@@ -153,21 +153,34 @@ else
     COLOR_NONE=''
 fi
 
-echofail () {
-        printf "${COLOR_FAIL}%s${COLOR_NONE}\n" "$*"
-}
-
-echowarn () {
-        printf "${COLOR_WARN}%s${COLOR_NONE}\n" "$*"
-}
-
-echopass () {
-        printf "${COLOR_PASS}%s${COLOR_NONE}\n" "$*"
-}
-
-echoinfo () {
-        printf "${COLOR_INFO}%s${COLOR_NONE}\n" "$*"
-}
+if type printf > /dev/null 2>&1
+then
+       echofail () {
+               printf "${COLOR_FAIL}%s${COLOR_NONE}\n" "$*"
+       }
+       echowarn () {
+               printf "${COLOR_WARN}%s${COLOR_NONE}\n" "$*"
+       }
+       echopass () {
+               printf "${COLOR_PASS}%s${COLOR_NONE}\n" "$*"
+       }
+       echoinfo () {
+               printf "${COLOR_INFO}%s${COLOR_NONE}\n" "$*"
+       }
+else
+       echofail () {
+               echo "$*"
+       }
+       echowarn () {
+               echo "$*"
+       }
+       echopass () {
+               echo "$*"
+       }
+       echoinfo () {
+               echo "$*"
+       }
+fi
 
 #
 # Export command paths