Subject: Re: terminal??
To: dkphoto <dkphoto@cyber-wire.com>
From: David Maxwell <david@fundy.ca>
List: netbsd-users
Date: 01/19/2000 22:02:53
On Wed, Jan 19, 2000 at 06:39:48PM -0700, dkphoto wrote:
> Why does bsd keep asking me to input a terminal on each startup? What 
> exactly does it mean by "terminal" and what the heck does vt220 mean?

In many places, people use serial ports on Unix hosts by plugging in
'dumb terminals'. If you've used a program like Procomm, or Telix before,
you'll recognize the term 'terminal software'. Those programs let you
use a PC like a dumb terminal. A dumb terminal consists of a keyboard,
a serial port, and a display - these days, a CRT, in older times, a
teletype, or 'printer'.

vt220 refers to a particular model of 'Video Terminal' made by DEC
(Digital - now Compaq).

Because dumb terminals don't have a framebuffer (A memory buffer like
the one a PC VGA card), if you turn it off, and back on, the screen
will be empty. But the unix host doesn't know that. If you were editing
a file in 'vi' for example, vi expects you can see the file you're
working on.

In order to keep the host's idea of the display in sync with the terminal
they need to agree on a set of control characters used to move the
cursor around, scroll the screen, set bold, underline...

vt220 is a commonly used set of those, that many manufacturers besides
DEC liked, and copied. Well written software uses libraries like 
termcap and curses, to work on many different terminals. Some software
is hardcoded to use escape sequences for a particular type of terminal.

NetBSD's wscons can be configured for different terminal types when
you compile your kernel, but vt220 is a pretty good default for a 
number of reasons.

> (Another example of what I mean by the docs being obtuse. They tell you 
> to input vt220, but they don't tell you why you need to keep inputting it 
> over and over, or what it means. Sort of like learning surgery by the 
> "just shut up and cut here" method!)

Take a look at your ~/.login file, that's what's prompting you. There's
a manpage for the tset command - the one that actually asks the
question.

Unix has never had a history of coddling. You are expected to experiment
and learn for yourself. The manpage for your shell for example, will
tell you what startup files get run when you login, and each command
used there should have a manpage too.

If I wrote a page like this for every underlying concept in unix, I
would fill up every hard drive I have. I don't mind answering 
questions like this, because other people probably want to know too,
and I can re-use this message later when it comes up again... but
there are plenty of good Intro to Unix books available out there.

For your specific question, check which tty you are logging in on,
(type 'tty' at the shell prompt) and make sure the entry in /etc/ttys
(column 3) is what you want it to default to. Then, you can change
the line in ~/.login something like this:

if ( $TERM == "vt220" ) set term=vt220
else
tset -Q \?$TERM
endif

There are plenty of other ways to accomplish similar things. See
if you can use the tset manpage to use the built-in grammar of
tset to do this in one line instead...

-- 
David Maxwell, david@vex.net|david@maxwell.net --> Although some of you out
there might find a microwave oven controlled by a Unix system an attractive
idea, controlling a microwave oven is easily accomplished with the smallest
of microcontrollers. - Russ Hersch - (Microcontroller primer and FAQ)