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