naftoli@aecom.UUCP (Robert N. Berlinger) (02/12/85)
Anyone know of a good method to keep TERM information for System V? I know that you can type TERM=xxx when typing your login name, but we have a lot of hardwired terminals, and it would be more convenient to have that terminal types kept in a file and have it be set automatically. -- Robert Berlinger ...{philabs,cucard,pegasus,ihnp4,rocky2}!aecom!naftoli
guy@rlgvax.UUCP (Guy Harris) (02/13/85)
> Anyone know of a good method to keep TERM information for System V? > I know that you can type TERM=xxx when typing your login > name, but we have a lot of hardwired terminals, and it would be > more convenient to have that terminal types kept in a file and > have it be set automatically. Step 1 - rip "login" so that it doesn't destroy the environment it's given, but adds to it. Step 2 - make your "inittab" lines look like: hb::respawn:env TERM=vt100 /etc/getty ttyhb 9600 # Console VT100 which puts "TERM=vt100" into the environment of the "getty" (which, if it wanted to, it could use); it then gets passed to the modified "login", which in turn passes it to the user's login shell. Alternative (this one is really addressed to the USDL) - have a "runtty" command which gets run like /etc/runtty ttyhb <command> which does the following: 1) does a "setpgrp" to have the next terminal opened be the control terminal (one of the least used nice USDL UNIX features - you have to explicitly specify that opening a terminal makes it your control terminal, so daemons can be set up to safely open "/dev/console" and write messages without getting attached to it. Unfortunately "init" does a "setpgrp" on all processes it spawns, which ruins this utterly. Besides, you *really* should be running "syslog" and have it handle error messages...) 2) opens its first argument as stdin, stdout, and stderr 3) looks that up in "/etc/ttytype" (see any 4.xBSD manual for a description) and puts TERM=whatever into the environment 4) runs the command This centralizes that code. Right now, "getty" does that sort of thing itself; however, if you want to run different versions of "getty" (we have a screen-oriented "getty"/"login" which behaves like a component of our office automation system) or something like a special data entry application with its own operator login procedure, you can write the program like a regular program and run it from "runtty". Guy Harris {seismo,ihnp4,allegra}!rlgvax!guy
physics@utcs.UUCP (David Harrison) (02/15/85)
The question: setting TERM for hardwired terminals. Now, we are running an HP9000, not quite Vr2 and not the native OS besides. However, what it does do is run shell scripts faster than anything I am familiar with. So we have a case `tty` in in /etc/profile, and viola. For our dialup port the corresponding case reads: echo "TERM=\c" read TERM So, if your shell goes like our HP, that's the easy way to do it. If your shell scripts are slow, Guy Harris' solution is better.
schnable@ihuxo.UUCP (Andrew T. Schnable) (02/16/85)
> > Anyone know of a good method to keep TERM information for System V? > > I know that you can type TERM=xxx when typing your login > > name, but we have a lot of hardwired terminals, and it would be > > more convenient to have that terminal types kept in a file and > > have it be set automatically. > > Step 1 - rip "login" so that it doesn't destroy the environment it's > given, but adds to it. > > Step 2 - make your "inittab" lines look like: > > hb::respawn:env TERM=vt100 /etc/getty ttyhb 9600 # Console VT100 > ... Or put a test in the .profile if [ `tty` = "/dev/tty??" ] then TERM=5620 # or whatever fi andy ihuxo!schnable
guy@rlgvax.UUCP (Guy Harris) (02/17/85)
> The question: setting TERM for hardwired terminals. > Now, we are running an HP9000, not quite Vr2 and not the native > OS besides. However, what it does do is run shell scripts faster > than anything I am familiar with. So we have a case `tty` in > in /etc/profile, and viola. For our dialup port the corresponding > case reads: echo "TERM=\c" > read TERM One small problem: if pw->pw_shell for a user is not /bin/sh or /bin/rsh, it doesn't read /etc/profile. You can modify /bin/csh to read something like /etc/login instead (pick another name for Sys3, because "login" moved temporarily to "/etc" for the duration of S3). However, this doesn't help if your login shell is, say, /op/programs/shell (our OA system) - it's not anything even remotely resembling a regular command interpreter, so there's no such thing as a profile file for it. If you run several canned applications like that, or worse yet if you run a specialized *login* program on some terminals (which is possible given the way that the S3 and S5 "init" work), it's simply not worth the trouble to modify *every* one of them to set TERM. Better to set it in some centralized place. Guy Harris {seismo,ihnp4,allegra}!rlgvax!guy
john@moncol.UUCP (John Ruschmeyer) (02/18/85)
>> > Anyone know of a good method to keep TERM information for System V? >> > I know that you can type TERM=xxx when typing your login >> > name, but we have a lot of hardwired terminals, and it would be >> > more convenient to have that terminal types kept in a file and >> > have it be set automatically. >> >> Step 1 - rip "login" so that it doesn't destroy the environment it's >> given, but adds to it. >> >> Step 2 - make your "inittab" lines look like: >> >> hb::respawn:env TERM=vt100 /etc/getty ttyhb 9600 # Console VT100 >> ... >Or put a test in the .profile > >if [ `tty` = "/dev/tty??" ] >then > TERM=5620 # or whatever >fi > Forgive me if I'm missing something obvious (we run v7), but why not this: 1) Set up a file with a name like '/etc/ttynames'. It contains lines of the form: tty1 adm3a tty2 5620 . . . 2) Run the following shell script from the .profile a=`tty` b=`basename $a` awk '$1='$b' {print $2}' /etc/ttynames I may be a bit off on the awk invocation, but you should get the idea. This is how we did it here. -- John Ruschmeyer ...!vax135!petsd!moncol!john Monmouth College ...!princeton!moncol!john W. Long Branch, NJ 07764 "Everybody knows in the second life, We all come back sooner or later. As anything from a pussy cat, To a man-eating alligator."
sean@ukma.UUCP (Sean Casey) (02/18/85)
Anyone know of a good method to keep TERM information for System V? I know that you can type TERM=xxx when typing your login name, but we have a lot of hardwired terminals, and it would be more convenient to have that terminal types kept in a file and have it be set automatically. -- Robert Berlinger ...{philabs,cucard,pegasus,ihnp4,rocky2}!aecom!naftoli David Herron wrote a little routine into our /etc/profile that will automatically set your tty type according to the line you are on. Here is the portion of /etc/profile that does it: -sh ) tty=`tty | sed '1,$s/.....//'` set `grep $tty /etc/ttytype` TERM=$2 export TERM Here is our /etc/ttytype: console 5620 contty vt100 tty11 vt100 tty12 vt100 tty13 vt100 tty14 vt100 tty15 vt100 I hope this helps. Sean -- Sean Casey UUCP: {hasmed, cbosgd}-\ {ucbvax, unmvax, boulder, research}!anlams---ukma!sean {mcvax!qtlon, vax135, mddc}!qusavx-/ ARPA: "ukma!sean"@ANL-MCS or sean%ukma.uucp@anl-mcs.arpa
adm@cbneb.UUCP (02/21/85)
If your using ansi terminals, you could also use the answerback or term id message. A few alterations to your .profile (or .login or whatever) and bingo! instant TERM setting. This method is superior to others posted since it will work for dialins, or when terminals are not directly connected to the computer (when using a datakit, for instance). Note that it still works if you have at most one non-ansi terminal type. We use this at our site, and so far it works fine.
gwyn@brl-tgr.ARPA (Doug Gwyn <gwyn>) (02/23/85)
> 1) Set up a file with a name like '/etc/ttynames'. It contains lines > 2) Run the following shell script from the .profile > John Ruschmeyer ...!vax135!petsd!moncol!john Hurray, a tool user!
guy@rlgvax.UUCP (Guy Harris) (02/25/85)
> Or put a test in the .profile > > if [ `tty` = "/dev/tty??" ] > then > TERM=5620 # or whatever > fi Doesn't do a damn thing if your password file entry reads: jblow:ABCDEFGHIJKL.:69:1:Joe Blow:/usr/jblow:/foo/bar/application and "/foo/bar/application" happens to be some screen-oriented application that doesn't want to know how to parse a shell script. Oh yes, you can't set TZ for the benefit of the application, either, for the same reason... (Most users at our customer sites have exactly such an application as their login shell.) Guy Harris {seismo,ihnp4,allegra}!rlgvax!guy