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