Private termcap entries

Jerry Peek jdpeek at rodan.acs.syr.edu
Mon Dec 11 03:37:38 AEST 1989


In article <340 at charyb.COM> dan at charyb.UUCP (Dan Mick) writes:
> Is there a way to get extra, customized termcap entries without adding
> to the system-wide termcap file?  I've heard tell of putting a filename
> in the TERMCAP environment variable, but I've never been able to get it
> to work under SunOS.  Can someone describe how this is supposed to work,

In article <1989Dec10.025418.12733 at eng.umd.edu> smaug at eng.umd.edu (Kurt Lidl) writes:
> setenv TERMCAP ~username/termcap;set term=termname;tset
> 
> This works for me, with the correct values for username and termname,
> obviously.  Under SunOS 4.01, 4.03 4.03c...

This is great -- if only a few users do it.  But the standard termcap file is 
big (on systems I've seen, at least) -- and if lots of users make their
own copies, the disk fills up with a lot of mostly unused termcap data, just
so users can add their private termcaps.

Here's the answer I've come up with:

	- A directory called $HOME/.termcaps that has individual termcap
	  definition files in it.  For example, a file named "vt200"
	  has a vt200 termcap, nothing else.

	- Code in my .profile file (I use ksh) that runs a shell function
	  named "newterm" (see below).

	- A function named "newterm" that prompts the user for a
	  terminal type and reads the answer, like "tset ?" does:
		TERM = (vt100) mytty

	  Next, it checks to see if there's a termcap file in the
	  $HOME/.termcaps directory.  If there is, it does:
		TERM=mytty; TERMCAP=$HOME/.termcaps/mytty
		export TERM TERMCAP
		eval `tset -Qs "mytty"`

	  Otherwise, it uses the default /etc/termcap by running:
		TERMCAP=/etc/termcap   # RESET TO DEFAULT
		eval `tset -Qs "mytty"`

In C-shell, the "newterm" shell function could be replaced with a file that
you "source".  Maybe:
	alias newterm source ~/csh/newterm
It's nice to keep this code in a separate function or file, instead of
embedding it in .profile or .login, because it lets you change terminal
types after you're already logged in -- in case you made a mistake or
change your mind.

--Jerry Peek; Syracuse University Academic Computing Services; Syracuse, NY
  jdpeek at rodan.acs.syr.edu, JDPEEK at SUNRISE.BITNET        +1 315 443-3995



More information about the Comp.unix.questions mailing list