[net.unix-wizards] more startup time

hogue@hsi.UUCP (01/27/84)

Bill is correct as to setting the TERMCAP enviorment varible in 4.1.
In 4.2 change the tset line to:

	tset -Q -s -m :'?cit101e' >/tmp/tset$$
	source /tmp/tset$$
	rm -f /tmp/tset$$

Put this in your .login and when you login you will get a prompt of the form:
TERM = (cit101e)
You can reply with a terminal type or a <cr>.  The latter will get you the
default type - ie cit101e in the above example.

					Jim Hogue
					{kpno,ihnp4}!hsi!hogue
-- 
	Jim Hogue, Health Systems International, New Haven, CT
		{kpno, ihnp4}!hsi!hogue

smoot@ut-sally.UUCP (Smoot Carl-Mitchell) (01/27/84)

You can also do what we did and set the TERMCAP environment variable
with tset.  Then startup delays by searching the termcap database
are eliminated.
-- 
Smoot Carl-Mitchell, CS Dept. University of Texas at Austin
{seismo, ctvax, ihnp4, kpno}!ut-sally!smoot, smoot@ut-sally.{ARPA, UUCP}

guy@rlgvax.UUCP (Guy Harris) (01/28/84)

> It takes TIME to wade through all those definitions for all those
> weird terminals that nobody uses.  An 'optimization' would be to
> move all the termcap entries for your common terminals to the
> front of the file.  More (and vi) should then startup noticeably faster.

The "termcap" source directory on 4.xBSD contains a "reorder" script which
does exactly this; the details are explained in a READ_ME file in that
directory.

	Guy Harris
	{seismo,ihnp4,allegra}!rlgvax!guy

sylvan@boulder.UUCP (Sylvan Ruud) (01/29/84)

The solution that we have used here is a simple one-liner, that does not
need any temporary files:

set noglob;eval `tset -s -Q -m :?h19`;unset noglob

{ucbvax!hplabs | allegra!nbires | decvax!kpno | harpo!seismo | ihnp4!kpno}

			!hao!boulder!sylvan

leres%lbl-csam@sri-unix.UUCP (01/30/84)

From:  Craig Leres <leres@lbl-csam>

Here's an alternate way to set up the TERMCAP environment variable which
avoids the use of a temporary file:

    set noglob _t=`tset -QS -m dialup:?h19 -m network:$TERM`
    if ($TERM == network) set _t=`tset -QS ?h19`
    setenv TERM $_t[1]
    setenv TERMCAP $_t[2]
    unset noglob _t

It also contains a clever hack that trys to make use of the terminal
type that gets passed when you rlogin.

		Craig

cak@Purdue.ARPA (01/30/84)

From:  Christopher A Kent <cak@Purdue.ARPA>

Oh my. This is getting out of hand. Here's what I do:

switch(`tty`)
	case '/dev/ttyp*':
		set saveterm = $TERM
		echo -n Term = \($TERM\)
		set term = $<
		if ( $term == '' ) then
			set term = $saveterm
			breaksw
		endif
		if ( $term == 'emacs' ) then
			stty -echo litout
			set term = 'su'
		endif
		setenv TERM $term
		unsetenv TERMCAP
		# no tset here, to avoid setting funny modes and delays across
		# the network, where it would just be annoying.
		breaksw

	default:
		set nonomatch
		eval `tset -s -Q -m "micom:?regent40" -m "unknown:?regent40" -m "network:?vt132" -m "switcher:?regent40" -m "dialup:?dm2500"`
endsw

Not only does this contain a hack to handle rlogin, it even has a hack
to handle rlogin inside an emacs window. I wish we didn't have to do
any of this.

Jay Lepreau has submitted a bug fix to Berkeley that causes tset to
look in the TERM variable and use that if you're on a terminal that
/etc/ttytypesay is "network" -- this way "naive" users don't have to
worry about all this crap, things just work the way they are supposed
to. As I recall, the fix is a couple of lines.

Cheers,
Chris "My .login and .cshrc are too big as it is" Kent
----------

ron%brl-vgr@sri-unix.UUCP (01/31/84)

From:      Ron Natalie <ron@brl-vgr>

And and an even faster thing that a user can do without even bothering
his system administrators is that when he logs in he can pull the appropriate
termcap entry out for his terminal and stick it in the "TERMCAP" shell
variable.  Makes many things much faster.  I don't know where this trick
originated, but I saw it on one of the BBN hosts.

-Ron

phil@sequent.UUCP (02/02/84)

<eat flaming death...>

In reference to:
> The solution that we have used here is a simple one-liner, that does not
> need any temporary files:
> 
> set noglob;eval `tset -s -Q -m :?h19`;unset noglob

If you spy on the output of tset you will notice it is terminated with:
``<tset output>...; unset noglob''

So your ``;unset noglob'' is redundant.  On the other hand, why doesn't
tset just generate the ``set noglob'' too?
-- 

	Phil Hochstetler
	Sequent Computer Systems
	...!sequent!phil

gnu@sun.uucp (John Gilmore) (02/03/84)

If you use tset to set the TERMCAP environment variable to the termcap
entry for your terminal, no program will ever have to read a file to get it.
This speeds up more, vi, emacs, etc quite a bit.  Look in tset(1) for 
the "-s" option.  I don't know if this works on Bell Unixes.

