How do *you* identify terminals?

Esa K Viitala esa at kvvax4.UUCP
Sun Jan 4 19:59:59 AEST 1970


This is what we do in
.profile:
	# set up for termcap database (temporary)
	TERM=`/usr/etc/termtype`
	export TERM
	tset

.login:
	# set up terminal stuff
	set term=`/usr/etc/termtype`
	tset -Q

and /usr/etc/termtype looks as follows (it's a bit heavy, but)
we've got the LAN difficulties as well. We use
Interactive System's  INed screen editor and have to
set up a profile file for it too. This is recognised by
tty number suffix in the filename, as you will understand from
the listing here:



	#!/bin/sh
	# @(#) termtype.sh 1.4
	# * modified: Wed May 11 00:20:40 GMT+2:00 1983, by torj
	#             To give info about (account)groups.
	# Modified: Jan 17 1984 by torj/D52, to print out accounts right.
	#

	set `/usr/etc/prgroup`
	echo -n "
	Current (account)group : $1
	account: " > /dev/tty
	sed -n "/^$1:/s/.*:\([0-9][0-9-]*\),.*/\1/p" /etc/group > /dev/tty
	echo "
	Valid group(s):" > /dev/tty
		    grep ",$USER" /etc/group | sed "s/:.*//" > /dev/tty
	echo "
	to change group use command 'accgrsw'" > /dev/tty

	tty=`who am i | awk {'print $2'}`
	INlib=/usr/lib/INed

	if test "$tty" = "console"
	then
	   echo "You can't run a display editor from console" >/dev/tty
	   echo "" ; # to clear TERM
	   exit 0
	fi

	while true
	do
	   echo -n >/dev/tty "
	The following terminals are supported:
	  0   other             3x  tdv2230x
	  1   tdv2115           4   intextII
	  1x  tdv2115x          5   nokia210
	  2   tdv2215           6   vt100
	What terminal type do you have? "
	   read term
	   case ${term} in
	   0 | "")
	      term=""
	      break
	      ;;
	   1 | tdv2115 | 2115)
	      term=2115
	      INtype=tdv2115.ied
	      break
	      ;;
	   1x | tdv2115x | 2115x)
	      term=2115
	      INtype=tdv2115x.ied
	      break
	      ;;
	   2 | tdv2215 | 2215)
	      term=2215
	      INtype=tdv2215.ied
	      break
	      ;;
	   3 | tdv2230 | 2230)
	      term=2230
	      INtype=tdv2230.ied
	      break
	      ;;
	   3x | tdv2230x | 2230x)
	      term=2230
	      INtype=tdv2230x.ied
	      break
	      ;;
	   4 | intextII | intextII)
	      term=intext2
	      INtype=profile.it2
	      break
	      ;;
	   5 | nokia | nokia210)
	      term=nokia210
	      INtype=nokia.ied
	      echo "Downloading the INed keyboard layout" >/dev/tty
	      /usr/local/setterm  >/dev/tty </dev/tty
	      break
	      ;;
	   6 | vt100)
	      term=vt100
	      INtype=vt100.ied
	      break
	      ;;
	   esac
	done

	if test "${INtype}"
	then
	   if test -r $INlib/profile.$tty
	   then
	      rm -f $INlib/profile.$tty
	   fi
	   ln $INlib/$INtype $INlib/profile.$tty
	else
	   echo "You can't run a display editor from this terminal" >/dev/tty
	fi
	echo $term

All bright ideas are welcome!!
-- 

   Esa K Viitala  ({decvax,philabs}!mcvax!kvport!kvvax4!esa)
   A/S Kongsberg Vaapenfabrikk, CTG4, P.O.Box 25, N-3601 Kongsberg
   Norway



More information about the Comp.unix.wizards mailing list