[comp.unix.questions] using set term in the .login file

sale5312@fredonia.UUCP (Marty Saletta) (10/10/88)

   Sorry if this seems a little easy for the expirenced users here,but I'd
 like to know how to use set term from the .login file.  Let me explain
 just a little further:I use the Vax here at my college two places:at the
 computer lab,and at home.  I'd like to be able to have the Vax 
 recognize that I'm calling from home and automatically set the term to
 VT52.  Specifically,I'd like a line something like this in my .login file:

   if (using ttyd1 or using ttyd2) then set term=vt52

   I need the proper syntax,and I haven't been able to find too many examples.
 Much thanks in advance!


-- 
 /    /  |\ |  /    / |  /   :   Marty Saletta @ Fredonia,NY----------
/ __ /__ | \| /__  /  | /    :   Atari ST,New York Yankees,bloody Who,
\  / \   |  | \    \  | \    :   Toronto Maple Leafs,Pink Floyd,Fripp,
 \/   \  |  |  \   /  | /    :   ELP,Yes,CZ-1,Mad Max,and hi Lorie!!!

mbennett@midas.UUCP (Mike Bennett) (10/11/88)

in article <1139@fredonia.UUCP>, sale5312@fredonia.UUCP (Marty Saletta) says:
>                             I'd like to be able to have the Vax 
>  recognize that I'm calling from home and automatically set the term to
>  VT52.  Specifically,I'd like a line something like this in my .login file:
> 
>    if (using ttyd1 or using ttyd2) then set term=vt52
> 

I assume that your Vax only has two dial-up lines and they are ttyd1
and ttyd2. If there are more, just add them to the list. This should work:

	     tty | grep "ttyd[12]" >/dev/null
	     if ( $status == 0 ) then
		set term=vt52
	     else
		set term=(term type at school)
	     endif

Mike Bennett
Languages Development
Gould Computer Systems Division, Ft. Lauderdale, Florida
.....!{uunet,sun,pur-ee,brl-smoke}!gould!mbennett
I am paid to work and to think for my employer - so I do.
I am NOT paid to speak for my employer - so I don't.

barnett@vdsvax.steinmetz.ge.com (Bruce G. Barnett) (10/12/88)

In article <1341@midas.UUCP>, mbennett@midas (Mike Bennett) writes:
>	     tty | grep "ttyd[12]" >/dev/null
>	     if ( $status == 0 ) then
>		set term=vt52
>	     else
>		set term=(term type at school)
>	     endif
>

If you want to automatically set up your terminal, and if you have tset,
then use the information that should be available. There are two
pieces of information that can be used. The baud rate and the terminal type
associated with that port. If the terminal type is wrong, get the 
system mangler to fix it.

Let's assume the terminal type on the prt is 'network', and your baud
rate is 2400 at home, and greater than 2400 at work.

Try this in your .login file:
----------
set noglob
eval `tset -Q -s -m 'network@2400:?vt52' -m 'network>2400:?vt100' $term`
unset noglob

Also, when you rlogin, the terminal type is correct. Don't change it.
-- 

matt@iquery.UUCP (Matt Reedy) (10/13/88)

In article <1139@fredonia.UUCP>, sale5312@fredonia.UUCP (Marty Saletta) writes:
> 
>    if (using ttyd1 or using ttyd2) then set term=vt52
> 
Here's what we have in our /etc/profile for logging in either through a hard-
wired terminal, or over our Starlan network:

T=`tty`
# check for login over network (tty is slannn)
if echo `basename $T` | grep slan >/dev/null
then
	TERM=pc
else
	TERM=wyse50
fi
export TERM


matt

-- 
Matthew Reedy                 UUCP: {harvard!adelie,gatech!petro}!iquery!matt
Programmed Intelligence Corp. "Lots of people without brains do alot of talking"
400 N Loop 1604 E, Suite 330  Scarecrow - "Wizard of Oz"
San Antonio, TX  78232        (512) 490 6684

maart@cs.vu.nl (Maarten Litmaath) (10/18/88)

In article <140@iquery.UUCP> matt@iquery.UUCP (Matt Reedy) writes:
\T=`tty`
\# check for login over network (tty is slannn)
\if echo `basename $T` | grep slan >/dev/null

if basename `tty` | grep slan > /dev/null
-- 
Hippic sport:                         |Maarten Litmaath @ Free U Amsterdam:
             a contradiction in terms.|maart@cs.vu.nl, mcvax!botter!maart

jpd@usl-pc.usl.edu (DugalJP) (10/25/88)

tset is fine when each port has a known terminal type connected to it.
The file (in BSD4.2) /etc/ttytype gives the correspendence, which tset
can test.  However, at USL we have a network that randomly picks a port
such that we don't know in advance which terminal type is going to be
used.  We use a modified form of the qterm program to ask the terminal
what is its type, and resort to tset of the terminal doesn't respond.
So here's what our .login file looks like:
...
# If $term is different from the defaults in /etc/ttytype, use it:
# Also handle any special cases.
switch ($term)
case pcvt:
	if (${HOST} == usl) then
		set term=`tset - vt102`
	else
		tset
	endif
	breaksw