phil%rice@sri-unix.UUCP (02/04/84)

From:  William LeFebvre <phil@rice>

Of course, if termcap were implemented as some sort of database (the
only intelligent way to do it), that (position of terminal description
in termcap) would not be a problem.

                                William LeFebvre
                                <phil@rice>

guy@rlgvax.UUCP (Guy Harris) (02/06/84)

> If you use tset to set the TERMCAP environment variable to the termcap
> entry for your terminal, no program will ever have to read a file to get it.
> This speeds up more, vi, emacs, etc quite a bit.  Look in tset(1) for
> the "-s" option.  I don't know if this works on Bell Unixes.

"tset" doesn't exist on vanilla Bell UNIXes, but the "termcap" supplied with
System V is the same "termcap" that comes with Berkeley systems, so you
can set TERMCAP.  Using "tset", if available, is preferable to getting a
copy of "/etc/termcap" and pulling the entry out of there, because if the
entry in "/etc/termcap" changes you want your entry to reflect it.

	Guy Harris
	{seismo,ihnp4,allegra}!rlgvax!guy

thomas@utah-gr.UUCP (Spencer W. Thomas) (02/06/84)

Actually, the "unset noglob" after the tset command is NOT irrelevant,
because without it you can be left in "noglob" state if the string
generated by the tset fails to execute properly (like your shell
variable is set to /bin/sh).  The "set noglob" command cannot be issued
by tset because it will not be interpreted until the tset output has
already been "globbed".  By then it is too late, so, you need to put it in
as a separate command.

=Spencer

rpw3@fortune.UUCP (02/08/84)

#R:ut-ngp:-24400:fortune:11600061:000:669
fortune!rpw3    Feb  7 20:29:00 1984

Spencer, the "set noglob" would NOT be too late (at least on our fairly
stock 4.1bsd). In fact, the "tset" we run has the "set noglob" in it.
See below (TERMCAP shortened for posting):

	% echo *
	bin doc etc file foo mail memo misc proj src tmp uucp
	% set noglob ; echo * ; unset noglob
	*
	% tset -Q -s
	set noglob;
	setenv TERM fos ;
	setenv TERMCAP 'FT|fos|fortune:<...shortened...>:TB=\r:CN=\177:MP=\E+F';
	unset noglob;
	%

(And it's not because "echo" is a builtin; I checked it with "ls".)

Rob Warnock

UUCP:	{sri-unix,amd70,hpda,harpo,ihnp4,allegra}!fortune!rpw3
DDD:	(415)595-8444
USPS:	Fortune Systems Corp, 101 Twin Dolphins Drive, Redwood City, CA 94065

thomas@utah-gr.UUCP (Spencer W. Thomas) (02/10/84)

Well, Rob Warnock poked my curiousity button.  Why does it work for him
and not for me?  I didn't just randomly stick an extra 'set noglob' in
front of my 'eval `tset -s`' for paranoia, I put it there because a tset
failed on me without it.  SO, I did some experimentation.  We are
running 4.2 csh, but this did the same in 4.1, as far as I know.  Try
the following experiment:
	% unset noglob
	% echo `echo "'['"`
Notice how you get NOTHING echoed?  Now, try
	% set noglob
	% echo `echo "'['"`
	% unset noglob
Worked this time, didn't it?  Now, try
	% eval `echo echo "'['"`
Still get nothing (as expected from case 1 above).  But
	% eval `echo set noglob \; echo "'['"`
doesn't either (but does leave noglob set!  If you say !!, you'll get
the right output).  Now, the problem with tset is that some (any ANSI)
terminals have lots of [s in their termcap entry.  The string spit out
by tset looks like (ignoring unimportant stuff)
	set noglob ; setenv TERMCAP 'lots of stuff'; unset noglob
With the 'lots of stuff' disappearing because of the [ bug (and the
semicolon going with it!) the setenv command is
	setenv TERMCAP unset noglob
which fails (too many arguments).  Thus, not only is your TERMCAP not
set, but your shell is left in noglob state.  Not good.  Moral is until
the bug is fixed, put that unset noglob in.  You never know when you'll
be on a VT100 :-(.

=Spencer

rpw3@fortune.UUCP (02/14/84)

#R:ut-ngp:-24400:fortune:11600066:000:780
fortune!rpw3    Feb 13 21:27:00 1984

(**blush**) I would go shoot my mouth off, Spencer; look at what I said
in my note:

+--------------------
| % tset -Q -s
| set noglob;
| setenv TERM fos ;
| setenv TERMCAP 'FT|fos|fortune:<...shortened...>:TB=\r:CN=\177:MP=\E+F';
| unset noglob;
| %
+--------------------

Notice that I ran the 'tset' straight from the Cshell, NOT from within
the backquotes. So csh never saw the garbage that I "shortened"
to "make it fit the posting neatly". When I REALLY tried it,  with a
"echo `tset -Q -s`", it broke, just like reported. And, yes, our termcap
has "#" AND "[" AND "*" AND "?" in it.   (Never mind.....)

Rob Warnock

UUCP:	{sri-unix,amd70,hpda,harpo,ihnp4,allegra}!fortune!rpw3
DDD:	(415)595-8444
USPS:	Fortune Systems Corp, 101 Twin Dolphins Drive, Redwood City, CA 94065