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