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