xref: /openbsd/libexec/getty/init.c (revision d71246c3)
1 /*	$OpenBSD: init.c,v 1.10 2015/11/06 16:42:30 tedu Exp $	*/
2 
3 /*
4  * Copyright (c) 1983, 1993
5  *	The Regents of the University of California.  All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  * 1. Redistributions of source code must retain the above copyright
11  *    notice, this list of conditions and the following disclaimer.
12  * 2. Redistributions in binary form must reproduce the above copyright
13  *    notice, this list of conditions and the following disclaimer in the
14  *    documentation and/or other materials provided with the distribution.
15  * 3. Neither the name of the University nor the names of its contributors
16  *    may be used to endorse or promote products derived from this software
17  *    without specific prior written permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29  * SUCH DAMAGE.
30  */
31 
32 /*
33  * Getty table initializations.
34  *
35  * Melbourne getty.
36  */
37 #include <termios.h>
38 #include "gettytab.h"
39 #include "pathnames.h"
40 
41 extern	struct termios tmode;
42 extern	char hostname[];
43 
44 struct	gettystrs gettystrs[] = {
45 	{ "nx" },			/* next table */
46 	{ "cl" },			/* screen clear characters */
47 	{ "im" },			/* initial message */
48 	{ "lm", "login: " },		/* login message */
49 	{ "er", &tmode.c_cc[VERASE] },	/* erase character */
50 	{ "kl", &tmode.c_cc[VKILL] },	/* kill character */
51 	{ "et", &tmode.c_cc[VEOF] },	/* eof character (eot) */
52 	{ "pc", "" },			/* pad character */
53 	{ "tt" },			/* terminal type */
54 	{ "ev" },			/* environment */
55 	{ "lo", _PATH_LOGIN },		/* login program */
56 	{ "hn", hostname },		/* host name */
57 	{ "he" },			/* host name edit */
58 	{ "in", &tmode.c_cc[VINTR] },	/* interrupt char */
59 	{ "qu", &tmode.c_cc[VQUIT] },	/* quit char */
60 	{ "xn", &tmode.c_cc[VSTART] },	/* XON (start) char */
61 	{ "xf", &tmode.c_cc[VSTOP] },	/* XOFF (stop) char */
62 	{ "bk", &tmode.c_cc[VEOL] },	/* brk char (alt \n) */
63 	{ "su", &tmode.c_cc[VSUSP] },	/* suspend char */
64 	{ "ds", &tmode.c_cc[VDSUSP] },	/* delayed suspend */
65 	{ "rp", &tmode.c_cc[VREPRINT] },/* reprint char */
66 	{ "fl", &tmode.c_cc[VDISCARD] },/* flush output */
67 	{ "we", &tmode.c_cc[VWERASE] },	/* word erase */
68 	{ "ln", &tmode.c_cc[VLNEXT] },	/* literal next */
69 	{ 0 }
70 };
71 
72 struct	gettynums gettynums[] = {
73 	{ "is" },			/* input speed */
74 	{ "os" },			/* output speed */
75 	{ "sp" },			/* both speeds */
76 	{ "nd" },			/* newline delay */
77 	{ "cd" },			/* carriage-return delay */
78 	{ "td" },			/* tab delay */
79 	{ "fd" },			/* form-feed delay */
80 	{ "bd" },			/* backspace delay */
81 	{ "to" },			/* timeout */
82 	{ "pf" },			/* delay before flush at 1st prompt */
83 	{ "c0" },			/* output c_flags */
84 	{ "c1" },			/* input c_flags */
85 	{ "c2" },			/* user mode c_flags */
86 	{ "i0" },			/* output i_flags */
87 	{ "i1" },			/* input i_flags */
88 	{ "i2" },			/* user mode i_flags */
89 	{ "l0" },			/* output l_flags */
90 	{ "l1" },			/* input l_flags */
91 	{ "l2" },			/* user mode l_flags */
92 	{ "o0" },			/* output o_flags */
93 	{ "o1" },			/* input o_flags */
94 	{ "o2" },			/* user mode o_flags */
95 	{ 0 }
96 };
97 
98 struct	gettyflags gettyflags[] = {
99 	{ "ht",	0 },			/* has tabs */
100 	{ "nl",	1 },			/* has newline char */
101 	{ "ep",	0 },			/* even parity */
102 	{ "op",	0 },			/* odd parity */
103 	{ "ap",	0 },			/* any parity */
104 	{ "ec",	1 },			/* no echo */
105 	{ "co",	0 },			/* console special */
106 	{ "cb",	0 },			/* crt backspace */
107 	{ "ck",	1 },			/* crt kill */
108 	{ "ce",	1 },			/* crt erase */
109 	{ "pe",	0 },			/* printer erase */
110 	{ "rw",	1 },			/* don't use raw */
111 	{ "xc",	1 },			/* don't ^X ctl chars */
112 	{ "lc",	0 },			/* terminal has lower case */
113 	{ "uc",	0 },			/* terminal has no lower case */
114 	{ "ig",	0 },			/* ignore garbage */
115 	{ "ps",	0 },			/* do port selector speed select */
116 	{ "hc",	1 },			/* don't set hangup on close */
117 	{ "ub", 0 },			/* unbuffered output */
118 	{ "ab", 0 },			/* auto-baud detect with '\r' */
119 	{ "dx", 0 },			/* set decctlq */
120 	{ "np", 0 },			/* no parity at all (8bit chars) */
121 	{ "mb", 0 },			/* do MDMBUF flow control */
122 	{ 0 }
123 };
124