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
|
#!/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>
|
# Author: Werner Fink <werner@suse.de>
|
||||||
|
#
|
||||||
|
|
||||||
typeset -i rep=0 line=0 color=0
|
typeset -i rep=0 line=0 color=0
|
||||||
for s in 0 1 2
|
for s in 0 1 2
|
||||||
@ -62,21 +74,23 @@ tput civis
|
|||||||
tput cup 0 0
|
tput cup 0 0
|
||||||
if ((color > 0))
|
if ((color > 0))
|
||||||
then
|
then
|
||||||
tput setab 4
|
tput -S <<-!
|
||||||
tput setaf 7
|
setab 4
|
||||||
|
setaf 7
|
||||||
|
!
|
||||||
fi
|
fi
|
||||||
tput ed
|
tput ed
|
||||||
|
|
||||||
echo Checking for Line Graphics on $tty with TERM=$TERM
|
echo Checking for Line Graphics on $tty with TERM=$TERM
|
||||||
let line++
|
let line++
|
||||||
|
|
||||||
smacs="$(tput enacs;tput smacs)"
|
|
||||||
rmacs="$(tput rmacs)"
|
|
||||||
echo Found ${#acsc[@]} ACSC characters, check used Font and its Mapping
|
echo Found ${#acsc[@]} ACSC characters, check used Font and its Mapping
|
||||||
let line++
|
let line++
|
||||||
|
|
||||||
tput cup $((line + 2)) 0
|
tput cup $((line + 2)) 0
|
||||||
typeset -i row=$((line+2)) col=4
|
typeset -i row=$((line+2)) col=4
|
||||||
|
typeset smacs=$(tput enacs; tput smacs)
|
||||||
|
typeset rmacs=$(tput rmacs)
|
||||||
for sub in ${!acsc[@]}
|
for sub in ${!acsc[@]}
|
||||||
do
|
do
|
||||||
tput cup $row $col
|
tput cup $row $col
|
||||||
@ -107,8 +121,6 @@ let line=0
|
|||||||
echo Checking for UTF-8 Line Graphics on $tty with TERM=$TERM
|
echo Checking for UTF-8 Line Graphics on $tty with TERM=$TERM
|
||||||
let line++
|
let line++
|
||||||
|
|
||||||
smacs="$(tput enacs;tput smacs)"
|
|
||||||
rmacs="$(tput rmacs)"
|
|
||||||
echo Use U+2500 upto U+25FF glyps, check used Font and its Mapping
|
echo Use U+2500 upto U+25FF glyps, check used Font and its Mapping
|
||||||
let line++
|
let line++
|
||||||
|
|
||||||
@ -148,6 +160,7 @@ let line=0
|
|||||||
|
|
||||||
if ((${#acsc[@]} > 0))
|
if ((${#acsc[@]} > 0))
|
||||||
then
|
then
|
||||||
|
typeset -i cx=20
|
||||||
echo Terminal TERM=$TERM has ASC Line Graphics
|
echo Terminal TERM=$TERM has ASC Line Graphics
|
||||||
let line++
|
let line++
|
||||||
echo Use them to draw a simple box
|
echo Use them to draw a simple box
|
||||||
@ -159,28 +172,53 @@ then
|
|||||||
enacs
|
enacs
|
||||||
smacs
|
smacs
|
||||||
!
|
!
|
||||||
|
if ((color > 0))
|
||||||
|
then
|
||||||
|
tput -S <<-!
|
||||||
|
setab 7
|
||||||
|
setaf 0
|
||||||
|
!
|
||||||
|
fi
|
||||||
echo -ne ${acsn[0x6c]}
|
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]}
|
echo -ne ${acsn[0x6b]}
|
||||||
tput cup $((row+1)) $col
|
for ((c=1;c<4;c++))
|
||||||
echo -ne ${acsn[0x78]}
|
do
|
||||||
tput hpa $((col+21))
|
tput cup $((row+c)) $col
|
||||||
echo -ne ${acsn[0x78]}
|
echo -ne ${acsn[0x78]}
|
||||||
tput cup $((row+2)) $col
|
((color > 0)) && tput ech $cx
|
||||||
echo -ne ${acsn[0x78]}
|
tput hpa $((col+cx+1))
|
||||||
tput hpa $((col+21))
|
echo -ne ${acsn[0x78]}
|
||||||
echo -ne ${acsn[0x78]}
|
done
|
||||||
tput cup $((row+3)) $col
|
tput cup $((row+c)) $col
|
||||||
echo -ne ${acsn[0x78]}
|
|
||||||
tput hpa $((col+21))
|
|
||||||
echo -ne ${acsn[0x78]}
|
|
||||||
tput cup $((row+4)) $col
|
|
||||||
echo -ne ${acsn[0x6d]}
|
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]}
|
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 <<-!
|
tput -S <<-!
|
||||||
rmacs
|
rmacs
|
||||||
!
|
!
|
||||||
|
tput cup $((row+2)) $((col+4))
|
||||||
|
echo -n "<ACS BOX>"
|
||||||
|
|
||||||
tput cup $line 0
|
tput cup $line 0
|
||||||
tput cvvis
|
tput cvvis
|
||||||
echo -n "OK> "
|
echo -n "OK> "
|
||||||
@ -193,7 +231,6 @@ else
|
|||||||
ed
|
ed
|
||||||
rmcup
|
rmcup
|
||||||
!
|
!
|
||||||
exit 0
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -209,6 +246,9 @@ let line=0
|
|||||||
if ((1))
|
if ((1))
|
||||||
then
|
then
|
||||||
|
|
||||||
|
#
|
||||||
|
# UTF-8 wide character line glyphs
|
||||||
|
#
|
||||||
ul=\\xe2\\x94\\x8c
|
ul=\\xe2\\x94\\x8c
|
||||||
ur=\\xe2\\x94\\x90
|
ur=\\xe2\\x94\\x90
|
||||||
hl=\\xe2\\x94\\x80
|
hl=\\xe2\\x94\\x80
|
||||||
@ -216,6 +256,7 @@ then
|
|||||||
dl=\\xe2\\x94\\x94
|
dl=\\xe2\\x94\\x94
|
||||||
dr=\\xe2\\x94\\x98
|
dr=\\xe2\\x94\\x98
|
||||||
|
|
||||||
|
typeset -i cx=20
|
||||||
echo Terminal TERM=$TERM with UTF-8 Line Graphics
|
echo Terminal TERM=$TERM with UTF-8 Line Graphics
|
||||||
let line++
|
let line++
|
||||||
echo Use them to draw a simple box
|
echo Use them to draw a simple box
|
||||||
@ -223,27 +264,50 @@ then
|
|||||||
let row=height/2-4
|
let row=height/2-4
|
||||||
let col=8
|
let col=8
|
||||||
tput cup $row $col
|
tput cup $row $col
|
||||||
|
if ((color > 0))
|
||||||
|
then
|
||||||
|
tput -S <<-!
|
||||||
|
setab 7
|
||||||
|
setaf 0
|
||||||
|
!
|
||||||
|
fi
|
||||||
tput enacs
|
tput enacs
|
||||||
|
|
||||||
echo -ne ${ul}
|
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}
|
echo -ne ${ur}
|
||||||
tput cup $((row+1)) $col
|
for ((c=1;c<4;c++))
|
||||||
echo -ne ${vl}
|
do
|
||||||
tput hpa $((col+21))
|
tput cup $((row+c)) $col
|
||||||
echo -ne ${vl}
|
echo -ne ${vl}
|
||||||
tput cup $((row+2)) $col
|
((color > 0)) && tput ech $cx
|
||||||
echo -ne ${vl}
|
tput hpa $((col+cx+1))
|
||||||
tput hpa $((col+21))
|
echo -ne ${vl}
|
||||||
echo -ne ${vl}
|
done
|
||||||
tput cup $((row+3)) $col
|
tput cup $((row+c)) $col
|
||||||
echo -ne ${vl}
|
|
||||||
tput hpa $((col+21))
|
|
||||||
echo -ne ${vl}
|
|
||||||
tput cup $((row+4)) $col
|
|
||||||
echo -ne ${dl}
|
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}
|
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 cup $line 0
|
||||||
tput cvvis
|
tput cvvis
|
||||||
@ -257,7 +321,6 @@ else
|
|||||||
ed
|
ed
|
||||||
rmcup
|
rmcup
|
||||||
!
|
!
|
||||||
exit 0
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -287,45 +350,71 @@ else
|
|||||||
!
|
!
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
if ((rep > 0))
|
|
||||||
|
if ((${#acsc[@]} > 0 && rep > 0))
|
||||||
then
|
then
|
||||||
|
typeset -i cx=20
|
||||||
echo Testing rep capability of TERM=$TERM
|
echo Testing rep capability of TERM=$TERM
|
||||||
let line++
|
let line++
|
||||||
let row=height/2-4
|
let row=height/2-4
|
||||||
let col=8
|
let col=8
|
||||||
|
if ((color > 0))
|
||||||
|
then
|
||||||
|
tput -S <<-!
|
||||||
|
setab 7
|
||||||
|
setaf 0
|
||||||
|
!
|
||||||
|
fi
|
||||||
tput -S <<-!
|
tput -S <<-!
|
||||||
civis
|
|
||||||
enacs
|
enacs
|
||||||
smacs
|
smacs
|
||||||
bold
|
|
||||||
cup $row $col
|
cup $row $col
|
||||||
rep ${acsc[0x6c]} 0
|
!
|
||||||
rep ${acsc[0x71]} 20
|
echo -ne ${acsn[0x6c]}
|
||||||
rep ${acsc[0x6b]} 0
|
tput rep ${acsc[0x71]} $cx
|
||||||
cup $((row+1)) $col
|
echo -ne ${acsn[0x6b]}
|
||||||
rep ${acsc[0x78]} 0
|
for ((c=1;c<4;c++))
|
||||||
hpa $((col+21))
|
do
|
||||||
rep ${acsc[0x78]} 0
|
tput cup $((row+c)) $col
|
||||||
cup $((row+2)) $col
|
echo -ne ${acsn[0x78]}
|
||||||
rep ${acsc[0x78]} 0
|
tput hpa $((col+cx+1))
|
||||||
hpa $((col+21))
|
echo -ne ${acsn[0x78]}
|
||||||
rep ${acsc[0x78]} 0
|
done
|
||||||
cup $((row+3)) $col
|
tput cup $((row+c)) $col
|
||||||
rep ${acsc[0x78]} 0
|
echo -ne ${acsn[0x6d]}
|
||||||
hpa $((col+21))
|
tput rep ${acsc[0x71]} $cx
|
||||||
rep ${acsc[0x78]} 0
|
echo -ne ${acsn[0x6a]}
|
||||||
cup $((row+4)) $col
|
tput -S <<-!
|
||||||
rep ${acsc[0x6d]} 0
|
|
||||||
rep ${acsc[0x71]} 20
|
|
||||||
rep ${acsc[0x6a]} 0
|
|
||||||
sgr0
|
|
||||||
rmacs
|
rmacs
|
||||||
!
|
!
|
||||||
if ((color > 0))
|
if ((color > 0))
|
||||||
then
|
then
|
||||||
tput setab 4
|
tput -S <<-!
|
||||||
tput setaf 7
|
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
|
fi
|
||||||
|
tput cup $((row+2)) $((col+4))
|
||||||
|
echo -n "<ACS BOX (REP)>"
|
||||||
|
|
||||||
tput cup $line 0
|
tput cup $line 0
|
||||||
tput cvvis
|
tput cvvis
|
||||||
echo -n "OK> "
|
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>
|
Mon Mar 22 15:39:19 UTC 2021 - Dr. Werner Fink <werner@suse.de>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user