xref: /openbsd/libexec/getty/init.c (revision 404b540a)
1 /*	$OpenBSD: init.c,v 1.6 2003/06/02 19:38:24 millert 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 #ifndef lint
33 /*static char sccsid[] = "from: @(#)init.c	8.1 (Berkeley) 6/4/93";*/
34 static char rcsid[] = "$OpenBSD: init.c,v 1.6 2003/06/02 19:38:24 millert Exp $";
35 #endif /* not lint */
36 
37 /*
38  * Getty table initializations.
39  *
40  * Melbourne getty.
41  */
42 #include <termios.h>
43 #include "gettytab.h"
44 #include "pathnames.h"
45 
46 extern	struct termios tmode;
47 extern	char hostname[];
48 
49 struct	gettystrs gettystrs[] = {
50 	{ "nx" },			/* next table */
51 	{ "cl" },			/* screen clear characters */
52 	{ "im" },			/* initial message */
53 	{ "lm", "login: " },		/* login message */
54 	{ "er", &tmode.c_cc[VERASE] },	/* erase character */
55 	{ "kl", &tmode.c_cc[VKILL] },	/* kill character */
56 	{ "et", &tmode.c_cc[VEOF] },	/* eof character (eot) */
57 	{ "pc", "" },			/* pad character */
58 	{ "tt" },			/* terminal type */
59 	{ "ev" },			/* environment */
60 	{ "lo", _PATH_LOGIN },		/* login program */
61 	{ "hn", hostname },		/* host name */
62 	{ "he" },			/* host name edit */
63 	{ "in", &tmode.c_cc[VINTR] },	/* interrupt char */
64 	{ "qu", &tmode.c_cc[VQUIT] },	/* quit char */
65 	{ "xn", &tmode.c_cc[VSTART] },	/* XON (start) char */
66 	{ "xf", &tmode.c_cc[VSTOP] },	/* XOFF (stop) char */
67 	{ "bk", &tmode.c_cc[VEOL] },	/* brk char (alt \n) */
68 	{ "su", &tmode.c_cc[VSUSP] },	/* suspend char */
69 	{ "ds", &tmode.c_cc[VDSUSP] },	/* delayed suspend */
70 	{ "rp", &tmode.c_cc[VREPRINT] },/* reprint char */
71 	{ "fl", &tmode.c_cc[VDISCARD] },/* flush output */
72 	{ "we", &tmode.c_cc[VWERASE] },	/* word erase */
73 	{ "ln", &tmode.c_cc[VLNEXT] },	/* literal next */
74 	{ "pp" },			/* ppp login program */
75 	{ 0 }
76 };
77 
78 struct	gettynums gettynums[] = {
79 	{ "is" },			/* input speed */
80 	{ "os" },			/* output speed */
81 	{ "sp" },			/* both speeds */
82 	{ "nd" },			/* newline delay */
83 	{ "cd" },			/* carriage-return delay */
84 	{ "td" },			/* tab delay */
85 	{ "fd" },			/* form-feed delay */
86 	{ "bd" },			/* backspace delay */
87 	{ "to" },			/* timeout */
88 	{ "f0" },			/* output flags */
89 	{ "f1" },			/* input flags */
90 	{ "f2" },			/* user mode flags */
91 	{ "pf" },			/* delay before flush at 1st prompt */
92 	{ "c0" },			/* output c_flags */
93 	{ "c1" },			/* input c_flags */
94 	{ "c2" },			/* user mode c_flags */
95 	{ "i0" },			/* output i_flags */
96 	{ "i1" },			/* input i_flags */
97 	{ "i2" },			/* user mode i_flags */
98 	{ "l0" },			/* output l_flags */
99 	{ "l1" },			/* input l_flags */
100 	{ "l2" },			/* user mode l_flags */
101 	{ "o0" },			/* output o_flags */
102 	{ "o1" },			/* input o_flags */
103 	{ "o2" },			/* user mode o_flags */
104 	{ 0 }
105 };
106 
107 struct	gettyflags gettyflags[] = {
108 	{ "ht",	0 },			/* has tabs */
109 	{ "nl",	1 },			/* has newline char */
110 	{ "ep",	0 },			/* even parity */
111 	{ "op",	0 },			/* odd parity */
112 	{ "ap",	0 },			/* any parity */
113 	{ "ec",	1 },			/* no echo */
114 	{ "co",	0 },			/* console special */
115 	{ "cb",	0 },			/* crt backspace */
116 	{ "ck",	1 },			/* crt kill */
117 	{ "ce",	1 },			/* crt erase */
118 	{ "pe",	0 },			/* printer erase */
119 	{ "rw",	1 },			/* don't use raw */
120 	{ "xc",	1 },			/* don't ^X ctl chars */
121 	{ "lc",	0 },			/* terminal las lower case */
122 	{ "uc",	0 },			/* terminal has no lower case */
123 	{ "ig",	0 },			/* ignore garbage */
124 	{ "ps",	0 },			/* do port selector speed select */
125 	{ "hc",	1 },			/* don't set hangup on close */
126 	{ "ub", 0 },			/* unbuffered output */
127 	{ "ab", 0 },			/* auto-baud detect with '\r' */
128 	{ "dx", 0 },			/* set decctlq */
129 	{ "np", 0 },			/* no parity at all (8bit chars) */
130 	{ "mb", 0 },			/* do MDMBUF flow control */
131 	{ 0 }
132 };
133