Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!mnetor!seismo!mimsy!cvl!umd5!zben
From: zben@umd5 (Ben Cranston)
Newsgroups: comp.unix.questions
Subject: Re: Termcaps
Message-ID: <1393@umd5>
Date: Tue, 16-Dec-86 17:39:06 EST
Article-I.D.: umd5.1393
Posted: Tue Dec 16 17:39:06 1986
Date-Received: Wed, 17-Dec-86 19:27:11 EST
References: <410@puff.WISC.EDU>
Reply-To: zben@umd5.umd.edu (Ben Cranston)
Organization: University of Maryland, College Park
Lines: 52
Summary: one technique for private termcaps

> ...now that I have a termcap for my , 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 
Terminal type is now  (was )

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"