[pacman-dev] [PATCH 2/2] makepkg: use tput for terminal-safe colored and bold text

Cedric Staniewski cedric at gmx.ca
Fri Oct 23 07:51:27 EDT 2009


Suggested-by: Dan McGee <dan at archlinux.org>
Signed-off-by: Cedric Staniewski <cedric at gmx.ca>
---

Does by chance anybody know if it is possible to build readline without ncurses? If so, we should add tput (ncurses) dependency to the header.

 scripts/makepkg.sh.in |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index 2a3d22d..b89acdb 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -1555,13 +1555,13 @@ fi
 
 # check if messages are to be printed using color
 if [ -t 2 -a ! "$USE_COLOR" = "n" -a "$(check_buildenv color)" = "y" ]; then
-	readonly ALL_OFF="\033[1;0m" \
-						BOLD="\033[1;1m"
+	readonly ALL_OFF="$(tput sgr0)" \
+						BOLD="$(tput bold)"
 	readonly ALL_OFF_BOLD="${ALL_OFF}${BOLD}" \
-						RED="${BOLD}\033[1;31m" \
-						BLUE="${BOLD}\033[1;34m" \
-						GREEN="${BOLD}\033[1;32m" \
-						YELLOW="${BOLD}\033[1;33m"
+						RED="${BOLD}$(tput setaf 1)" \
+						BLUE="${BOLD}$(tput setaf 4)" \
+						GREEN="${BOLD}$(tput setaf 2)" \
+						YELLOW="${BOLD}$(tput setaf 3)"
 else
 	unset ALL_OFF ALL_OFF_BOLD BOLD RED BLUE GREEN YELLOW
 	readonly ALL_OFF ALL_OFF_BOLD BOLD RED BLUE GREEN YELLOW
-- 
1.6.5.1



More information about the pacman-dev mailing list