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