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