.\" SUCH DAMAGE.
.\"
.\" from: @(#)gettytab.5 8.4 (Berkeley) 4/19/94
-.\" $Id: gettytab.5,v 1.1 1999/05/02 04:21:29 wsanchez Exp $
-.\"
+.\" $FreeBSD: src/libexec/getty/gettytab.5,v 1.41 2005/01/18 09:29:39 ru Exp $
+.\" "
.Dd April 19, 1994
.Dt GETTYTAB 5
-.Os BSD 4.2
+.Os
.Sh NAME
.Nm gettytab
.Nd terminal configuration data base
.Sh SYNOPSIS
-.Nm gettytab
+.Nm
.Sh DESCRIPTION
The
-.Nm gettytab
+.Nm
file
is a simplified version of the
.Xr termcap 5
The initial terminal login process
.Xr getty 8
accesses the
-.Nm gettytab
+.Nm
file each time it starts, allowing simpler
reconfiguration of terminal characteristics.
Each entry in the data base
is used to describe one class of terminals.
.Pp
There is a default terminal class,
-.Em default ,
+.Va default ,
that is used to set global defaults for all other classes.
(That is, the
-.Em default
+.Va default
entry is read, then the entry for the class required
is used to override particular settings.)
.Sh CAPABILITIES
.Xr termcap 5
for a description of the file layout.
The
-.Em default
+.Va default
column below lists defaults obtained if there is
no entry in the table obtained, nor one in the special
-.Em default
+.Va default
table.
-.Bl -column Namexx /usr/bin/login Default
-.It Sy Name Type Default Description
+.Bl -column Name Type /usr/bin/login
+.It Sy "Name Type Default Description
+.It "ac str unused expect-send chat script for modem answer"
+.It "al str unused user to auto-login instead of prompting"
.It "ap bool false terminal uses any parity"
.It "bk str 0377 alternate end of line character (input break)"
.It "c0 num unused tty control flags to write messages"
.It "c2 num unused tty control flags to leave terminal as"
.It "ce bool false use crt erase algorithm"
.It "ck bool false use crt kill algorithm"
-.It "cl str" Ta Dv NULL Ta
+.It "cl str" Ta Dv NULL Ta
.No "screen clear sequence"
.It "co bool false console - add"
.Ql \en
after login prompt
+.It "ct num 10 chat timeout for"
+.Va \&ac
+and
+.Va \&ic
+scripts
+.It "dc num 0 chat debug bitmask"
+.It "de num 0 delay secs and flush input before writing first prompt"
+.It "df str %+ the" Xr strftime 3 "format used for \&%d in the banner message"
.It "ds str" Ta So Li ^Y Sc Ta
.No "delayed suspend character"
.It "dx bool false set"
.Dv DECCTLQ
.It "ec bool false leave echo"
-.Tn OFF
+.Em OFF
.It "ep bool false terminal uses even parity"
.It "er str" Ta So Li ^? Sc Ta
.No "erase character"
.No "end of text"
.Pq Dv EOF
character
-.It "ev str" Ta Dv NULL Ta
+.It "ev str" Ta Dv NULL Ta
.No "initial environment"
.It "f0 num unused tty mode flags to write messages"
.It "f1 num unused tty mode flags to read login name"
.It "fl str" Ta So Li ^O Sc Ta
.No "output flush character"
.It "hc bool false do"
-.Tn NOT
+.Em NOT
hangup line on last close
-.It "he str" Ta Dv NULL Ta
+.It "he str" Ta Dv NULL Ta
.No "hostname editing string"
.It "hn str hostname hostname"
.It "ht bool false terminal has real tabs"
+.It "hw bool false do cts/rts hardware flow control"
.It "i0 num unused tty input flags to write messages"
.It "i1 num unused tty input flags to read login name"
.It "i2 num unused tty input flags to leave terminal as"
+.It "ic str unused expect-send chat script for modem initialization"
+.It "if str unused display named file before prompt, like /etc/issue"
.It "ig bool false ignore garbage characters in login name"
.It "im str" Ta Dv NULL Ta
.No "initial (banner) message"
.It "l0 num unused tty local flags to write messages"
.It "l1 num unused tty local flags to read login name"
.It "l2 num unused tty local flags to leave terminal as"
-.It "lc bool false terminal has lower case"
.It "lm str login: login prompt"
.It "ln str" Ta So Li ^V Sc Ta
.No "``literal next'' character"
.It "lo str" Ta Pa /usr/bin/login Ta
.No "program to exec when name obtained"
.It "mb bool false do flow control based on carrier"
+.It "nc bool false terminal does not supply carrier (set clocal)"
.It "nl bool false terminal has (or might have) a newline character"
.It "np bool false terminal uses no parity (i.e. 8-bit characters)"
.It "nx str default next table (for auto speed selection)"
.It "pe bool false use printer (hard copy) erase algorithm"
.It "pf num 0 delay"
between first prompt and following flush (seconds)
+.It "pl bool false start PPP login program unconditionally if"
+.Va \&pp
+is specified
+.It "pp str unused PPP login program"
.It "ps bool false line connected to a"
.Tn MICOM
port selector
.No "quit character"
.It "rp str" Ta So Li ^R Sc Ta
.No "line retype character"
+.It "rt num unused ring timeout when using"
+.Va \&ac
.It "rw bool false do"
-.Tn NOT
+.Em NOT
use raw for input, use cbreak
.It "sp num unused line speed (input and output)"
.It "su str" Ta So Li ^Z Sc Ta
.It "we str" Ta So Li ^W Sc Ta
.No "word erase character"
.It "xc bool false do
-.Tn NOT
+.Em NOT
echo control chars as
.Ql ^X
.It "xf str" Ta So Li ^S Sc Ta Dv XOFF
(stop output) character
.It "xn str" Ta So Li ^Q Sc Ta Dv XON
(start output) character
+.It "Lo str C the locale name used for \&%d in the banner message"
.El
.Pp
-The following capabilities are no longer supported by getty(8):
-.Bl -column Namexx /usr/bin/login Default
+The following capabilities are no longer supported by
+.Xr getty 8 :
+.Bl -column Name Type /usr/bin/login
.It "bd num 0 backspace delay"
.It "cb bool false use crt backspace mode"
.It "cd num 0 carriage-return delay"
.It "fd num 0 form-feed (vertical motion) delay"
+.It "lc bool false terminal has lower case"
.It "nd num 0 newline (line-feed) delay"
.It "uc bool false terminal is known upper case only"
.El
If the derivation should prove inadequate,
any (or all) of these three may be overridden
with one of the
-.Em \&c0 ,
-.Em \&c1 ,
-.Em \&c2 ,
-.Em \&i0 ,
-.Em \&i1 ,
-.Em \&i2 ,
-.Em \&l0 ,
-.Em \&l1 ,
-.Em \&l2 ,
-.Em \&o0 ,
-.Em \&o1 ,
+.Va \&c0 ,
+.Va \&c1 ,
+.Va \&c2 ,
+.Va \&i0 ,
+.Va \&i1 ,
+.Va \&i2 ,
+.Va \&l0 ,
+.Va \&l1 ,
+.Va \&l2 ,
+.Va \&o0 ,
+.Va \&o1 ,
or
-.Em \&o2
+.Va \&o2
numeric specifications, which can be used to specify
(usually in octal, with a leading '0')
the exact values of the flags.
These flags correspond to the termios
-.Em c_cflag ,
-.Em c_iflag ,
-.Em c_lflag ,
+.Va c_cflag ,
+.Va c_iflag ,
+.Va c_lflag ,
and
-.Em c_oflag
-fields, respectively. Each these sets must be completely specified to be
-effective.
+.Va c_oflag
+fields, respectively.
+Each of these sets must be completely specified to be effective.
+.Pp
The
-.Em \&f0 ,
-.Em \&f1 ,
+.Va \&f0 ,
+.Va \&f1 ,
and
-.Em \&f2
+.Va \&f2
are excepted for backwards compatibility with a previous incarnation of
-the TTY sub-system. In these flags the bottom 16 bits of the (32 bits)
+the TTY sub-system.
+In these flags the bottom 16 bits of the (32 bits)
value contain the sgttyb
-.Em sg_flags
+.Va sg_flags
field, while the top 16 bits represent the local mode word.
.Pp
Should
-.Xr getty
+.Xr getty 8
receive a null character
(presumed to indicate a line break)
it will restart using the table indicated by the
-.Em nx
-entry. If there is none, it will re-use its original table.
+.Va \&nx
+entry.
+If there is none, it will re-use its original table.
.Pp
Delays are specified in milliseconds, the nearest possible
delay available in the tty driver will be used.
choosing that particular delay algorithm from the driver.
.Pp
The
-.Em \&cl
+.Va \&cl
screen clear string may be preceded by a (decimal) number
of milliseconds of delay required (a la termcap).
This delay is simulated by repeated use of the pad character
-.Em \&pc .
+.Va \&pc .
.Pp
-The initial message, and login message,
-.Em \&im
+The initial message, login message, and initial file;
+.Va \&im ,
+.Va \&lm
and
-.Em \&lm
-may include the character sequence
-.Em \&%h
-or
-.Em \&%t
-to obtain
-the hostname or tty name respectively.
-.Pf ( Em %%
-obtains a single '%' character.)
-The hostname is normally obtained from the system,
-but may be set by the
-.Em \&hn
+.Va \&if
+may include any of the following character sequences, which expand to
+information about the environment in which
+.Xr getty 8
+is running.
+.Pp
+.Bl -tag -offset indent -width \&%xxxxxxxxxxxxxx
+.It \&%d
+The current date and time formatted according to the
+.Va \&Lo
+and
+.Va \&df
+strings.
+.It \&%h
+The hostname of the machine, which is normally obtained from the
+system using
+.Xr gethostname 3 ,
+but may also be overridden by the
+.Va \&hn
table entry.
-In either case it may be edited with
-.Em \&he .
-The
-.Em \&he
-string is a sequence of characters, each character that
-is neither '@' nor '#' is copied into the final hostname.
+In either case it may be edited with the
+.Va \&he
+string.
A '@' in the
-.Em \&he
-string, causes one character from the real hostname to
+.Va \&he
+string causes one character from the real hostname to
be copied to the final hostname.
A '#' in the
-.Em \&he
-string, causes the next character of the real hostname
+.Va \&he
+string causes the next character of the real hostname
to be skipped.
+Each character that
+is neither '@' nor '#' is copied into the final hostname.
Surplus '@' and '#' characters are ignored.
+.It \&%t
+The tty name.
+.It "\&%m, \&%r, \&%s, \&%v"
+The type of machine, release of the operating system, name of the
+operating system, and version of the kernel, respectively, as
+returned by
+.Xr uname 3 .
+.It \&%%
+A
+.Dq %
+character.
+.El
.Pp
When getty execs the login process, given
in the
-.Em \&lo
+.Va \&lo
string (usually
.Dq Pa /usr/bin/login ) ,
it will have set
the environment to include the terminal type, as indicated
by the
-.Em \&tt
+.Va \&tt
string (if it exists).
The
-.Em \&ev
+.Va \&ev
string, can be used to enter additional data into
the environment.
It is a list of comma separated strings, each of which
will presumably be of the form
-.Em name=value .
+.Li name=value .
.Pp
If a non-zero timeout is specified, with
-.Em \&to ,
+.Va \&to ,
then getty will exit within the indicated
number of seconds, either having
received a login name and passed control
to
-.Xr login ,
+.Xr login 1 ,
or having received an alarm signal, and exited.
This may be useful to hangup dial in lines.
.Pp
Output from
-.Xr getty
+.Xr getty 8
is even parity unless
-.Em \&op
+.Va \&op
or
-.Em \&np
+.Va \&np
is specified.
The
-.Em \&op
+.Va \&op
string
may be specified with
-.Em \&ap
+.Va \&ap
to allow any parity on input, but generate odd parity output.
Note: this only applies while getty is being run,
terminal driver limitations prevent a more complete
implementation.
-.Xr Getty
-does not check parity of input characters in
+The
+.Xr getty 8
+utility does not check parity of input characters in
.Dv RAW
mode.
+.Pp
+If a
+.Va \&pp
+string is specified and a PPP link bring-up sequence is recognized,
+getty will invoke the program referenced by the
+.Va \&pp
+option.
+This can be used to handle incoming PPP calls.
+If the
+.Va \&pl
+option is true as well,
+.Xr getty 8
+will skip the user name prompt and the PPP detection phase, and will
+invoke the program specified by
+.Va \&pp
+instantly.
+.Pp
+.Nm Getty
+provides some basic intelligent modem handling by providing a chat
+script feature available via two capabilities:
+.Pp
+.Bl -tag -offset indent -width \&xxxxxxxx -compact
+.It ic
+Chat script to initialize modem.
+.It ac
+Chat script to answer a call.
+.El
+.Pp
+A chat script is a set of expect/send string pairs.
+When a chat string starts,
+.Nm getty
+will wait for the first string, and if it finds it, will send the
+second, and so on.
+Strings specified are separated by one or more tabs or spaces.
+Strings may contain standard ASCII characters and special 'escapes',
+which consist of a backslash character followed by one or more
+characters which are interpreted as follows:
+.Pp
+.Bl -tag -offset indent -width \&xxxxxxxx -compact
+.It \ea
+bell character.
+.It \eb
+backspace.
+.It \en
+newline.
+.It \ee
+escape.
+.It \ef
+formfeed.
+.It \ep
+half-second pause.
+.It \er
+carriage return.
+.It \eS , \es
+space character.
+.It \et
+tab.
+.It \exNN
+hexadecimal byte value.
+.It \e0NNN
+octal byte value.
+.El
+.Pp
+Note that the
+.Ql \ep
+sequence is only valid for send strings and causes a half-second
+pause between sending the previous and next characters.
+Hexadecimal values are, at most, 2 hex digits long, and octal
+values are a maximum of 3 octal digits.
+.Pp
+The
+.Va \&ic
+chat sequence is used to initialize a modem or similar device.
+A typical example of an init chat script for a modem with a
+hayes compatible command set might look like this:
+.Pp
+.Dl :ic="" ATE0Q0V1\er OK\er ATS0=0\er OK\er:
+.Pp
+This script waits for nothing (which always succeeds), sends
+a sequence to ensure that the modem is in the correct mode
+(suppress command echo, send responses in verbose mode),
+and then disables auto-answer.
+It waits for an "OK" response before it terminates.
+The init sequence is used to check modem responses to ensure that
+the modem is functioning correctly.
+If the init script fails to complete,
+.Nm getty
+considers this to be fatal, and results in an error logged via
+.Xr syslogd 8 ,
+and exiting.
+.Pp
+Similarly, an answer chat script is used to manually answer the
+phone in response to (usually) a "RING".
+When run with an answer script,
+.Nm getty
+opens the port in non-blocking mode, clears any extraneous input
+and waits for data on the port.
+As soon as any data is available, the answer chat script is
+started and scanned for a string, and responds according to
+the answer chat script.
+With a hayes compatible modem, this would normally look something
+like:
+.Pp
+.Dl :ac=RING\er ATA\er CONNECT:
+.Pp
+This causes the modem to answer the call via the "ATA" command,
+then scans input for a "CONNECT" string.
+If this is received before a
+.Va \&ct
+timeout, then a normal login sequence commences.
+.Pp
+The
+.Va \&ct
+capability specifies a timeout for all send and expect strings.
+This timeout is set individually for each expect wait and send
+string and must be at least as long as the time it takes for
+a connection to be established between a remote and local
+modem (usually around 10 seconds).
+.Pp
+In most situations, you will want to flush any additional
+input after the connection has been detected, and the
+.Va \&de
+capability may be used to do that, as well as delay for a
+short time after the connection has been established during
+which all of the connection data has been sent by the modem.
.Sh SEE ALSO
.Xr login 1 ,
+.Xr gethostname 3 ,
+.Xr uname 3 ,
.Xr termcap 5 ,
-.Xr getty 8 .
+.Xr getty 8 ,
+.Xr telnetd 8
+.Sh HISTORY
+The
+.Nm
+file format appeared in
+.Bx 4.2 .
.Sh BUGS
The special characters (erase, kill, etc.) are reset to system defaults
by
The terminal driver should support sane delay settings.
.Pp
The
-.Em \&he
+.Va \&he
capability is stupid.
.Pp
The
-.Xr termcap
+.Xr termcap 5
format is horrid, something more rational should
have been chosen.
.Pp
This should be converted to use
.Xr termios 4 .
-.Sh HISTORY
-The
-.Nm gettytab
-file format appeared in 4.2BSD.