case network:
case switch:
case ouinet:
case unknown:
	set term=`/usr/local/bin/qterm -q`
	if ($term == dumb) then
		set term=`tset - -m 'network:?nansipc' -m 'switch:?pcvt' '?pcvt' -Q`
	else
		setenv TERM $term
		tset
	endif
	breaksw

default:
	tset; breaksw
endsw

------------------------------------------
Hope this helps!
-- James

-- 
-- James Dugal,	N5KNX		USENET: ...!{dalsqnt,killer}!usl!jpd
Associate Director		Internet: jpd@usl.edu
Computing Center		US Mail: PO Box 42770  Lafayette, LA  70504
University of Southwestern LA.	Tel. 318-231-6417	U.S.A.

chris@mimsy.UUCP (Chris Torek) (10/27/88)

In article <76@usl-pc.usl.edu> jpd@usl-pc.usl.edu (DugalJP) writes:
>tset is fine when each port has a known terminal type connected to it.
>The file (in BSD4.2) /etc/ttytype gives the correspendence, which tset
>can test.  However, at USL we have a network that randomly picks a port
>such that we don't know in advance which terminal type is going to be
>used. ...

This is one reason we bought Annex terminal servers rather than (eg)
Bridge boxes:  Annexes support the rlogin protocol, and that protocol
allows the terminal type to be passed in.  The Annex boxes can be
configured to pass a particular terminal type by default.  Thus, the
information that was once in /etc/ttytype for direct lines is now in
configuration files for the Annexes serving our building.

They really are nice boxes, and the 4.0 software fixes the output flush
bug that has plagued Emacs users since 4.2BSD.

Disclaimer: I own Annex along with all of Massachusettes.  (Boy will
they be surprised!)  :-)  :-)
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163)
Domain:	chris@mimsy.umd.edu	Path:	uunet!mimsy!chris

dan@maccs.McMaster.CA (Dan Trottier) (10/27/88)

In article <14180@mimsy.UUCP> chris@mimsy.UUCP (Chris Torek) writes:
>In article <76@usl-pc.usl.edu> jpd@usl-pc.usl.edu (DugalJP) writes:
>>tset is fine when each port has a known terminal type connected to it.
>>The file (in BSD4.2) /etc/ttytype gives the correspendence, which tset
>>can test.  However, at USL we have a network that randomly picks a port
>>such that we don't know in advance which terminal type is going to be
>>used. ...
>
>This is one reason we bought Annex terminal servers rather than (eg)
>Bridge boxes:  Annexes support the rlogin protocol, and that protocol
>allows the terminal type to be passed in.  The Annex boxes can be
>configured to pass a particular terminal type by default.  Thus, the
>information that was once in /etc/ttytype for direct lines is now in
>configuration files for the Annexes serving our building.

This still doesn't really solve the problem. Being a university there
is no way we can tell what terminals people will be using. To solve the
problem we prompt at login for the terminal type. To make life easier
the terminal type is saved in a file and is displayed as the default the
next time the user logs in. Once a user becomes familiar enough with the
system they usually add a tset command at the beginning of their .login
file that sets the proper terminal type. If the term variable is set to
a known terminal type then the user is not prompted.

Do your Annex boxes also provide rudementary name service? We have a
Develcon box that works quite well but it doesn't name serve.

-- 
Dan Trottier                                            dan@maccs.McMaster.CA
Dept of Computer Science                       ...!uunet!utai!utgpu!maccs!dan
McMaster University                                      (416) 525-9140 x3444

chris@mimsy.UUCP (Chris Torek) (10/29/88)

>In article <14180@mimsy.UUCP> I noted that
>>[Annex terminal servers] support the rlogin protocol, and that protocol
>>allows the terminal type to be passed in.  The Annex boxes can be
>>configured to pass a particular terminal type by default.  Thus, the
>>information that was once in /etc/ttytype for direct lines is now in
>>configuration files for the Annexes serving our building.

In article <1542@maccs.McMaster.CA> dan@maccs.McMaster.CA (Dan Trottier)
writes:
>This still doesn't really solve the problem. Being a university there
>is no way we can tell what terminals people will be using.

For dialups, no; but for lines in offices?  You would not bring in a
different terminal each week; the wires running to the terminal server
are attached to only one terminal, and that terminal has a type.  The
type field needs changing only when the terminal attached to that port
of that server is changed.

At any rate:
>Do your Annex boxes also provide rudementary name service? We have a
>Develcon box that works quite well but it doesn't name serve.

The Annexes will use either IEN116 name service or BIND/named.  IEN116
is outdated and is provided mainly for backward compatibility; Encore
includes an IEN116 server that simply does a gethostbyname(), in case you
are still using host tables (or---blech---yp before named).
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163)
Domain:	chris@mimsy.umd.edu	Path:	uunet!mimsy!chris