2 * Copyright (c) 1992, 1993
3 * The Regents of the University of California. All rights reserved.
5 * This code is derived from software contributed to Berkeley by
6 * Christos Zoulas of Cornell University.
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. All advertising materials mentioning features or use of this software
17 * must display the following acknowledgement:
18 * This product includes software developed by the University of
19 * California, Berkeley and its contributors.
20 * 4. Neither the name of the University nor the names of its contributors
21 * may be used to endorse or promote products derived from this software
22 * without specific prior written permission.
24 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
25 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 * @(#)tty.h 8.1 (Berkeley) 6/4/93
37 * $NetBSD: tty.h,v 1.7 1999/09/26 14:37:47 lukem Exp $
42 * el.tty.h: Local terminal header
51 /* Define our own since everyone gets it wrong! */
52 #define CONTROL(A) ((A) & 037)
55 * Aix compatible names
57 # if defined(VWERSE) && !defined(VWERASE)
58 # define VWERASE VWERSE
59 # endif /* VWERSE && !VWERASE */
61 # if defined(VDISCRD) && !defined(VDISCARD)
62 # define VDISCARD VDISCRD
63 # endif /* VDISCRD && !VDISCARD */
65 # if defined(VFLUSHO) && !defined(VDISCARD)
66 # define VDISCARD VFLUSHO
67 # endif /* VFLUSHO && VDISCARD */
69 # if defined(VSTRT) && !defined(VSTART)
71 # endif /* VSTRT && ! VSTART */
73 # if defined(VSTAT) && !defined(VSTATUS)
74 # define VSTATUS VSTAT
75 # endif /* VSTAT && ! VSTATUS */
89 # if defined(OXTABS) && !defined(XTABS)
91 # endif /* OXTABS && !XTABS */
103 # endif /* ECHOCTL */
111 # endif /* EXTPROC */
118 # if defined(VDISABLE) && !defined(_POSIX_VDISABLE)
119 # define _POSIX_VDISABLE VDISABLE
120 # endif /* VDISABLE && ! _POSIX_VDISABLE */
123 * Work around ISC's definition of IEXTEN which is
127 # if defined(IEXTEN) && defined(XCASE)
131 # endif /* IEXTEN == XCASE */
132 # endif /* IEXTEN && XCASE */
133 # if defined(IEXTEN) && !defined(XCASE)
134 # define XCASE IEXTEN
137 # endif /* IEXTEN && !XCASE */
141 * Work around convex weirdness where turning off IEXTEN makes us
142 * lose all postprocessing!
144 #if defined(convex) || defined(__convex__)
145 # if defined(IEXTEN) && IEXTEN != 0
148 # endif /* IEXTEN != 0 */
149 #endif /* convex || __convex__ */
152 * So that we don't lose job control.
158 #ifndef _POSIX_VDISABLE
159 # define _POSIX_VDISABLE ((unsigned char) -1)
160 #endif /* _POSIX_VDISABLE */
162 #if !defined(CREPRINT) && defined(CRPRNT)
163 # define CREPRINT CRPRNT
164 #endif /* !CREPRINT && CRPRNT */
165 #if !defined(CDISCARD) && defined(CFLUSH)
166 # define CDISCARD CFLUSH
167 #endif /* !CDISCARD && CFLUSH */
170 # define CINTR CONTROL('c')
173 # define CQUIT 034 /* ^\ */
176 # define CERASE 0177 /* ^? */
179 # define CKILL CONTROL('u')
182 # define CEOF CONTROL('d')
185 # define CEOL _POSIX_VDISABLE
188 # define CEOL2 _POSIX_VDISABLE
191 # define CSWTCH _POSIX_VDISABLE
194 # define CDSWTCH _POSIX_VDISABLE
197 # define CERASE2 _POSIX_VDISABLE
200 # define CSTART CONTROL('q')
203 # define CSTOP CONTROL('s')
206 # define CSUSP CONTROL('z')
209 # define CDSUSP CONTROL('y')
215 # define CREPRINT _POSIX_VDISABLE
216 # endif /* CREPRINT */
218 # define CDISCARD _POSIX_VDISABLE
219 # endif /* CDISCARD */
221 # define CLNEXT _POSIX_VDISABLE
224 # define CWERASE _POSIX_VDISABLE
225 # endif /* CWERASE */
230 # define CREPRINT CONTROL('r')
231 # endif /* CREPRINT */
233 # define CDISCARD CONTROL('o')
234 # endif /* CDISCARD */
236 # define CLNEXT CONTROL('v')
239 # define CWERASE CONTROL('w')
240 # endif /* CWERASE */
245 # define CSTATUS CONTROL('t')
251 # define CPGOFF CONTROL('m')
254 # define CKILL2 _POSIX_VDISABLE
261 # endif /* masscomp */
271 * Fix for sun inconsistency. On termio VSUSP and the rest of the
272 * ttychars > NCC are defined. So we undefine them.
274 #if defined(TERMIO) || defined(POSIX)
275 # if defined(POSIX) && defined(NCCS)
281 # endif /* POSIX && NCCS */
286 # endif /* NUMCC <= VINTR */
291 # endif /* NUMCC <= VQUIT */
296 # endif /* NUMCC <= VERASE */
301 # endif /* NUMCC <= VKILL */
306 # endif /* NUMCC <= VEOF */
311 # endif /* NUMCC <= VEOL */
316 # endif /* NUMCC <= VEOL2 */
321 # endif /* NUMCC <= VSWTCH */
324 # if NUMCC <= VDSWTCH
326 # endif /* NUMCC <= VDSWTCH */
327 # endif /* VDSWTCH */
329 # if NUMCC <= VERASE2
331 # endif /* NUMCC <= VERASE2 */
332 # endif /* VERASE2 */
336 # endif /* NUMCC <= VSTART */
341 # endif /* NUMCC <= VSTOP */
344 # if NUMCC <= VWERASE
346 # endif /* NUMCC <= VWERASE */
347 # endif /* VWERASE */
351 # endif /* NUMCC <= VSUSP */
356 # endif /* NUMCC <= VDSUSP */
359 # if NUMCC <= VREPRINT
361 # endif /* NUMCC <= VREPRINT */
362 # endif /* VREPRINT */
364 # if NUMCC <= VDISCARD
366 # endif /* NUMCC <= VDISCARD */
367 # endif /* VDISCARD */
371 # endif /* NUMCC <= VLNEXT */
374 # if NUMCC <= VSTATUS
376 # endif /* NUMCC <= VSTATUS */
377 # endif /* VSTATUS */
381 # endif /* NUMCC <= VPAGE */
386 # endif /* NUMCC <= VPGOFF */
391 # endif /* NUMCC <= VKILL2 */
396 # endif /* NUMCC <= VBRK */
401 # endif /* NUMCC <= VMIN */
406 # endif /* NUMCC <= VTIME */
437 #define C_SH(A) (1 << (A))
440 * Terminal dependend data structures
442 #define EX_IO 0 /* while we are executing */
443 #define ED_IO 1 /* while we are editing */
444 #define TS_IO 2 /* new mode from terminal */
445 #define QU_IO 2 /* used only for quoted chars */
446 #define NN_IO 3 /* The number of entries */
459 } ttyperm_t[NN_IO][MD_NN];
461 typedef unsigned char ttychar_t[NN_IO][C_NCC];
463 protected int tty_init(EditLine *);
464 protected void tty_end(EditLine *);
465 protected int tty_stty(EditLine *, int, char**);
466 protected int tty_rawmode(EditLine *);
467 protected int tty_cookedmode(EditLine *);
468 protected int tty_quotemode(EditLine *);
469 protected int tty_noquotemode(EditLine *);
470 protected void tty_bind_char(EditLine *, int);
475 struct termios t_ex, t_ed, t_ts;
480 unsigned char t_vdisable;
484 #endif /* _h_el_tty */