forked from pool/ncurses
Update to ncurses-6.2 patch 20210320
OBS-URL: https://build.opensuse.org/package/show/Base:System/ncurses?expand=0&rev=537
This commit is contained in:
221
cursescheck
221
cursescheck
@@ -2,7 +2,7 @@
|
||||
# Test ACS Line Graphics and REP capability of a terminal line
|
||||
# Author: Werner Fink <werner@suse.de>
|
||||
|
||||
typeset -i rep=0 line=0
|
||||
typeset -i rep=0 line=0 color=0
|
||||
for s in 0 1 2
|
||||
do
|
||||
test -c /proc/$$/fd/$s || { echo "Missing /proc/$$/fd/$s" 1>&2; exit 1; }
|
||||
@@ -15,7 +15,7 @@ for d in pts fd
|
||||
do
|
||||
test -d /dev/$d || { echo "Missing /dev/$d/" 1>&2; exit 1; }
|
||||
done
|
||||
for p in tput infocmp fold tty grep od
|
||||
for p in tput infocmp tty grep od
|
||||
do
|
||||
type -p $p 1> /dev/null 2>&1 || { echo "Missing $p in path" 1>&2; exit 1; }
|
||||
done
|
||||
@@ -30,7 +30,8 @@ typeset -i height=$(tput lines) || { echo "No terminal size" 1>&2; exit 1; }
|
||||
# arrays used later on.
|
||||
#
|
||||
typeset -i c
|
||||
typeset -a tmp="($(tput acsc | od -A none -tx1))" acsc acsn
|
||||
typeset -A acsc acsn
|
||||
typeset -a tmp="($(tput acsc | od -A none -tx1))"
|
||||
for ((c=0;c<${#tmp[@]};c+=2))
|
||||
do
|
||||
acsc[0x${tmp[c]}]="0x${tmp[c+1]}"
|
||||
@@ -43,10 +44,15 @@ unset tmp c
|
||||
#
|
||||
tput init || { echo "Not a terminal" 1>&2; exit 1; }
|
||||
|
||||
if test -n "$(infocmp -T $TERM -1 | grep "colors#")"
|
||||
then
|
||||
let color++
|
||||
fi
|
||||
|
||||
#
|
||||
# Restore screen at exit
|
||||
#
|
||||
trap 'tput cvvis; tput rmcup' EXIT HUP INT TERM
|
||||
trap 'tput cup 0 0; tput sgr0; tput cvvis; tput rmcup; exit' EXIT HUP INT TERM
|
||||
|
||||
#
|
||||
# Save screen, make curse invisible, and goto upper left
|
||||
@@ -54,15 +60,101 @@ trap 'tput cvvis; tput rmcup' EXIT HUP INT TERM
|
||||
tput smcup
|
||||
tput civis
|
||||
tput cup 0 0
|
||||
if ((color > 0))
|
||||
then
|
||||
tput setab 4
|
||||
tput setaf 7
|
||||
fi
|
||||
tput ed
|
||||
|
||||
echo Checking for Line Graphics on $tty with TERM=$TERM
|
||||
let line++
|
||||
|
||||
smacs="$(tput enacs;tput smacs)"
|
||||
rmacs="$(tput rmacs)"
|
||||
echo Found ${#acsc[@]} ACSC characters, check used Font and its Mapping
|
||||
let line++
|
||||
|
||||
tput cup $((line + 2)) 0
|
||||
typeset -i row=$((line+2)) col=4
|
||||
for sub in ${!acsc[@]}
|
||||
do
|
||||
tput cup $row $col
|
||||
printf "$sub\t\x${sub//0x/}\t${smacs}${acsn[$sub]}${rmacs}"
|
||||
if ((row++ > height-4))
|
||||
then
|
||||
let col=width/2-4
|
||||
let row=line+2
|
||||
fi
|
||||
done
|
||||
unset sub smacs rmacs
|
||||
|
||||
tput cup $line 0
|
||||
tput cvvis
|
||||
echo -n "OK> "
|
||||
read -t 5 yesno
|
||||
|
||||
#
|
||||
# Could use clear
|
||||
#
|
||||
tput -S <<-!
|
||||
civis
|
||||
cup 0 0
|
||||
ed
|
||||
!
|
||||
let line=0
|
||||
|
||||
echo Checking for UTF-8 Line Graphics on $tty with TERM=$TERM
|
||||
let line++
|
||||
|
||||
smacs="$(tput enacs;tput smacs)"
|
||||
rmacs="$(tput rmacs)"
|
||||
echo Use U+2500 upto U+25FF glyps, check used Font and its Mapping
|
||||
let line++
|
||||
|
||||
tput cup $((line+2)) 0
|
||||
typeset -i row=$((line+2)) col=4
|
||||
for x in 94 95 96 97
|
||||
do
|
||||
x=\\x$x
|
||||
for ((c=128;c<=191;c++))
|
||||
do
|
||||
y=\\x$(printf '%x\n' $c)
|
||||
tput cup $row $col
|
||||
printf "\xe2${x}${y}"
|
||||
if ((row++ > height-4))
|
||||
then
|
||||
let col+=2
|
||||
let row=line+2
|
||||
fi
|
||||
done
|
||||
done
|
||||
unset sub smacs rmacs
|
||||
|
||||
tput cup $line 0
|
||||
tput cvvis
|
||||
echo -n "OK> "
|
||||
read -t 5 yesno
|
||||
|
||||
#
|
||||
# Could use clear
|
||||
#
|
||||
tput -S <<-!
|
||||
civis
|
||||
cup 0 0
|
||||
ed
|
||||
!
|
||||
let line=0
|
||||
|
||||
if ((${#acsc[@]} > 0))
|
||||
then
|
||||
echo Terminal TERM=$TERM has ASC Line Graphics, check them.
|
||||
echo Terminal TERM=$TERM has ASC Line Graphics
|
||||
let line++
|
||||
tput cup $((height/2)) 0
|
||||
echo Use them to draw a simple box
|
||||
let line++
|
||||
let row=height/2-4
|
||||
let col=8
|
||||
tput cup $row $col
|
||||
tput -S <<-!
|
||||
enacs
|
||||
smacs
|
||||
@@ -70,19 +162,19 @@ then
|
||||
echo -ne ${acsn[0x6c]}
|
||||
for ((c=0;c<20;c++)); do echo -ne ${acsn[0x71]}; done
|
||||
echo -ne ${acsn[0x6b]}
|
||||
tput cup $((height/2+1)) 0
|
||||
tput cup $((row+1)) $col
|
||||
echo -ne ${acsn[0x78]}
|
||||
tput hpa 21
|
||||
tput hpa $((col+21))
|
||||
echo -ne ${acsn[0x78]}
|
||||
tput cup $((height/2+2)) 0
|
||||
tput cup $((row+2)) $col
|
||||
echo -ne ${acsn[0x78]}
|
||||
tput hpa 21
|
||||
tput hpa $((col+21))
|
||||
echo -ne ${acsn[0x78]}
|
||||
tput cup $((height/2+3)) 0
|
||||
tput cup $((row+3)) $col
|
||||
echo -ne ${acsn[0x78]}
|
||||
tput hpa 21
|
||||
tput hpa $((col+21))
|
||||
echo -ne ${acsn[0x78]}
|
||||
tput cup $((height/2+4)) 0
|
||||
tput cup $((row+4)) $col
|
||||
echo -ne ${acsn[0x6d]}
|
||||
for ((c=0;c<20;c++)); do echo -ne ${acsn[0x71]}; done
|
||||
echo -ne ${acsn[0x6a]}
|
||||
@@ -95,6 +187,12 @@ then
|
||||
read -t 5 yesno
|
||||
else
|
||||
echo Terminal TERM=$TERM has no ASC Line Graphics. Done
|
||||
tput -S <<-!
|
||||
cup 0 0
|
||||
sgr0
|
||||
ed
|
||||
rmcup
|
||||
!
|
||||
exit 0
|
||||
fi
|
||||
|
||||
@@ -102,6 +200,71 @@ fi
|
||||
# Could use clear
|
||||
#
|
||||
tput -S <<-!
|
||||
civis
|
||||
cup 0 0
|
||||
ed
|
||||
!
|
||||
let line=0
|
||||
|
||||
if ((1))
|
||||
then
|
||||
|
||||
ul=\\xe2\\x94\\x8c
|
||||
ur=\\xe2\\x94\\x90
|
||||
hl=\\xe2\\x94\\x80
|
||||
vl=\\xe2\\x94\\x82
|
||||
dl=\\xe2\\x94\\x94
|
||||
dr=\\xe2\\x94\\x98
|
||||
|
||||
echo Terminal TERM=$TERM with UTF-8 Line Graphics
|
||||
let line++
|
||||
echo Use them to draw a simple box
|
||||
let line++
|
||||
let row=height/2-4
|
||||
let col=8
|
||||
tput cup $row $col
|
||||
tput enacs
|
||||
|
||||
echo -ne ${ul}
|
||||
for ((c=0;c<20;c++)); do echo -ne ${hl}; done
|
||||
echo -ne ${ur}
|
||||
tput cup $((row+1)) $col
|
||||
echo -ne ${vl}
|
||||
tput hpa $((col+21))
|
||||
echo -ne ${vl}
|
||||
tput cup $((row+2)) $col
|
||||
echo -ne ${vl}
|
||||
tput hpa $((col+21))
|
||||
echo -ne ${vl}
|
||||
tput cup $((row+3)) $col
|
||||
echo -ne ${vl}
|
||||
tput hpa $((col+21))
|
||||
echo -ne ${vl}
|
||||
tput cup $((row+4)) $col
|
||||
echo -ne ${dl}
|
||||
for ((c=0;c<20;c++)); do echo -ne ${hl}; done
|
||||
echo -ne ${dr}
|
||||
|
||||
tput cup $line 0
|
||||
tput cvvis
|
||||
echo -n "OK> "
|
||||
read -t 5 yesno
|
||||
else
|
||||
echo Terminal TERM=$TERM has no ASC Line Graphics. Done
|
||||
tput -S <<-!
|
||||
cup 0 0
|
||||
sgr0
|
||||
ed
|
||||
rmcup
|
||||
!
|
||||
exit 0
|
||||
fi
|
||||
|
||||
#
|
||||
# Could use clear
|
||||
#
|
||||
tput -S <<-!
|
||||
civis
|
||||
cup 0 0
|
||||
ed
|
||||
!
|
||||
@@ -113,44 +276,58 @@ then
|
||||
let line++
|
||||
else
|
||||
echo No rep capability given in terminfo database for TERM=$TERM
|
||||
tput cvvis
|
||||
echo -n "OK> "
|
||||
read -t 5 yesno
|
||||
tput -S <<-!
|
||||
cup 0 0
|
||||
sgr0
|
||||
ed
|
||||
rmcup
|
||||
!
|
||||
exit 0
|
||||
fi
|
||||
if ((rep > 0))
|
||||
then
|
||||
echo Testing rep capability of TERM=$TERM
|
||||
let line++
|
||||
let row=height/2-4
|
||||
let col=8
|
||||
tput -S <<-!
|
||||
civis
|
||||
enacs
|
||||
smacs
|
||||
bold
|
||||
cup $((height/2)) 0
|
||||
cup $row $col
|
||||
rep ${acsc[0x6c]} 0
|
||||
rep ${acsc[0x71]} 20
|
||||
rep ${acsc[0x6b]} 0
|
||||
cup $((height/2+1)) 0
|
||||
cup $((row+1)) $col
|
||||
rep ${acsc[0x78]} 0
|
||||
hpa 21
|
||||
hpa $((col+21))
|
||||
rep ${acsc[0x78]} 0
|
||||
cup $((height/2+2)) 0
|
||||
cup $((row+2)) $col
|
||||
rep ${acsc[0x78]} 0
|
||||
hpa 21
|
||||
hpa $((col+21))
|
||||
rep ${acsc[0x78]} 0
|
||||
cup $((height/2+3)) 0
|
||||
cup $((row+3)) $col
|
||||
rep ${acsc[0x78]} 0
|
||||
hpa 21
|
||||
hpa $((col+21))
|
||||
rep ${acsc[0x78]} 0
|
||||
cup $((height/2+4)) 0
|
||||
cup $((row+4)) $col
|
||||
rep ${acsc[0x6d]} 0
|
||||
rep ${acsc[0x71]} 20
|
||||
rep ${acsc[0x6a]} 0
|
||||
sgr0
|
||||
rmacs
|
||||
cvvis
|
||||
!
|
||||
if ((color > 0))
|
||||
then
|
||||
tput setab 4
|
||||
tput setaf 7
|
||||
fi
|
||||
tput cup $line 0
|
||||
tput cvvis
|
||||
echo -n "OK> "
|
||||
read -t 5 yesno
|
||||
fi
|
||||
|
Reference in New Issue
Block a user