forked from pool/ncurses
cursescheck enhenced
OBS-URL: https://build.opensuse.org/package/show/Base:System/ncurses?expand=0&rev=539
This commit is contained in:
parent
42ed914213
commit
ec0900e037
219
cursescheck
219
cursescheck
@ -1,6 +1,18 @@
|
||||
#!/bin/bash
|
||||
# Test ACS Line Graphics and REP capability of a terminal line
|
||||
#
|
||||
# cursescheck Test ACS/UTF-8 Line Graphics and REP capability
|
||||
# of a terminal line described by variable TERM.
|
||||
#
|
||||
# Written in bash code to show and test capabilities of an terminal
|
||||
# or terminal emulator without the `magic' of a binary program using
|
||||
# libncurses(w) as many users do belive that ncurses defines the
|
||||
# behaviour of a terminal. Here we show that the terminfo database
|
||||
# given by the TERM variable simply describes the capabilities of
|
||||
# a terminal. For this `infocmp(1)' and `tput(1)' is used as well
|
||||
# the helpers `tty(1)', `grep(1), and `od(1)' are used herein.
|
||||
#
|
||||
# Author: Werner Fink <werner@suse.de>
|
||||
#
|
||||
|
||||
typeset -i rep=0 line=0 color=0
|
||||
for s in 0 1 2
|
||||
@ -62,21 +74,23 @@ tput civis
|
||||
tput cup 0 0
|
||||
if ((color > 0))
|
||||
then
|
||||
tput setab 4
|
||||
tput setaf 7
|
||||
tput -S <<-!
|
||||
setab 4
|
||||
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
|
||||
typeset smacs=$(tput enacs; tput smacs)
|
||||
typeset rmacs=$(tput rmacs)
|
||||
for sub in ${!acsc[@]}
|
||||
do
|
||||
tput cup $row $col
|
||||
@ -107,8 +121,6 @@ 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++
|
||||
|
||||
@ -148,6 +160,7 @@ let line=0
|
||||
|
||||
if ((${#acsc[@]} > 0))
|
||||
then
|
||||
typeset -i cx=20
|
||||
echo Terminal TERM=$TERM has ASC Line Graphics
|
||||
let line++
|
||||
echo Use them to draw a simple box
|
||||
@ -159,28 +172,53 @@ then
|
||||
enacs
|
||||
smacs
|
||||
!
|
||||
if ((color > 0))
|
||||
then
|
||||
tput -S <<-!
|
||||
setab 7
|
||||
setaf 0
|
||||
!
|
||||
fi
|
||||
echo -ne ${acsn[0x6c]}
|
||||
for ((c=0;c<20;c++)); do echo -ne ${acsn[0x71]}; done
|
||||
for ((c=0;c<cx;c++)); do echo -ne ${acsn[0x71]}; done
|
||||
echo -ne ${acsn[0x6b]}
|
||||
tput cup $((row+1)) $col
|
||||
echo -ne ${acsn[0x78]}
|
||||
tput hpa $((col+21))
|
||||
echo -ne ${acsn[0x78]}
|
||||
tput cup $((row+2)) $col
|
||||
echo -ne ${acsn[0x78]}
|
||||
tput hpa $((col+21))
|
||||
echo -ne ${acsn[0x78]}
|
||||
tput cup $((row+3)) $col
|
||||
echo -ne ${acsn[0x78]}
|
||||
tput hpa $((col+21))
|
||||
echo -ne ${acsn[0x78]}
|
||||
tput cup $((row+4)) $col
|
||||
for ((c=1;c<4;c++))
|
||||
do
|
||||
tput cup $((row+c)) $col
|
||||
echo -ne ${acsn[0x78]}
|
||||
((color > 0)) && tput ech $cx
|
||||
tput hpa $((col+cx+1))
|
||||
echo -ne ${acsn[0x78]}
|
||||
done
|
||||
tput cup $((row+c)) $col
|
||||
echo -ne ${acsn[0x6d]}
|
||||
for ((c=0;c<20;c++)); do echo -ne ${acsn[0x71]}; done
|
||||
for ((c=0;c<cx;c++)); do echo -ne ${acsn[0x71]}; done
|
||||
echo -ne ${acsn[0x6a]}
|
||||
if ((color > 0))
|
||||
then
|
||||
tput -S <<-!
|
||||
setab 0
|
||||
setaf 0
|
||||
cup $((row+1)) $((col+cx+2))
|
||||
ech 2
|
||||
cup $((row+2)) $((col+cx+2))
|
||||
ech 2
|
||||
cup $((row+3)) $((col+cx+2))
|
||||
ech 2
|
||||
cup $((row+4)) $((col+cx+2))
|
||||
ech 2
|
||||
cup $((row+5)) $((col+2))
|
||||
ech $((cx+2))
|
||||
setab 4
|
||||
setaf 7
|
||||
!
|
||||
fi
|
||||
tput -S <<-!
|
||||
rmacs
|
||||
!
|
||||
tput cup $((row+2)) $((col+4))
|
||||
echo -n "<ACS BOX>"
|
||||
|
||||
tput cup $line 0
|
||||
tput cvvis
|
||||
echo -n "OK> "
|
||||
@ -193,7 +231,6 @@ else
|
||||
ed
|
||||
rmcup
|
||||
!
|
||||
exit 0
|
||||
fi
|
||||
|
||||
#
|
||||
@ -209,6 +246,9 @@ let line=0
|
||||
if ((1))
|
||||
then
|
||||
|
||||
#
|
||||
# UTF-8 wide character line glyphs
|
||||
#
|
||||
ul=\\xe2\\x94\\x8c
|
||||
ur=\\xe2\\x94\\x90
|
||||
hl=\\xe2\\x94\\x80
|
||||
@ -216,6 +256,7 @@ then
|
||||
dl=\\xe2\\x94\\x94
|
||||
dr=\\xe2\\x94\\x98
|
||||
|
||||
typeset -i cx=20
|
||||
echo Terminal TERM=$TERM with UTF-8 Line Graphics
|
||||
let line++
|
||||
echo Use them to draw a simple box
|
||||
@ -223,27 +264,50 @@ then
|
||||
let row=height/2-4
|
||||
let col=8
|
||||
tput cup $row $col
|
||||
if ((color > 0))
|
||||
then
|
||||
tput -S <<-!
|
||||
setab 7
|
||||
setaf 0
|
||||
!
|
||||
fi
|
||||
tput enacs
|
||||
|
||||
echo -ne ${ul}
|
||||
for ((c=0;c<20;c++)); do echo -ne ${hl}; done
|
||||
for ((c=0;c<$cx;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
|
||||
for ((c=1;c<4;c++))
|
||||
do
|
||||
tput cup $((row+c)) $col
|
||||
echo -ne ${vl}
|
||||
((color > 0)) && tput ech $cx
|
||||
tput hpa $((col+cx+1))
|
||||
echo -ne ${vl}
|
||||
done
|
||||
tput cup $((row+c)) $col
|
||||
echo -ne ${dl}
|
||||
for ((c=0;c<20;c++)); do echo -ne ${hl}; done
|
||||
for ((c=0;c<$cx;c++)); do echo -ne ${hl}; done
|
||||
echo -ne ${dr}
|
||||
if ((color > 0))
|
||||
then
|
||||
tput -S <<-!
|
||||
setab 0
|
||||
setaf 0
|
||||
cup $((row+1)) $((col+cx+2))
|
||||
ech 2
|
||||
cup $((row+2)) $((col+cx+2))
|
||||
ech 2
|
||||
cup $((row+3)) $((col+cx+2))
|
||||
ech 2
|
||||
cup $((row+4)) $((col+cx+2))
|
||||
ech 2
|
||||
cup $((row+5)) $((col+2))
|
||||
ech $((cx+2))
|
||||
setab 4
|
||||
setaf 7
|
||||
!
|
||||
fi
|
||||
tput cup $((row+2)) $((col+4))
|
||||
echo -n "<UTF-8 BOX>"
|
||||
|
||||
tput cup $line 0
|
||||
tput cvvis
|
||||
@ -257,7 +321,6 @@ else
|
||||
ed
|
||||
rmcup
|
||||
!
|
||||
exit 0
|
||||
fi
|
||||
|
||||
#
|
||||
@ -287,45 +350,71 @@ else
|
||||
!
|
||||
exit 0
|
||||
fi
|
||||
if ((rep > 0))
|
||||
|
||||
if ((${#acsc[@]} > 0 && rep > 0))
|
||||
then
|
||||
typeset -i cx=20
|
||||
echo Testing rep capability of TERM=$TERM
|
||||
let line++
|
||||
let row=height/2-4
|
||||
let col=8
|
||||
if ((color > 0))
|
||||
then
|
||||
tput -S <<-!
|
||||
setab 7
|
||||
setaf 0
|
||||
!
|
||||
fi
|
||||
tput -S <<-!
|
||||
civis
|
||||
enacs
|
||||
smacs
|
||||
bold
|
||||
cup $row $col
|
||||
rep ${acsc[0x6c]} 0
|
||||
rep ${acsc[0x71]} 20
|
||||
rep ${acsc[0x6b]} 0
|
||||
cup $((row+1)) $col
|
||||
rep ${acsc[0x78]} 0
|
||||
hpa $((col+21))
|
||||
rep ${acsc[0x78]} 0
|
||||
cup $((row+2)) $col
|
||||
rep ${acsc[0x78]} 0
|
||||
hpa $((col+21))
|
||||
rep ${acsc[0x78]} 0
|
||||
cup $((row+3)) $col
|
||||
rep ${acsc[0x78]} 0
|
||||
hpa $((col+21))
|
||||
rep ${acsc[0x78]} 0
|
||||
cup $((row+4)) $col
|
||||
rep ${acsc[0x6d]} 0
|
||||
rep ${acsc[0x71]} 20
|
||||
rep ${acsc[0x6a]} 0
|
||||
sgr0
|
||||
!
|
||||
echo -ne ${acsn[0x6c]}
|
||||
tput rep ${acsc[0x71]} $cx
|
||||
echo -ne ${acsn[0x6b]}
|
||||
for ((c=1;c<4;c++))
|
||||
do
|
||||
tput cup $((row+c)) $col
|
||||
echo -ne ${acsn[0x78]}
|
||||
tput hpa $((col+cx+1))
|
||||
echo -ne ${acsn[0x78]}
|
||||
done
|
||||
tput cup $((row+c)) $col
|
||||
echo -ne ${acsn[0x6d]}
|
||||
tput rep ${acsc[0x71]} $cx
|
||||
echo -ne ${acsn[0x6a]}
|
||||
tput -S <<-!
|
||||
rmacs
|
||||
!
|
||||
if ((color > 0))
|
||||
then
|
||||
tput setab 4
|
||||
tput setaf 7
|
||||
tput -S <<-!
|
||||
cup $((row+1)) $((col+1))
|
||||
ech $cx
|
||||
cup $((row+2)) $((col+1))
|
||||
ech $cx
|
||||
cup $((row+3)) $((col+1))
|
||||
ech $cx
|
||||
setab 0
|
||||
setaf 0
|
||||
cup $((row+1)) $((col+cx+2))
|
||||
ech 2
|
||||
cup $((row+2)) $((col+cx+2))
|
||||
ech 2
|
||||
cup $((row+3)) $((col+cx+2))
|
||||
ech 2
|
||||
cup $((row+4)) $((col+cx+2))
|
||||
ech 2
|
||||
cup $((row+5)) $((col+2))
|
||||
ech $((cx+2))
|
||||
setab 4
|
||||
setaf 7
|
||||
!
|
||||
fi
|
||||
tput cup $((row+2)) $((col+4))
|
||||
echo -n "<ACS BOX (REP)>"
|
||||
|
||||
tput cup $line 0
|
||||
tput cvvis
|
||||
echo -n "OK> "
|
||||
|
@ -1,3 +1,8 @@
|
||||
-------------------------------------------------------------------
|
||||
Tue Mar 23 10:07:04 UTC 2021 - Dr. Werner Fink <werner@suse.de>
|
||||
|
||||
- Enhence cursescheck script
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Mar 22 15:39:19 UTC 2021 - Dr. Werner Fink <werner@suse.de>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user