setting TERM - actually about terminal initialization

William L. Sebok wls at astrovax.UUCP
Sat Feb 23 13:13:07 AEST 1985


The fact that this subject has been brought up now gives me an excuse to get
up upon the soap box.  I am not happy with the way either BSD or USG Unix
initializes the modes of terminals.   I think that the present method of
passing a magic cookie to getty by means of /etc/ttys or /etc/inittab is
opaque and usually does not let one fully specify the initial modes of a
terminal port.  I further do not like the contortions one has to go through
to initialize and retain the modes of terminal port without a getty, such as
that of a line printer connected to a terminal port.

I'd like to submit a counterproposal.  These ideas are not original.

1)  Define a tty ioctl that saves the current tty modes in an extra place
in the kernel tty structure.  Call these saved modes the "permanent tty
modes".  Make this ioctl executable by the superuser only.

2) Define a tty ioctl that resets the current tty modes by copying the
permanent tty modes to the current tty modes.

3) Make /etc/rc set from a script permanent tty modes for all the terminal
ports it knows about.

4) A tty would reset itself on close to the permanent tty modes.

The most common getty mode could be one in which getty simply executes ioctl
#2 to reset the tty modes from the permanent modes.

This scheme would not help dialup or network lines (as much) but would greatly
benefit the lines permanently attached to certain terminals.  I believe that at
most sites that this is the great majority of terminals.  For instance, one
would finally be able to consider fine tuning the various character delays to
the terminal connected to that line.  And, as previously mentioned, one can
set a printer attached to a tty port to 1200 baud and have it stay that way
with out having to do the horrible kluge of

	sleep 10000000 >/dev/ttyXX &

to hold it open so that it doesn't reset its baud rate back to 300.

I would also not mind seeing a TERM name stored in the terminal structure.
I think that this makes more sense than storing it in the environment as
a terminal type is logically more closely related to a tty port than it
is to a process.  A process could theoritically be controlling more than
one terminal of different types.
-- 
Bill Sebok			Princeton University, Astrophysics
{allegra,akgua,burl,cbosgd,decvax,ihnp4,noao,princeton,vax135}!astrovax!wls



More information about the Comp.unix.wizards mailing list