xref: /freebsd/libexec/getty/gettytab.5 (revision a2aef24aa3c8458e4036735dd6928b4ef77294e5)
1.\" Copyright (c) 1983, 1991, 1993
2.\"	The Regents of the University of California.  All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\"    notice, this list of conditions and the following disclaimer.
9.\" 2. Redistributions in binary form must reproduce the above copyright
10.\"    notice, this list of conditions and the following disclaimer in the
11.\"    documentation and/or other materials provided with the distribution.
12.\" 3. Neither the name of the University nor the names of its contributors
13.\"    may be used to endorse or promote products derived from this software
14.\"    without specific prior written permission.
15.\"
16.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
17.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
20.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26.\" SUCH DAMAGE.
27.\"
28.\"     from: @(#)gettytab.5	8.4 (Berkeley) 4/19/94
29.\" $FreeBSD$
30.\" "
31.Dd August 23, 2017
32.Dt GETTYTAB 5
33.Os
34.Sh NAME
35.Nm gettytab
36.Nd terminal configuration data base
37.Sh SYNOPSIS
38.Nm
39.Sh DESCRIPTION
40The
41.Nm
42file
43is a simplified version of the
44.Xr termcap 5
45data base
46used to describe terminal lines.
47The initial terminal login process
48.Xr getty 8
49accesses the
50.Nm
51file each time it starts, allowing simpler
52reconfiguration of terminal characteristics.
53Each entry in the data base
54is used to describe one class of terminals.
55.Pp
56There is a default terminal class,
57.Va default ,
58that is used to set global defaults for all other classes.
59(That is, the
60.Va default
61entry is read, then the entry for the class required
62is used to override particular settings.)
63.Sh CAPABILITIES
64Refer to
65.Xr termcap 5
66for a description of the file layout.
67The
68.Va default
69column below lists defaults obtained if there is
70no entry in the table obtained, nor one in the special
71.Va default
72table.
73.Bl -column Name Type /usr/bin/login
74.It Sy "Name	Type	Default	Description"
75.It "ac	str	unused	expect-send chat script for modem answer"
76.It "al	str	unused	user to auto-login instead of prompting"
77.It "ap	bool	false	terminal uses any parity"
78.It "bk	str	0377	alternate end of line character (input break)"
79.It "c0	num	unused	tty control flags to write messages"
80.It "c1	num	unused	tty control flags to read login name"
81.It "c2	num	unused	tty control flags to leave terminal as"
82.It "ce	bool	false	use crt erase algorithm"
83.It "ck	bool	false	use crt kill algorithm"
84.It "cl	str" Ta Dv NULL
85.Ta No "screen clear sequence"
86.It "co	bool	false	console - add"
87.Ql \en
88after login prompt
89.It "ct	num	10	chat timeout for"
90.Va \&ac
91and
92.Va \&ic
93scripts
94.It "dc	num	0	chat debug bitmask"
95.It "de	num	0	delay secs and flush input before writing first prompt"
96.It "df	str	%+	the" Xr strftime 3 "format used for \&%d in the banner message"
97.It "ds	str" Ta So Li ^Y
98.Sc Ta No "delayed suspend character"
99.It "dx	bool	false	set"
100.Dv DECCTLQ
101.It "ec	bool	false	leave echo"
102.Em OFF
103.It "ep	bool	false	terminal uses even parity"
104.It "er	str" Ta So Li ^?
105.Sc Ta No "erase character"
106.It "et	str" Ta So Li ^D
107.Sc Ta No "end of text"
108.Pq Dv EOF
109character
110.It "ev	str" Ta Dv NULL
111.Ta No "initial environment"
112.It "f0	num	unused	tty mode flags to write messages"
113.It "f1	num	unused	tty mode flags to read login name"
114.It "f2	num	unused	tty mode flags to leave terminal as"
115.It "fl	str" Ta So Li ^O
116.Sc Ta No "output flush character"
117.It "hc	bool	false	do"
118.Em NOT
119hangup line on last close
120.It "he	str" Ta Dv NULL
121.Ta No "hostname editing regular expression"
122.It "hn	str	hostname	hostname"
123.It "ht	bool	false	terminal has real tabs"
124.It "hw	bool	false	do cts/rts hardware flow control"
125.It "i0	num	unused	tty input flags to write messages"
126.It "i1	num	unused	tty input flags to read login name"
127.It "i2	num	unused	tty input flags to leave terminal as"
128.It "ic	str	unused	expect-send chat script for modem initialization"
129.It "if	str	unused	display named file before prompt, like /etc/issue"
130.It "ig	bool	false	ignore garbage characters in login name"
131.It "im	str" Ta Dv NULL
132.Ta No "initial (banner) message"
133.It "iM	str" Ta Dv NULL
134.Ta No "execute named file to generate initial (banner) message"
135.It "in	str" Ta So Li ^C
136.Sc Ta No "interrupt character"
137.It "is	num	unused	input speed"
138.It "kl	str" Ta So Li ^U
139.Sc Ta No "kill character"
140.It "l0	num	unused	tty local flags to write messages"
141.It "l1	num	unused	tty local flags to read login name"
142.It "l2	num	unused	tty local flags to leave terminal as"
143.It "lm	str	login:	login prompt"
144.It "ln	str" Ta So Li ^V
145.Sc Ta No "``literal next'' character"
146.It "lo	str" Ta Pa /usr/bin/login
147.Ta No "program to exec when name obtained"
148.It "mb	bool	false	do flow control based on carrier"
149.It "nc	bool	false	terminal does not supply carrier (set clocal)"
150.It "nl	bool	false	terminal has (or might have) a newline character"
151.It "np	bool	false	terminal uses no parity (i.e., 8-bit characters)"
152.It "nx	str	default	next table (for auto speed selection)"
153.It "o0	num	unused	tty output flags to write messages"
154.It "o1	num	unused	tty output flags to read login name"
155.It "o2	num	unused	tty output flags to leave terminal as"
156.It "op	bool	false	terminal uses odd parity"
157.It "os	num	unused	output speed"
158.It "pc	str" Ta So Li \e0
159.Sc Ta No "pad character"
160.It "pe	bool	false	use printer (hard copy) erase algorithm"
161.It "pf	num	0	delay"
162between first prompt and following flush (seconds)
163.It "pl	bool	false	start PPP login program unconditionally if"
164.Va \&pp
165is specified
166.It "pp	str	unused	PPP login program"
167.It "ps	bool	false	line connected to a"
168.Tn MICOM
169port selector
170.It "qu	str" Ta So Li \&^\e
171.Sc Ta No "quit character"
172.It "rp	str" Ta So Li ^R
173.Sc Ta No "line retype character"
174.It "rt	num	unused	ring timeout when using"
175.Va \&ac
176.It "rw	bool	false	do"
177.Em NOT
178use raw for input, use cbreak
179.It "sp	num	unused	line speed (input and output)"
180.It "su	str" Ta So Li ^Z
181.Sc Ta No "suspend character"
182.It "tc	str	none	table continuation"
183.It "to	num	0	timeout (seconds)"
184.It "tt	str" Ta Dv NULL
185.Ta No "terminal type (for environment)"
186.It "ub	bool	false	do unbuffered output (of prompts etc)"
187.It "we	str" Ta So Li ^W
188.Sc Ta No "word erase character"
189.It "xc	bool	false	do"
190.Em NOT
191echo control chars as
192.Ql ^X
193.It "xf	str" Ta So Li ^S Sc Ta Dv XOFF
194(stop output) character
195.It "xn	str" Ta So Li ^Q Sc Ta Dv XON
196(start output) character
197.It "Lo	str	C	the locale name used for \&%d in the banner message"
198.El
199.Pp
200The following capabilities are no longer supported by
201.Xr getty 8 :
202.Bl -column Name Type /usr/bin/login
203.It "bd	num	0	backspace delay"
204.It "cb	bool	false	use crt backspace mode"
205.It "cd	num	0	carriage-return delay"
206.It "fd	num	0	form-feed (vertical motion) delay"
207.It "lc	bool	false	terminal has lower case"
208.It "nd	num	0	newline (line-feed) delay"
209.It "uc	bool	false	terminal is known upper case only"
210.El
211.Pp
212If no line speed is specified, speed will not be altered
213from that which prevails when getty is entered.
214Specifying an input or output speed will override
215line speed for stated direction only.
216.Pp
217Terminal modes to be used for the output of the message,
218for input of the login name,
219and to leave the terminal set as upon completion,
220are derived from the boolean flags specified.
221If the derivation should prove inadequate,
222any (or all) of these three may be overridden
223with one of the
224.Va \&c0 ,
225.Va \&c1 ,
226.Va \&c2 ,
227.Va \&i0 ,
228.Va \&i1 ,
229.Va \&i2 ,
230.Va \&l0 ,
231.Va \&l1 ,
232.Va \&l2 ,
233.Va \&o0 ,
234.Va \&o1 ,
235or
236.Va \&o2
237numeric specifications, which can be used to specify
238(usually in octal, with a leading '0')
239the exact values of the flags.
240These flags correspond to the termios
241.Va c_cflag ,
242.Va c_iflag ,
243.Va c_lflag ,
244and
245.Va c_oflag
246fields, respectively.
247Each these sets must be completely specified to be effective.
248The
249.Va \&f0 ,
250.Va \&f1 ,
251and
252.Va \&f2
253are excepted for backwards compatibility with a previous incarnation of
254the TTY sub-system.
255In these flags the bottom 16 bits of the (32 bits)
256value contain the sgttyb
257.Va sg_flags
258field, while the top 16 bits represent the local mode word.
259.Pp
260Should
261.Xr getty 8
262receive a null character
263(presumed to indicate a line break)
264it will restart using the table indicated by the
265.Va \&nx
266entry.
267If there is none, it will re-use its original table.
268.Pp
269Delays are specified in milliseconds, the nearest possible
270delay available in the tty driver will be used.
271Should greater certainty be desired, delays
272with values 0, 1, 2, and 3 are interpreted as
273choosing that particular delay algorithm from the driver.
274.Pp
275The
276.Va \&cl
277screen clear string may be preceded by a (decimal) number
278of milliseconds of delay required (a la termcap).
279This delay is simulated by repeated use of the pad character
280.Va \&pc .
281.Pp
282The initial message, login message, and initial file;
283.Va \&im ,
284.Va \&lm
285and
286.Va \&if
287may include any of the following character sequences, which expand to
288information about the environment in which
289.Xr getty 8
290is running.
291.Bl -tag -offset indent -width \&%xxxxxxxxxxxxxx
292.It \&%d
293The current date and time formatted according to the
294.Va \&Lo
295and
296.Va \&df
297strings.
298.It \&%h
299The hostname of the machine, which is normally obtained from the
300system using
301.Xr gethostname 3 ,
302but may also be overridden by the
303.Va \&hn
304table entry.
305In either case it may be edited with the
306.Va \&he
307POSIX
308.Dq extended
309regular expression, which is matched against the hostname.
310If there are no parenthesized subexpressions in the pattern,
311the entire matched string is used as the final hostname;
312otherwise, the first matched subexpression is used instead.
313If the pattern does not match, the original hostname is not modified.
314.It \&%t
315The tty name.
316.It "\&%m, \&%r, \&%s, \&%v"
317The type of machine, release of the operating system, name of the
318operating system, and version of the kernel, respectively, as
319returned by
320.Xr uname 3 .
321.It \&%%
322A
323.Dq %
324character.
325.El
326.Pp
327When getty execs the login process, given
328in the
329.Va \&lo
330string (usually
331.Dq Pa /usr/bin/login ) ,
332it will have set
333the environment to include the terminal type, as indicated
334by the
335.Va \&tt
336string (if it exists).
337The
338.Va \&ev
339string, can be used to enter additional data into
340the environment.
341It is a list of comma separated strings, each of which
342will presumably be of the form
343.Li name=value .
344.Pp
345If a non-zero timeout is specified, with
346.Va \&to ,
347then getty will exit within the indicated
348number of seconds, either having
349received a login name and passed control
350to
351.Xr login 1 ,
352or having received an alarm signal, and exited.
353This may be useful to hangup dial in lines.
354.Pp
355Output from
356.Xr getty 8
357is even parity unless
358.Va \&op
359or
360.Va \&np
361is specified.
362The
363.Va \&op
364string
365may be specified with
366.Va \&ap
367to allow any parity on input, but generate odd parity output.
368Note: this only applies while getty is being run,
369terminal driver limitations prevent a more complete
370implementation.
371The
372.Xr getty 8
373utility does not check parity of input characters in
374.Dv RAW
375mode.
376.Pp
377If a
378.Va \&pp
379string is specified and a PPP link bring-up sequence is recognized,
380getty will invoke the program referenced by the
381.Va \&pp
382option.
383This can be used to handle incoming PPP calls.
384If the
385.Va \&pl
386option is true as well,
387.Xr getty 8
388will skip the user name prompt and the PPP detection phase, and will
389invoke the program specified by
390.Va \&pp
391instantly.
392.Pp
393.Nm Getty
394provides some basic intelligent modem handling by providing a chat
395script feature available via two capabilities:
396.Pp
397.Bl -tag -offset indent -width \&xxxxxxxx -compact
398.It ic
399Chat script to initialize modem.
400.It ac
401Chat script to answer a call.
402.El
403.Pp
404A chat script is a set of expect/send string pairs.
405When a chat string starts,
406.Nm getty
407will wait for the first string, and if it finds it, will send the
408second, and so on.
409Strings specified are separated by one or more tabs or spaces.
410Strings may contain standard ASCII characters and special 'escapes',
411which consist of a backslash character followed by one or more
412characters which are interpreted as follows:
413.Pp
414.Bl -tag -offset indent -width \&xxxxxxxx -compact
415.It \ea
416bell character.
417.It \eb
418backspace.
419.It \en
420newline.
421.It \ee
422escape.
423.It \ef
424formfeed.
425.It \ep
426half-second pause.
427.It \er
428carriage return.
429.It \eS , \es
430space character.
431.It \et
432tab.
433.It \exNN
434hexadecimal byte value.
435.It \e0NNN
436octal byte value.
437.El
438.Pp
439Note that the
440.Ql \ep
441sequence is only valid for send strings and causes a half-second
442pause between sending the previous and next characters.
443Hexadecimal values are, at most, 2 hex digits long, and octal
444values are a maximum of 3 octal digits.
445.Pp
446The
447.Va \&ic
448chat sequence is used to initialize a modem or similar device.
449A typical example of an init chat script for a modem with a
450hayes compatible command set might look like this:
451.Pp
452.Dl :ic="" ATE0Q0V1\er OK\er ATS0=0\er OK\er:
453.Pp
454This script waits for nothing (which always succeeds), sends
455a sequence to ensure that the modem is in the correct mode
456(suppress command echo, send responses in verbose mode),
457and then disables auto-answer.
458It waits for an "OK" response before it terminates.
459The init sequence is used to check modem responses to ensure that
460the modem is functioning correctly.
461If the init script fails to complete,
462.Nm getty
463considers this to be fatal, and results in an error logged via
464.Xr syslogd 8 ,
465and exiting.
466.Pp
467Similarly, an answer chat script is used to manually answer the
468phone in response to (usually) a "RING".
469When run with an answer script,
470.Nm getty
471opens the port in non-blocking mode, clears any extraneous input
472and waits for data on the port.
473As soon as any data is available, the answer chat script is
474started and scanned for a string, and responds according to
475the answer chat script.
476With a hayes compatible modem, this would normally look something
477like:
478.Pp
479.Dl :ac=RING\er ATA\er CONNECT:
480.Pp
481This causes the modem to answer the call via the "ATA" command,
482then scans input for a "CONNECT" string.
483If this is received before a
484.Va \&ct
485timeout, then a normal login sequence commences.
486.Pp
487The
488.Va \&ct
489capability specifies a timeout for all send and expect strings.
490This timeout is set individually for each expect wait and send
491string and must be at least as long as the time it takes for
492a connection to be established between a remote and local
493modem (usually around 10 seconds).
494.Pp
495In most situations, you will want to flush any additional
496input after the connection has been detected, and the
497.Va \&de
498capability may be used to do that, as well as delay for a
499short time after the connection has been established during
500which all of the connection data has been sent by the modem.
501.Sh SEE ALSO
502.Xr login 1 ,
503.Xr gethostname 3 ,
504.Xr uname 3 ,
505.Xr termcap 5 ,
506.Xr getty 8 ,
507.Xr telnetd 8
508.Sh HISTORY
509The
510.Nm
511file format appeared in
512.Bx 4.2 .
513.Sh BUGS
514The special characters (erase, kill, etc.) are reset to system defaults
515by
516.Xr login 1 .
517In
518.Em all
519cases, '#' or '^H' typed in a login name will be treated as
520an erase character, and '@' will be treated as a kill character.
521.Pp
522The delay stuff is a real crock.
523Apart form its general lack of flexibility, some
524of the delay algorithms are not implemented.
525The terminal driver should support sane delay settings.
526.Pp
527The
528.Xr termcap 5
529format is horrid, something more rational should
530have been chosen.
531