3578f5d3b64ac2fbdb26af69efb1bdb7917d168e
[games.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. 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: src/libexec/getty/gettytab.5,v 1.21.2.10 2003/02/06 11:45:31 sobomax Exp $
34 .\" $DragonFly: src/libexec/getty/gettytab.5,v 1.3 2006/02/17 19:33:31 swildner Exp $
35 .\" "
36 .Dd April 19, 1994
37 .Dt GETTYTAB 5
38 .Os
39 .Sh NAME
40 .Nm gettytab
41 .Nd terminal configuration data base
42 .Sh SYNOPSIS
43 .Nm
44 .Sh DESCRIPTION
45 The
46 .Nm
47 file
48 is a simplified version of the
49 .Xr termcap 5
50 data base
51 used to describe terminal lines.
52 The initial terminal login process
53 .Xr getty 8
54 accesses the
55 .Nm
56 file each time it starts, allowing simpler
57 reconfiguration of terminal characteristics.
58 Each entry in the data base
59 is used to describe one class of terminals.
60 .Pp
61 There is a default terminal class,
62 .Em default ,
63 that is used to set global defaults for all other classes.
64 (That is, the
65 .Em default
66 entry is read, then the entry for the class required
67 is used to override particular settings.)
68 .Sh CAPABILITIES
69 Refer to
70 .Xr termcap 5
71 for a description of the file layout.
72 The
73 .Em default
74 column below lists defaults obtained if there is
75 no entry in the table obtained, nor one in the special
76 .Em default
77 table.
78 .Bl -column Name Type /usr/bin/login
79 .It Sy "Name    Type    Default Description
80 .It "ac str     unused  expect-send chat script for modem answer"
81 .It "al str     unused  user to auto-login instead of prompting"
82 .It "ap bool    false   terminal uses any parity"
83 .It "bk str     0377    alternate end of line character (input break)"
84 .It "c0 num     unused  tty control flags to write messages"
85 .It "c1 num     unused  tty control flags to read login name"
86 .It "c2 num     unused  tty control flags to leave terminal as"
87 .It "ce bool    false   use crt erase algorithm"
88 .It "ck bool    false   use crt kill algorithm"
89 .It "cl str" Ta Dv NULL Ta
90 .No "screen clear sequence"
91 .It "co bool    false   console - add"
92 .Ql \en
93 after login prompt
94 .It "ct num     10      chat timeout for ac/ic scripts"
95 .It "dc num     0       chat debug bitmask"
96 .It "de num     0       delay secs and flush input before writing first prompt"
97 .It "df str     %+      the" Xr strftime 3 "format used for \&%d in the banner message"
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
110 character
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
120 hangup 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 "nc bool    false   terminal does not supply carrier (set clocal)"
149 .It "nl bool    false   terminal has (or might have) a newline character"
150 .It "np bool    false   terminal uses no parity (i.e. 8-bit characters)"
151 .It "nx str     default next table (for auto speed selection)"
152 .It "o0 num     unused  tty output flags to write messages"
153 .It "o1 num     unused  tty output flags to read login name"
154 .It "o2 num     unused  tty output flags to leave terminal as"
155 .It "op bool    false   terminal uses odd parity"
156 .It "os num     unused  output speed"
157 .It "pc str" Ta So Li \e0 Sc Ta
158 .No "pad character"
159 .It "pe bool    false   use printer (hard copy) erase algorithm"
160 .It "pf num     0       delay"
161 between first prompt and following flush (seconds)
162 .It "pp str     unused  PPP authentication program"
163 .It "pl bool    false   don't detect PPP sequence, but start PPP login"
164 program referenced by pp automatically
165 .It "ps bool    false   line connected to a"
166 .Tn MICOM
167 port 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 ac"
173 .It "rw bool    false   do"
174 .Tn 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 Sc Ta
178 .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 Sc Ta
185 .No "word erase character"
186 .It "xc bool    false   do
187 .Tn 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 Ns :
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 "fd num     0       form-feed (vertical motion) delay"
204 .It "lc bool    false   terminal has lower case"
205 .It "nd num     0       newline (line-feed) delay"
206 .It "uc bool    false   terminal is known upper case only"
207 .El
208 .Pp
209 If no line speed is specified, speed will not be altered
210 from that which prevails when getty is entered.
211 Specifying an input or output speed will override
212 line speed for stated direction only.
213 .Pp
214 Terminal modes to be used for the output of the message,
215 for input of the login name,
216 and to leave the terminal set as upon completion,
217 are derived from the boolean flags specified.
218 If the derivation should prove inadequate,
219 any (or all) of these three may be overridden
220 with one of the
221 .Em \&c0 ,
222 .Em \&c1 ,
223 .Em \&c2 ,
224 .Em \&i0 ,
225 .Em \&i1 ,
226 .Em \&i2 ,
227 .Em \&l0 ,
228 .Em \&l1 ,
229 .Em \&l2 ,
230 .Em \&o0 ,
231 .Em \&o1 ,
232 or
233 .Em \&o2
234 numeric specifications, which can be used to specify
235 (usually in octal, with a leading '0')
236 the exact values of the flags.
237 These flags correspond to the termios
238 .Em c_cflag ,
239 .Em c_iflag ,
240 .Em c_lflag ,
241 and
242 .Em c_oflag
243 fields, respectively. Each these sets must be completely specified to be
244 effective.
245 The
246 .Em \&f0 ,
247 .Em \&f1 ,
248 and
249 .Em \&f2
250 are excepted for backwards compatibility with a previous incarnation of
251 the TTY sub-system. In these flags the bottom 16 bits of the (32 bits)
252 value contain the sgttyb
253 .Em sg_flags
254 field, while the top 16 bits represent the local mode word.
255 .Pp
256 Should
257 .Xr getty 8
258 receive a null character
259 (presumed to indicate a line break)
260 it will restart using the table indicated by the
261 .Em nx
262 entry. If there is none, it will re-use its original table.
263 .Pp
264 Delays are specified in milliseconds, the nearest possible
265 delay available in the tty driver will be used.
266 Should greater certainty be desired, delays
267 with values 0, 1, 2, and 3 are interpreted as
268 choosing that particular delay algorithm from the driver.
269 .Pp
270 The
271 .Em \&cl
272 screen clear string may be preceded by a (decimal) number
273 of milliseconds of delay required (a la termcap).
274 This delay is simulated by repeated use of the pad character
275 .Em \&pc .
276 .Pp
277 The initial message, login message, and initial file;
278 .Em \&im ,
279 .Em \&lm
280 and
281 .Em \&if
282 may include any of the following character sequences, which expand to
283 information about the environment in which
284 .Xr getty 8
285 is running.
286 .Pp
287 .Bl -tag -offset indent -width \&%xxxxxxxxxxxxxx
288 .It \&%d
289 The current date and time formatted according to the
290 .Em \&Lo
291 and
292 .Em \&df
293 strings.
294 .It \&%h
295 The hostname of the machine, which is normally obtained from the
296 system using
297 .Xr gethostname 3 ,
298 but may also be overridden by the
299 .Em \&hn
300 table entry.
301 In either case it may be edited with the
302 .Em \&he
303 string.
304 A '@' in the
305 .Em \&he
306 string causes one character from the real hostname to
307 be copied to the final hostname.
308 A '#' in the
309 .Em \&he
310 string causes the next character of the real hostname
311 to be skipped.
312 Each character that
313 is neither '@' nor '#' is copied into the final hostname.
314 Surplus '@' and '#' characters are ignored.
315 .It \&%t
316 The tty name.
317 .It "\&%m, \&%r, \&%s, \&%v"
318 The type of machine, release of the operating system, name of the
319 operating system, and version of the kernel, respectively, as
320 returned by
321 .Xr uname 3 .
322 .It \&%%
323 A
324 .Dq %
325 character.
326 .El
327 .Pp
328 When getty execs the login process, given
329 in the
330 .Em \&lo
331 string (usually
332 .Dq Pa /usr/bin/login ) ,
333 it will have set
334 the environment to include the terminal type, as indicated
335 by the
336 .Em \&tt
337 string (if it exists).
338 The
339 .Em \&ev
340 string, can be used to enter additional data into
341 the environment.
342 It is a list of comma separated strings, each of which
343 will presumably be of the form
344 .Em name=value .
345 .Pp
346 If a non-zero timeout is specified, with
347 .Em \&to ,
348 then getty will exit within the indicated
349 number of seconds, either having
350 received a login name and passed control
351 to
352 .Xr login 1 ,
353 or having received an alarm signal, and exited.
354 This may be useful to hangup dial in lines.
355 .Pp
356 Output from
357 .Xr getty 8
358 is even parity unless
359 .Em \&op
360 or
361 .Em \&np
362 is specified.
363 The
364 .Em \&op
365 string
366 may be specified with
367 .Em \&ap
368 to allow any parity on input, but generate odd parity output.
369 Note: this only applies while getty is being run,
370 terminal driver limitations prevent a more complete
371 implementation.
372 .Xr Getty 8
373 does not check parity of input characters in
374 .Dv RAW
375 mode.
376 .Pp
377 If
378 .Em \&pp
379 string is specified and a PPP link bring up sequence is recognized,
380 getty will invoke the program referenced by the pp option.  This
381 can be used to handle incoming PPP calls.
382 .Pp
383 .Nm Getty
384 provides some basic intelligent modem handling by providing a chat
385 script feature available via two capabilities:
386 .Pp
387 .Bl -tag -offset indent -width \&xxxxxxxx -compact
388 .It ic
389 Chat script to initialize modem.
390 .It ac
391 Chat script to answer a call.
392 .El
393 .Pp
394 A chat script is a set of expect/send string pairs.
395 When a chat string starts,
396 .Nm getty
397 will wait for the first string, and if it finds it, will send the
398 second, and so on.
399 Strings specified are separated by one or more tabs or spaces.
400 Strings may contain standard ASCII characters and special 'escapes',
401 which consist of a backslash character followed by one or more
402 characters which are interpreted as follows:
403 .Pp
404 .Bl -tag -offset indent -width \&xxxxxxxx -compact
405 .It \ea
406 bell character.
407 .It \eb
408 backspace.
409 .It \en
410 newline.
411 .It \ee
412 escape.
413 .It \ef
414 formfeed.
415 .It \ep
416 half-second pause.
417 .It \er
418 carriage return.
419 .It \eS , \es
420 space character.
421 .It \et
422 tab.
423 .It \exNN
424 hexadecimal byte value.
425 .It \e0NNN
426 octal byte value.
427 .El
428 .Pp
429 Note that the
430 .Ql \ep
431 sequence is only valid for send strings and causes a half-second
432 pause between sending the previous and next characters.
433 Hexadecimal values are, at most, 2 hex digits long, and octal
434 values are a maximum of 3 octal digits.
435 .Pp
436 The
437 .Em \&ic
438 chat sequence is used to initialize a modem or similar device.
439 A typical example of an init chat script for a modem with a
440 hayes compatible command set might look like this:
441 .Pp
442 .Dl :ic="" ATE0Q0V1\er OK\er ATS0=0\er OK\er:
443 .Pp
444 This script waits for nothing (which always succeeds), sends
445 a sequence to ensure that the modem is in the correct mode
446 (suppress command echo, send responses in verbose mode),
447 and then disables auto-answer.
448 It waits for an "OK" response before it terminates.
449 The init sequence is used to check modem responses to ensure that
450 the modem is functioning correctly.
451 If the init script fails to complete,
452 .Nm getty
453 considers this to be fatal, and results in an error logged via
454 .Xr syslogd 8 ,
455 and exiting.
456 .Pp
457 Similarly, an answer chat script is used to manually answer the
458 phone in response to (usually) a "RING".
459 When run with an answer script,
460 .Nm getty
461 opens the port in non-blocking mode, clears any extraneous input
462 and waits for data on the port.
463 As soon as any data is available, the answer chat script is
464 started and scanned for a string, and responds according to
465 the answer chat script.
466 With a hayes compatible modem, this would normally look something
467 like:
468 .Pp
469 .Dl :ac=RING\er ATA\er CONNECT:
470 .Pp
471 This causes the modem to answer the call via the "ATA" command,
472 then scans input for a "CONNECT" string.
473 If this is received before a
474 .Em \&ct timeout, then a normal login sequence commences.
475 .Pp
476 The
477 .Em \&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 .Em \&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 form 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 .Em \&he
518 capability is stupid.
519 .Pp
520 The
521 .Xr termcap 5
522 format is horrid, something more rational should
523 have been chosen.