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