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