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