Terminal Setting

Anthony "Tkil" Foiani afoiani at nmsu.edu
Sat Jan 26 01:46:08 AEST 1991


I've tried tset, and it is occasionally useful; unfortunately, with
the rather large mix of machines I'm on every day, I ended up creating
my own.  What I do is in my .login:
---------------------------------------------------------------------------
if (-e ~/.logged) then
  if (! ${?ISLOGGED}) setenv ISLOGGED 0
  set k=`cat .logged`
else
  setenv ISLOGGED 1
  set j=`tty | awk '{print substr($1,6,length($1)-5)}'`
  switch ($j)
    case console:
      set k="sun"
      breaksw
    default:
      set k=`who | egrep $j | awk '{ print substr($6,2,length($6)-2)}'`
      set k=`grep $k ~/.terms | awk '{print $1}'`
      if ( $k == "" ) set k="vt100"
  endsw
  echo $k > ~/.logged
endif
set term=$k
tset
---------------------------------------------------------------------------

.logged is created the first time I log onto a particular filesystem
[Hi, NFS!], and keeps the terminal type to facilitate rlogins and
such.  ISLOGGED tracks whether this is the first login to a particular
filesystem. 

If this session is the first one, 'j' holds the name of my tty, and
checks if it is console - in which case, it is a sun console.  If I'm
not from a console, find out (1) where I'm logged in from, (2) look
through my .terms file for the type of terminal I'm on, and (3) if it
is empty, it will default to vt100.

.terms file looks like:
---------------------------------------------------------------------------
tvi925 crlbridge1 csbridge1 csbridge2 csbridge3 csbridge4 cebridge1 cebridge2 job_bridge_1 cs-annex
vt100 ccbridge1 ccbridge2 ccbridge3 ccbridge4 ccbridge5 ccbridge6 mathbridge1 cc_annex mac_vturner enterprise huey dewey
sun avanti wilma console 
xterm hobbes calvin
---------------------------------------------------------------------------

After it is all said and done, $k is the terminal type.

An acquaintance has recently changed to the minimalist approach - just
log in, set the type himself, and then rlogin or rsh to propagate the
type.  It works nicely, but I'm too lazy to do that sort of thing. :)

Cheers,
Tony
--
Tony Foiani  a.k.a. Tkil  (afoiani at nmsu.edu) or (mcsajf at nmsuvm1.bitnet)
Supporting:  Unix / DOS / VMS / Macintosh / "What's this?"
   ObQuote: "Lucretia, my reflection, dance the ghost with me..."
                                                      - Sisters Of Mercy



More information about the Comp.unix.programmer mailing list