Commit c6cf6813 authored by Vitaly Lipatov's avatar Vitaly Lipatov

add support for work without tput, with uncompat tput, allow USETTY=0 for disable tput use

parent 52a445b4
......@@ -30,6 +30,10 @@ isatty()
check_tty()
{
isatty || return
which tput >/dev/null 2>/dev/null || return
# FreeBSD does not support tput -S
echo | tput -S >/dev/null 2>/dev/null || return
[ -z "$USETTY" ] || return
export USETTY=1
}
......@@ -37,7 +41,7 @@ check_tty()
set_boldcolor()
{
[ -n "$USETTY" ] || return
[ "$USETTY" = "1" ] || return
{
echo bold
echo setaf $1
......@@ -46,7 +50,7 @@ set_boldcolor()
restore_color()
{
[ -n "$USETTY" ] || return
[ "$USETTY" = "1" ] || return
{
echo op; # set Original color Pair.
echo sgr0; # turn off all special graphics mode (bold in our case).
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment