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