### SUBROUTINES ### plain() { - if [ ! "$USE_COLOR" = "n" -a "$(check_buildenv color)" = "y" ]; then - echo -e " \033[1;1m$1\033[1;0m" >&2 + local mesg=$1; shift + if [ -t 2 -a ! "$USE_COLOR" = "n" -a "$(check_buildenv color)" = "y" ]; then + printf "\033[1;37m ${mesg}\033[0m\n" "$@" >&2 else - echo " $1" >&2 + printf " ${mesg}\n" "$@" >&2 fi } msg() { - if [ ! "$USE_COLOR" = "n" -a "$(check_buildenv color)" = "y" ]; then - echo -e "\033[1;32m==>\033[1;0m \033[1;1m$1\033[1;0m" >&2 + local mesg=$1; shift + if [ -t 2 -a ! "$USE_COLOR" = "n" -a "$(check_buildenv color)" = "y" ]; then + printf "\033[1;32m==>\033[1;37m ${mesg}\033[0m\n" "$@" >&2 else - echo "==> $1" >&2 + printf "==> ${mesg}\n" "$@" >&2 fi } msg2() { - if [ ! "$USE_COLOR" = "n" -a "$(check_buildenv color)" = "y" ]; then - echo -e " \033[1;34m->\033[1;0m \033[1;1m$1\033[1;0m" >&2 + local mesg=$1; shift + if [ -t 2 -a ! "$USE_COLOR" = "n" -a "$(check_buildenv color)" = "y" ]; then + printf "\033[1;34m ->\033[1;37m ${mesg}\033[0m\n" "$@" >&2 else - echo " -> $1" >&2 + printf " -> ${mesg}\n" "$@" >&2 fi } warning() { - if [ ! "$USE_COLOR" = "n" -a "$(check_buildenv color)" = "y" ]; then - echo -e "\033[1;33m==> WARNING:\033[1;0m \033[1;1m$1\033[1;0m" >&2 + local mesg=$1; shift + if [ -t 2 -a ! "$USE_COLOR" = "n" -a "$(check_buildenv color)" = "y" ]; then + printf "\033[1;33m==> $(gettext "WARNING:")\033[1;37m ${mesg}\033[0m\n" "$@" >&2 else - echo "==> WARNING: $1" >&2 + printf "==> $(gettext "WARNING:") ${mesg}\n" "$@" >&2 fi } error() { - if [ ! "$USE_COLOR" = "n" -a "$(check_buildenv color)" = "y" ]; then - echo -e "\033[1;31m==> ERROR:\033[1;0m \033[1;1m$1\033[1;0m" >&2 + local mesg=$1; shift + if [ -t 2 -a ! "$USE_COLOR" = "n" -a "$(check_buildenv color)" = "y" ]; then + printf "\033[1;31m==> $(gettext "ERROR:")\033[1;37m ${mesg}\033[0m\n" "$@" >&2 else - echo "==> ERROR: $1" >&2 + printf "==> $(gettext "ERROR:") ${mesg}\n" "$@" >&2 + fi +} + +