* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
* This code is derived from software contributed to Berkeley by
* Christos Zoulas of Cornell University.
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* @(#)tty.h 8.1 (Berkeley) 6/4/93
* el.tty.h: Local terminal header
/* Define our own since everyone gets it wrong! */
#define CONTROL(A) ((A) & 037)
# if defined(VWERSE) && !defined(VWERASE)
# endif /* VWERSE && !VWERASE */
# if defined(VDISCRD) && !defined(VDISCARD)
# define VDISCARD VDISCRD
# endif /* VDISCRD && !VDISCARD */
# if defined(VFLUSHO) && !defined(VDISCARD)
# define VDISCARD VFLUSHO
# endif /* VFLUSHO && VDISCARD */
# if defined(VSTRT) && !defined(VSTART)
# endif /* VSTRT && ! VSTART */
# if defined(VSTAT) && !defined(VSTATUS)
# endif /* VSTAT && ! VSTATUS */
# if defined(OXTABS) && !defined(XTABS)
# endif /* OXTABS && !XTABS */
# if defined(VDISABLE) && !defined(_POSIX_VDISABLE)
# define _POSIX_VDISABLE VDISABLE
# endif /* VDISABLE && ! _POSIX_VDISABLE */
* Work around ISC's definition of IEXTEN which is
# if defined(IEXTEN) && defined(XCASE)
# endif /* IEXTEN == XCASE */
# endif /* IEXTEN && XCASE */
# if defined(IEXTEN) && !defined(XCASE)
# endif /* IEXTEN && !XCASE */
* Work around convex weirdness where turning off IEXTEN makes us
* lose all postprocessing!
#if defined(convex) || defined(__convex__)
# if defined(IEXTEN) && IEXTEN != 0
# endif /* IEXTEN != 0 */
#endif /* convex || __convex__ */
# define _POSIX_VDISABLE ((unsigned char) -1)
#endif /* _POSIX_VDISABLE */
#if !defined(CREPRINT) && defined(CRPRNT)
#endif /* !CREPRINT && CRPRNT */
#if !defined(CDISCARD) && defined(CFLUSH)
#endif /* !CDISCARD && CFLUSH */
# define CINTR CONTROL('c')
# define CQUIT 034 /* ^\ */
# define CERASE 0177 /* ^? */
# define CKILL CONTROL('u')
# define CEOF CONTROL('d')
# define CEOL _POSIX_VDISABLE
# define CEOL2 _POSIX_VDISABLE
# define CSWTCH _POSIX_VDISABLE
# define CDSWTCH _POSIX_VDISABLE
# define CERASE2 _POSIX_VDISABLE
# define CSTART CONTROL('q')
# define CSTOP CONTROL('s')
# define CSUSP CONTROL('z')
# define CDSUSP CONTROL('y')
# define CREPRINT _POSIX_VDISABLE
# define CDISCARD _POSIX_VDISABLE
# define CLNEXT _POSIX_VDISABLE
# define CWERASE _POSIX_VDISABLE
# define CREPRINT CONTROL('r')
# define CDISCARD CONTROL('o')
# define CLNEXT CONTROL('v')
# define CWERASE CONTROL('w')
# define CSTATUS CONTROL('t')
# define CPGOFF CONTROL('m')
# define CKILL2 _POSIX_VDISABLE
* Fix for sun inconsistency. On termio VSUSP and the rest of the
* ttychars > NCC are defined. So we undefine them.
#if defined(TERMIO) || defined(POSIX)
# if defined(POSIX) && defined(NCCS)
# endif /* POSIX && NCCS */
# endif /* NUMCC <= VINTR */
# endif /* NUMCC <= VQUIT */
# endif /* NUMCC <= VERASE */
# endif /* NUMCC <= VKILL */
# endif /* NUMCC <= VEOF */
# endif /* NUMCC <= VEOL */
# endif /* NUMCC <= VEOL2 */
# endif /* NUMCC <= VSWTCH */
# endif /* NUMCC <= VDSWTCH */
# endif /* NUMCC <= VERASE2 */
# endif /* NUMCC <= VSTART */
# endif /* NUMCC <= VSTOP */
# endif /* NUMCC <= VWERASE */
# endif /* NUMCC <= VSUSP */
# endif /* NUMCC <= VDSUSP */
# endif /* NUMCC <= VREPRINT */
# endif /* NUMCC <= VDISCARD */
# endif /* NUMCC <= VLNEXT */
# endif /* NUMCC <= VSTATUS */
# endif /* NUMCC <= VPAGE */
# endif /* NUMCC <= VPGOFF */
# endif /* NUMCC <= VKILL2 */
# endif /* NUMCC <= VBRK */
# endif /* NUMCC <= VMIN */
# endif /* NUMCC <= VTIME */
#define C_SH(A) (1 << (A))
* Terminal dependend data structures
#define EX_IO 0 /* while we are executing */
#define ED_IO 1 /* while we are editing */
#define TS_IO 2 /* new mode from terminal */
#define QU_IO 2 /* used only for quoted chars */
#define NN_IO 3 /* The number of entries */
} ttyperm_t
[NN_IO
][M_NN
];
typedef unsigned char ttychar_t
[NN_IO
][C_NCC
];
protected int tty_init
__P((EditLine
*));
protected void tty_end
__P((EditLine
*));
protected int tty_stty
__P((EditLine
*, int, char**));
protected int tty_rawmode
__P((EditLine
*));
protected int tty_cookedmode
__P((EditLine
*));
protected int tty_quotemode
__P((EditLine
*));
protected int tty_noquotemode
__P((EditLine
*));
protected void tty_bind_char
__P((EditLine
*, int));
struct termios t_ex
, t_ed
, t_ts
;
unsigned char t_vdisable
;