Lines Matching defs:?

0 /* $NetBSD: modes.c,v 1.17 2006/10/16 00:37:55 christos Exp $ */
3 /*-
4 * Copyright (c) 1991, 1993, 1994
5 * The Regents of the University of California. All rights reserved.
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
14 * documentation and/or other materials provided with the distribution.
15 * 3. Neither the name of the University nor the names of its contributors
17 * without specific prior written permission.
21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
29 * SUCH DAMAGE.
32 #include <sys/cdefs.h>
34 #if 0
35 static char sccsid[] = "@(#)modes.c 8.3 (Berkeley) 4/2/94";
37 __RCSID("$NetBSD: modes.c,v 1.17 2006/10/16 00:37:55 christos Exp $");
41 #include <sys/types.h>
43 #include <stddef.h>
44 #include <string.h>
45 #include <stdbool.h>
47 #include "stty.h"
48 #include "extern.h"
63 * options, i.e. "foo" must immediately precede "-foo".
65 const struct modes cmodes[] = {
76 { .name = NULL },
79 const struct specialmodes cspecialmodes[] = {
85 { "-parity", CS8, PARODD | PARENB | CSIZE },
87 { "-evenp", CS8, PARODD | PARENB | CSIZE },
89 { "-oddp", CS8, PARODD | PARENB | CSIZE },
91 { "-pass8", PARENB | CS7, PARODD | CSIZE },
92 { .name = NULL },
95 const struct modes imodes[] = {
111 { .name = NULL },
114 const struct specialmodes ispecialmodes[] = {
115 { "decctlq", 0, IXANY },
116 { "-decctlq", IXANY, 0 },
117 { .name = NULL },
120 const struct modes lmodes[] = {
142 { .name = NULL },
145 const struct specialmodes lspecialmodes[] = {
147 { "-crt", ECHOK, ECHOE|ECHOKE|ECHOCTL },
149 { "-newcrt", ECHOK, ECHOE|ECHOKE|ECHOCTL },
150 { "kerninfo", 0, NOKERNINFO },
151 { "-kerninfo", NOKERNINFO, 0 },
152 { .name = NULL },
155 const struct modes omodes[] = {
162 { .name = NULL },
165 const struct specialmodes ospecialmodes[] = {
166 { "litout", 0, OPOST },
167 { "-litout", OPOST, 0 },
168 { "tabs", 0, OXTABS }, /* "preserve" tabs */
169 { "-tabs", OXTABS, 0 },
170 { .name = NULL },
173 #define CHK(s) (!strcmp(name, s))
177 const struct specialmodes *smp, tcflag_t *f)
181 for (; smp->name; ++smp)
182 if (CHK(smp->name)) {
183 *f &= ~smp->unset;
184 *f |= smp->set;
185 return 1;
188 if ((neg = (*name == '-')))
189 name++;
191 for (; mp->name; ++mp)
192 if (CHK(mp->name)) {
194 *f &= ~mp->flag;
196 *f |= mp->flag;
197 return 1;
200 return 0;
206 const char *name = **argvp;
208 if (modeset(name, cmodes, cspecialmodes, &ip->t.c_cflag))
211 if (modeset(name, imodes, ispecialmodes, &ip->t.c_iflag))
214 if (modeset(name, lmodes, lspecialmodes, &ip->t.c_lflag))
217 if (modeset(name, omodes, ospecialmodes, &ip->t.c_oflag))
220 return 0;
221 out:
222 ip->set = 1;
223 return 1;