1a9643ea8Slogwang /*- 2*22ce4affSfengbojiang * SPDX-License-Identifier: BSD-3-Clause 3*22ce4affSfengbojiang * 4a9643ea8Slogwang * Copyright (c) 1982, 1986, 1993 5a9643ea8Slogwang * The Regents of the University of California. All rights reserved. 6a9643ea8Slogwang * (c) UNIX System Laboratories, Inc. 7a9643ea8Slogwang * All or some portions of this file are derived from material licensed 8a9643ea8Slogwang * to the University of California by American Telephone and Telegraph 9a9643ea8Slogwang * Co. or Unix System Laboratories, Inc. and are reproduced herein with 10a9643ea8Slogwang * the permission of UNIX System Laboratories, Inc. 11a9643ea8Slogwang * 12a9643ea8Slogwang * Redistribution and use in source and binary forms, with or without 13a9643ea8Slogwang * modification, are permitted provided that the following conditions 14a9643ea8Slogwang * are met: 15a9643ea8Slogwang * 1. Redistributions of source code must retain the above copyright 16a9643ea8Slogwang * notice, this list of conditions and the following disclaimer. 17a9643ea8Slogwang * 2. Redistributions in binary form must reproduce the above copyright 18a9643ea8Slogwang * notice, this list of conditions and the following disclaimer in the 19a9643ea8Slogwang * documentation and/or other materials provided with the distribution. 20*22ce4affSfengbojiang * 3. Neither the name of the University nor the names of its contributors 21a9643ea8Slogwang * may be used to endorse or promote products derived from this software 22a9643ea8Slogwang * without specific prior written permission. 23a9643ea8Slogwang * 24a9643ea8Slogwang * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 25a9643ea8Slogwang * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 26a9643ea8Slogwang * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 27a9643ea8Slogwang * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 28a9643ea8Slogwang * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 29a9643ea8Slogwang * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 30a9643ea8Slogwang * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 31a9643ea8Slogwang * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 32a9643ea8Slogwang * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 33a9643ea8Slogwang * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 34a9643ea8Slogwang * SUCH DAMAGE. 35a9643ea8Slogwang * 36a9643ea8Slogwang * @(#)ttydefaults.h 8.4 (Berkeley) 1/21/94 37a9643ea8Slogwang * $FreeBSD$ 38a9643ea8Slogwang */ 39a9643ea8Slogwang 40a9643ea8Slogwang /* 41a9643ea8Slogwang * System wide defaults for terminal state. 42a9643ea8Slogwang */ 43a9643ea8Slogwang #ifndef _SYS_TTYDEFAULTS_H_ 44a9643ea8Slogwang #define _SYS_TTYDEFAULTS_H_ 45a9643ea8Slogwang 46a9643ea8Slogwang /* 47a9643ea8Slogwang * Defaults on "first" open. 48a9643ea8Slogwang */ 49a9643ea8Slogwang #define TTYDEF_IFLAG (BRKINT | ICRNL | IMAXBEL | IXON | IXANY) 50a9643ea8Slogwang #define TTYDEF_OFLAG (OPOST | ONLCR) 51a9643ea8Slogwang #define TTYDEF_LFLAG_NOECHO (ICANON | ISIG | IEXTEN) 52a9643ea8Slogwang #define TTYDEF_LFLAG_ECHO (TTYDEF_LFLAG_NOECHO \ 53a9643ea8Slogwang | ECHO | ECHOE | ECHOKE | ECHOCTL) 54a9643ea8Slogwang #define TTYDEF_LFLAG TTYDEF_LFLAG_ECHO 55a9643ea8Slogwang #define TTYDEF_CFLAG (CREAD | CS8 | HUPCL) 56a9643ea8Slogwang #define TTYDEF_SPEED (B9600) 57a9643ea8Slogwang 58a9643ea8Slogwang /* 59a9643ea8Slogwang * Control Character Defaults 60a9643ea8Slogwang */ 61a9643ea8Slogwang /* 62a9643ea8Slogwang * XXX: A lot of code uses lowercase characters, but control-character 63a9643ea8Slogwang * conversion is actually only valid when applied to uppercase 64a9643ea8Slogwang * characters. We just treat lowercase characters as if they were 65a9643ea8Slogwang * inserted as uppercase. 66a9643ea8Slogwang */ 67a9643ea8Slogwang #define CTRL(x) ((x) >= 'a' && (x) <= 'z' ? \ 68a9643ea8Slogwang ((x) - 'a' + 1) : (((x) - 'A' + 1) & 0x7f)) 69a9643ea8Slogwang #define CEOF CTRL('D') 70a9643ea8Slogwang #define CEOL 0xff /* XXX avoid _POSIX_VDISABLE */ 71a9643ea8Slogwang #define CERASE CTRL('?') 72a9643ea8Slogwang #define CERASE2 CTRL('H') 73a9643ea8Slogwang #define CINTR CTRL('C') 74a9643ea8Slogwang #define CSTATUS CTRL('T') 75a9643ea8Slogwang #define CKILL CTRL('U') 76a9643ea8Slogwang #define CMIN 1 77a9643ea8Slogwang #define CQUIT CTRL('\\') 78a9643ea8Slogwang #define CSUSP CTRL('Z') 79a9643ea8Slogwang #define CTIME 0 80a9643ea8Slogwang #define CDSUSP CTRL('Y') 81a9643ea8Slogwang #define CSTART CTRL('Q') 82a9643ea8Slogwang #define CSTOP CTRL('S') 83a9643ea8Slogwang #define CLNEXT CTRL('V') 84a9643ea8Slogwang #define CDISCARD CTRL('O') 85a9643ea8Slogwang #define CWERASE CTRL('W') 86a9643ea8Slogwang #define CREPRINT CTRL('R') 87a9643ea8Slogwang #define CEOT CEOF 88a9643ea8Slogwang /* compat */ 89a9643ea8Slogwang #define CBRK CEOL 90a9643ea8Slogwang #define CRPRNT CREPRINT 91a9643ea8Slogwang #define CFLUSH CDISCARD 92a9643ea8Slogwang 93a9643ea8Slogwang /* PROTECTED INCLUSION ENDS HERE */ 94a9643ea8Slogwang #endif /* !_SYS_TTYDEFAULTS_H_ */ 95a9643ea8Slogwang 96a9643ea8Slogwang /* 97a9643ea8Slogwang * #define TTYDEFCHARS to include an array of default control characters. 98a9643ea8Slogwang */ 99a9643ea8Slogwang #ifdef TTYDEFCHARS 100a9643ea8Slogwang 101a9643ea8Slogwang #include <sys/cdefs.h> 102a9643ea8Slogwang #include <sys/_termios.h> 103a9643ea8Slogwang 104a9643ea8Slogwang static const cc_t ttydefchars[] = { 105a9643ea8Slogwang CEOF, CEOL, CEOL, CERASE, CWERASE, CKILL, CREPRINT, CERASE2, CINTR, 106a9643ea8Slogwang CQUIT, CSUSP, CDSUSP, CSTART, CSTOP, CLNEXT, CDISCARD, CMIN, CTIME, 107a9643ea8Slogwang CSTATUS, _POSIX_VDISABLE 108a9643ea8Slogwang }; 109a9643ea8Slogwang _Static_assert(sizeof(ttydefchars) / sizeof(cc_t) == NCCS, 110a9643ea8Slogwang "Size of ttydefchars does not match NCCS"); 111a9643ea8Slogwang 112a9643ea8Slogwang #undef TTYDEFCHARS 113a9643ea8Slogwang #endif /* TTYDEFCHARS */ 114