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