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