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