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