[comp.unix.questions] Private termcap entries

dan@charyb.COM (Dan Mick) (12/10/89)

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,
or point me at the right FM page?  (Haven't been able to find it in
our online pages, at least...)



-- 
.sig files are idiotic and wasteful.

smaug@eng.umd.edu (Kurt Lidl) (12/10/89)

In article <340@charyb.COM> dan@charyb.UUCP (Dan Mick) writes:
>Is there a way to get extra, customized termcap entries without adding
>to the system-wide termcap file?

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...

--
/* Kurt J. Lidl (smaug@eng.umd.edu) | X Windows: Power Tools */
/* UUCP: uunet!eng.umd.edu!smaug    | for Power Fools        */

khera@macbeth.cs.duke.edu (Vick Khera) (12/10/89)

In article <340@charyb.COM> dan@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,
>or point me at the right FM page?  (Haven't been able to find it in
>our online pages, at least...)

it works for me... at leat under SunOS 4.x and above.  you must also be
sure to set the TERMCAP variable as an absolute path (starting with "/").

i worked around it under SunOS 3.x by just assigning the entire termcap
entry to the TERMCAP variable.

							v.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Vick Khera                              Department of Computer Science
ARPA:   khera@cs.duke.edu               Duke University
UUCP:   ..!{mcnc,decvax}!duke!khera     Durham, NC 27706

jdpeek@rodan.acs.syr.edu (Jerry Peek) (12/11/89)

In article <340@charyb.COM> dan@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@eng.umd.edu> smaug@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@rodan.acs.syr.edu, JDPEEK@SUNRISE.BITNET        +1 315 443-3995