Termcaps

Ben Cranston zben at umd5
Wed Dec 17 08:39:06 AEST 1986


> ...now that I have a termcap for my <x>, how do I get Unix (csh) to use it?

I have a load of different virtual terminal programs and several different
real terminals, so I not only have a bunch of nonstandard termcaps but I 
need to be able to easily switch them on the fly (as I physically move the
serial line plug from machine to machine).  Furthermore I use several Unix
machines, maintained by different (read non-cooperative) campus entities,
and so can never get them all to agree on a standard termcap nameset.  So
I ended up with this setup:

1. In .cshrc this alias is setup:

alias term 'setenv OLDTERM $TERM; setenv TERM \!*; source ~zben/bin/term'

2. The file "~zben/bin/term" contains this "source" script:

#! /no/shell/execution
# Do NOT execute me as a shell script.  
# I am designed to be called from the alias:
# alias term 'setenv OLDTERM $TERM; setenv TERM \!*; source me'
#
setenv TERMCAP ~zben/bin/termcaps
set noglob
set mert=(`tset -Q -S`)
setenv TERM $mert[1]
setenv TERMCAP "$mert[2]"
echo Terminal type is now $TERM \(was $OLDTERM\)
unset mert
unset noglob
unsetenv OLDTERM

3. The file "~zben/bin/termcaps" contains my own private termcaps.  Most
   are snarfed from the system termcap file, but *I* get to determine the
   names and any other spot changes needed.  I keep this stuff constant
   across the various Unix systems via "rdist".

At any time I can type:

% term <xxx>
Terminal type is now <xxx> (was <yyy>)

For those who are taking this verbatim, change the "zben" in the above to
your own userid...  Note the stuff has to be "source"d into the shell, it
cannot be done with a shell script because the changes to the environment
will not be properly propagated upward.

I also use baud rate to determine the initial terminal type, but techniques
for doing this are common knowledge...
-- 
                    umd5.UUCP    <= {seismo!mimsy,ihnp4!rlgvax}!cvl!umd5!zben
Ben Cranston zben @ umd2.UMD.EDU    Kingdom of Merryland UniSys 1100/92
                    umd2.BITNET     "via HASP with RSCS"



More information about the Comp.unix.questions mailing list