[net.sources] AT&T 3b2 DMD 5620 terminfo fix

parmelee@bullwinkle.cs.cornell.edu (Larry Parmelee) (05/16/86)

Having just set up my AT&T 3b2, what do I find, but the terminfo
entry for the DMD 5620 display that came with it is brain damaged:
Once you print a line in standout mode, or underlined, you're
stuck with it.  Normal mode is not restored properly.

So as to do my part to save the world, here are two things:

1) A fixed dmd terminfo entry, and 
2) A little shell script I'm going to call "tock" (Its the inverse
   of "tic", the TermInfo Compiler).
   
Sorry, this is not in shar format: You wouldn't trust it anyway
would you?

No warranties expressed or implied about anything at all.
	-Larry Parmelee
	parmelee@systems.cs.cornell.edu


The fixed DMD terminfo definition is called dmd.src.  To install,
copy this file to your 3b2, and strip out the extraneous verbage.
As root on your 3b2, give the commands:
	unset TERMINFO
	tic dmd.src
This compiles and installs the new info in the database, replacing
the old.  The 'unset' insures that the standard library in its
standard place is updated.

>>>>>>>> Start of file "dmd.src" <<<<<<<  --- Cut Here ---
dmd|5620|teletype dmd 5620,
 am, cols#88, it#8, lines#70, bel=\007, cr=\r, clear=\E[H\E[J,
 el=\E[K, ed=\E[J, cup=\E[%i%p1%d;%p2%dH, cud1=\n, home=\E[H,
 cub1=\b, cuf1=\E[C, cuu1=\E[A, dch1=\E[P, dl1=\E[M, smir=\E6,
 smso=\E[7m, smul=\E[4m, rmir=\E6,
 .rmso=\E[m, rmso=\E[0m, .rmul=\E[m, rmul=\E[0m,
 ich1=\E[@, il1=\E[L, kbs=\b, kclr=\E[2J, kcud1=\E[B, khome=\E[H,
 kcub1=\E[D, kll=\E[70;1H, kcuf1=\E[C, kcuu1=\E[A, dch=\E[%p1%dP,
 dl=\E[%p1%dM, ich=\E[%p1%d@, indn=\E[%p1%dS, il=\E[%p1%dL,
 rin=\E[%p1%dT, pfx=\E[%p1%d;%p2%l%dq%p2%s, rs1=\Ec,
 rc=\E8, sc=\E7, ind=\n, ri=\E[T, ht=\t
>>>>>>>> End of file "dmd.src" <<<<<<<  --- Cut Here ---


Here is the shell script "tock", a program which un-compiles
a compiled terminfo database entry.  Be Warned:  tock has not been
extensively tested; But it worked well enough to let me fix the dmd 
problem!  You shouldn't assume any sort of portability.  This is
only known to work on my AT&T 3b2 with some version of system V un*x.
	-Larry
	
>>>>>>>> Start of file "tock" <<<<<<<  --- Cut Here ---
: 'Bourne shell  tock-  Uncompile terminfo entry compiled with tic.'
# Does about a 90% job.  Its slow, it can't figure out padding specs or
# terminal names/aliases other than the one its given.  If run in a window
# or layers environment, the lines and cols reflects the size of the current
# window rather than the maximum limits.   Oh Well...
# LCP 10-May-86 3b2 Sys.V
#
type=${1:-${TERM:-bOgUs}}
if test "X$type" = "XbOgUs"
then
	echo 'No terminal type specified, no $TERM defined.'
	exit 1
fi
tput -T$type bw > /dev/null 2>&1
stat=$?
if test "$stat" != "0" -a "$stat" != "1"
then
	echo 'Info for '$type' not found in terminfo database.'
	exit 2
fi
echo $type,
# Booleans
for c in bw am xsb xhp xenl eo gn hc km hs in da db mir msgr os eslok xt hz ul xon
do
	if tput -T$type $c >/dev/null
	then
		echo " $c,"
	fi
done

# Numerics
for c in cols it lines lm xmc pb vt wsl
do
	result=`tput -T$type $c`
	if test "$result" -ge '0'
	then
		echo " $c#$result,"
	fi
done

# Strings
cap0="cbt bel cr csr tbc clear el ed hpa cmdch cup cud1 home civis cub1 mrcup"
cap1="cnorm cuf1 ll cuu1 cvvis dch1 dl1 dsl hd smacs blink bold smcup smdc"
cap2="dim smir prot rev invis smso smul ech rmacs sgr0 rmcup rmdc rmir rmso rmul"
cap3="flash ff fsl is1 is2 is3 if ich1 il1 ip kbs ktbc kclr kctab kdch1 kdl1 kcud1"
cap4="krmir kel ked kf0 kf1 kf10 kf2 kf3 kf4 kf5 kf6 kf7 kf8 kf9 khome kich1"
cap5="kil1 kcub1 kll knp kpp kcuf1 kind kri khts kcuu1 rmkx smkx lf0 lf1 lf10"
cap6="lf2 lf3 lf4 lf5 lf6 lf7 lf8 lf9 smm rmm nel pad dch dl cud ich indn il"
cap7="cub cuf rin cuu pfkey pfloc pfx mc0 mc4 mc5 rep rs1 rs2 rs3 rf rc vpa"
cap8="sc ind ri sgr hts wind ht tsl uc hu iprog ka1 ka3 kb2 kc1 kc3 mc5p"

for part in cap0 cap1 cap2 cap3 cap4 cap5 cap6 cap7 cap8
do
    cmd='list="$'$part'"'
    eval "$cmd"

    for c in $list
    do
	if test `tput -T$type $c | wc -c` -ne "0"
	then
	    echo " $c=\c"
	    tput -T$type $c | od -c | ( tr '\012' ' ' ; echo ) | \
		sed -e 's/[0-9]\{4,\}//g' \
		-e 's/033/\\E/g' -e 's/\([0-9]\{3\}\)/\\\1/g' \
		-e 's/\([,:^]\)/\\\1/g' \
		-e 's/ //g' -e 's/\\0$//' -e 's/$/,/'
	fi
    done
done
exit
>>>>>>>> End of file "tock" <<<<<<<  --- Cut Here ---