11541Srgrimes/*-
21541Srgrimes * Copyright (c) 1982, 1986, 1993
31541Srgrimes *	The Regents of the University of California.  All rights reserved.
41541Srgrimes * (c) UNIX System Laboratories, Inc.
51541Srgrimes * All or some portions of this file are derived from material licensed
61541Srgrimes * to the University of California by American Telephone and Telegraph
71541Srgrimes * Co. or Unix System Laboratories, Inc. and are reproduced herein with
81541Srgrimes * the permission of UNIX System Laboratories, Inc.
91541Srgrimes *
101541Srgrimes * Redistribution and use in source and binary forms, with or without
111541Srgrimes * modification, are permitted provided that the following conditions
121541Srgrimes * are met:
131541Srgrimes * 1. Redistributions of source code must retain the above copyright
141541Srgrimes *    notice, this list of conditions and the following disclaimer.
151541Srgrimes * 2. Redistributions in binary form must reproduce the above copyright
161541Srgrimes *    notice, this list of conditions and the following disclaimer in the
171541Srgrimes *    documentation and/or other materials provided with the distribution.
181541Srgrimes * 4. Neither the name of the University nor the names of its contributors
191541Srgrimes *    may be used to endorse or promote products derived from this software
201541Srgrimes *    without specific prior written permission.
211541Srgrimes *
221541Srgrimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
231541Srgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
241541Srgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
251541Srgrimes * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
261541Srgrimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
271541Srgrimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
281541Srgrimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
291541Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
301541Srgrimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
311541Srgrimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
321541Srgrimes * SUCH DAMAGE.
331541Srgrimes *
341541Srgrimes *	@(#)ttydefaults.h	8.4 (Berkeley) 1/21/94
3550477Speter * $FreeBSD$
361541Srgrimes */
371541Srgrimes
381541Srgrimes/*
391541Srgrimes * System wide defaults for terminal state.
401541Srgrimes */
411541Srgrimes#ifndef _SYS_TTYDEFAULTS_H_
421541Srgrimes#define	_SYS_TTYDEFAULTS_H_
431541Srgrimes
441541Srgrimes/*
451541Srgrimes * Defaults on "first" open.
461541Srgrimes */
472983Sache#define	TTYDEF_IFLAG	(BRKINT	| ICRNL	| IMAXBEL | IXON | IXANY)
48135292Sphk#define	TTYDEF_OFLAG	(OPOST | ONLCR)
49137167Sphk#define	TTYDEF_LFLAG_NOECHO (ICANON | ISIG | IEXTEN)
50137167Sphk#define	TTYDEF_LFLAG_ECHO (TTYDEF_LFLAG_NOECHO \
51137167Sphk	| ECHO | ECHOE | ECHOKE | ECHOCTL)
52137167Sphk#define	TTYDEF_LFLAG TTYDEF_LFLAG_ECHO
532983Sache#define	TTYDEF_CFLAG	(CREAD | CS8 | HUPCL)
54135292Sphk#define	TTYDEF_SPEED	(B9600)
551541Srgrimes
561541Srgrimes/*
571541Srgrimes * Control Character Defaults
581541Srgrimes */
59179567Sed/*
60179567Sed * XXX: A lot of code uses lowercase characters, but control-character
61179567Sed * conversion is actually only valid when applied to uppercase
62179567Sed * characters. We just treat lowercase characters as if they were
63179567Sed * inserted as uppercase.
64179567Sed */
65179567Sed#define	CTRL(x) ((x) >= 'a' && (x) <= 'z' ? \
66179567Sed	((x) - 'a' + 1) : (((x) - 'A' + 1) & 0x7f))
67179567Sed#define	CEOF		CTRL('D')
688449Sbde#define	CEOL		0xff		/* XXX avoid _POSIX_VDISABLE */
69179567Sed#define	CERASE		CTRL('?')
70179567Sed#define	CERASE2		CTRL('H')
71179567Sed#define	CINTR		CTRL('C')
72179567Sed#define	CSTATUS		CTRL('T')
73179567Sed#define	CKILL		CTRL('U')
741541Srgrimes#define	CMIN		1
75179567Sed#define	CQUIT		CTRL('\\')
76179567Sed#define	CSUSP		CTRL('Z')
771541Srgrimes#define	CTIME		0
78179567Sed#define	CDSUSP		CTRL('Y')
79179567Sed#define	CSTART		CTRL('Q')
80179567Sed#define	CSTOP		CTRL('S')
81179567Sed#define	CLNEXT		CTRL('V')
82231095Sed#define	CDISCARD	CTRL('O')
83231095Sed#define	CWERASE		CTRL('W')
84231095Sed#define	CREPRINT	CTRL('R')
851541Srgrimes#define	CEOT		CEOF
861541Srgrimes/* compat */
871541Srgrimes#define	CBRK		CEOL
88135292Sphk#define	CRPRNT		CREPRINT
891541Srgrimes#define	CFLUSH		CDISCARD
901541Srgrimes
911541Srgrimes/* PROTECTED INCLUSION ENDS HERE */
921541Srgrimes#endif /* !_SYS_TTYDEFAULTS_H_ */
931541Srgrimes
941541Srgrimes/*
951541Srgrimes * #define TTYDEFCHARS to include an array of default control characters.
961541Srgrimes */
971541Srgrimes#ifdef TTYDEFCHARS
98249311Sed
99249311Sed#include <sys/cdefs.h>
100249311Sed#include <sys/_termios.h>
101249311Sed
102249311Sedstatic const cc_t ttydefchars[] = {
103249311Sed	CEOF, CEOL, CEOL, CERASE, CWERASE, CKILL, CREPRINT, CERASE2, CINTR,
104249311Sed	CQUIT, CSUSP, CDSUSP, CSTART, CSTOP, CLNEXT, CDISCARD, CMIN, CTIME,
105249311Sed	CSTATUS, _POSIX_VDISABLE
1061541Srgrimes};
107249311Sed_Static_assert(sizeof(ttydefchars) / sizeof(cc_t) == NCCS,
108249311Sed    "Size of ttydefchars does not match NCCS");
109249311Sed
1101541Srgrimes#undef TTYDEFCHARS
111249311Sed#endif /* TTYDEFCHARS */
112