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 * $DragonFly: src/lib/libedit/tty.h,v 1.3 2003/11/12 20:21:29 eirikn Exp $
41 * el.tty.h: Local terminal header
49 /* Define our own since everyone gets it wrong! */
50 #define CONTROL(A) ((A) & 037)
53 * Aix compatible names
55 # if defined(VWERSE) && !defined(VWERASE)
56 # define VWERASE VWERSE
57 # endif /* VWERSE && !VWERASE */
59 # if defined(VDISCRD) && !defined(VDISCARD)
60 # define VDISCARD VDISCRD
61 # endif /* VDISCRD && !VDISCARD */
63 # if defined(VFLUSHO) && !defined(VDISCARD)
64 # define VDISCARD VFLUSHO
65 # endif /* VFLUSHO && VDISCARD */
67 # if defined(VSTRT) && !defined(VSTART)
69 # endif /* VSTRT && ! VSTART */
71 # if defined(VSTAT) && !defined(VSTATUS)
72 # define VSTATUS VSTAT
73 # endif /* VSTAT && ! VSTATUS */
87 # if defined(OXTABS) && !defined(XTABS)
89 # endif /* OXTABS && !XTABS */
101 # endif /* ECHOCTL */
109 # endif /* EXTPROC */
116 # if defined(VDISABLE) && !defined(_POSIX_VDISABLE)
117 # define _POSIX_VDISABLE VDISABLE
118 # endif /* VDISABLE && ! _POSIX_VDISABLE */
121 * Work around ISC's definition of IEXTEN which is
125 # if defined(IEXTEN) && defined(XCASE)
129 # endif /* IEXTEN == XCASE */
130 # endif /* IEXTEN && XCASE */
131 # if defined(IEXTEN) && !defined(XCASE)
132 # define XCASE IEXTEN
135 # endif /* IEXTEN && !XCASE */
139 * Work around convex weirdness where turning off IEXTEN makes us
140 * lose all postprocessing!
142 #if defined(convex) || defined(__convex__)
143 # if defined(IEXTEN) && IEXTEN != 0
146 # endif /* IEXTEN != 0 */
147 #endif /* convex || __convex__ */
150 * So that we don't lose job control.
156 #ifndef _POSIX_VDISABLE
157 # define _POSIX_VDISABLE ((unsigned char) -1)
158 #endif /* _POSIX_VDISABLE */
160 #if !defined(CREPRINT) && defined(CRPRNT)
161 # define CREPRINT CRPRNT
162 #endif /* !CREPRINT && CRPRNT */
163 #if !defined(CDISCARD) && defined(CFLUSH)
164 # define CDISCARD CFLUSH
165 #endif /* !CDISCARD && CFLUSH */
168 # define CINTR CONTROL('c')
171 # define CQUIT 034 /* ^\ */
174 # define CERASE 0177 /* ^? */
177 # define CKILL CONTROL('u')
180 # define CEOF CONTROL('d')
183 # define CEOL _POSIX_VDISABLE
186 # define CEOL2 _POSIX_VDISABLE
189 # define CSWTCH _POSIX_VDISABLE
192 # define CDSWTCH _POSIX_VDISABLE
195 # define CERASE2 _POSIX_VDISABLE
198 # define CSTART CONTROL('q')
201 # define CSTOP CONTROL('s')
204 # define CSUSP CONTROL('z')
207 # define CDSUSP CONTROL('y')
213 # define CREPRINT _POSIX_VDISABLE
214 # endif /* CREPRINT */
216 # define CDISCARD _POSIX_VDISABLE
217 # endif /* CDISCARD */
219 # define CLNEXT _POSIX_VDISABLE
222 # define CWERASE _POSIX_VDISABLE
223 # endif /* CWERASE */
228 # define CREPRINT CONTROL('r')
229 # endif /* CREPRINT */
231 # define CDISCARD CONTROL('o')
232 # endif /* CDISCARD */
234 # define CLNEXT CONTROL('v')
237 # define CWERASE CONTROL('w')
238 # endif /* CWERASE */
243 # define CSTATUS CONTROL('t')
249 # define CPGOFF CONTROL('m')
252 # define CKILL2 _POSIX_VDISABLE
259 # endif /* masscomp */
269 * Fix for sun inconsistency. On termio VSUSP and the rest of the
270 * ttychars > NCC are defined. So we undefine them.
272 #if defined(TERMIO) || defined(POSIX)
273 # if defined(POSIX) && defined(NCCS)
279 # endif /* POSIX && NCCS */
284 # endif /* NUMCC <= VINTR */
289 # endif /* NUMCC <= VQUIT */
294 # endif /* NUMCC <= VERASE */
299 # endif /* NUMCC <= VKILL */
304 # endif /* NUMCC <= VEOF */
309 # endif /* NUMCC <= VEOL */
314 # endif /* NUMCC <= VEOL2 */
319 # endif /* NUMCC <= VSWTCH */
322 # if NUMCC <= VDSWTCH
324 # endif /* NUMCC <= VDSWTCH */
325 # endif /* VDSWTCH */
327 # if NUMCC <= VERASE2
329 # endif /* NUMCC <= VERASE2 */
330 # endif /* VERASE2 */
334 # endif /* NUMCC <= VSTART */
339 # endif /* NUMCC <= VSTOP */
342 # if NUMCC <= VWERASE
344 # endif /* NUMCC <= VWERASE */
345 # endif /* VWERASE */
349 # endif /* NUMCC <= VSUSP */
354 # endif /* NUMCC <= VDSUSP */
357 # if NUMCC <= VREPRINT
359 # endif /* NUMCC <= VREPRINT */
360 # endif /* VREPRINT */
362 # if NUMCC <= VDISCARD
364 # endif /* NUMCC <= VDISCARD */
365 # endif /* VDISCARD */
369 # endif /* NUMCC <= VLNEXT */
372 # if NUMCC <= VSTATUS
374 # endif /* NUMCC <= VSTATUS */
375 # endif /* VSTATUS */
379 # endif /* NUMCC <= VPAGE */
384 # endif /* NUMCC <= VPGOFF */
389 # endif /* NUMCC <= VKILL2 */
394 # endif /* NUMCC <= VBRK */
399 # endif /* NUMCC <= VMIN */
404 # endif /* NUMCC <= VTIME */
435 #define C_SH(A) (1 << (A))
438 * Terminal dependend data structures
440 #define EX_IO 0 /* while we are executing */
441 #define ED_IO 1 /* while we are editing */
442 #define TS_IO 2 /* new mode from terminal */
443 #define QU_IO 2 /* used only for quoted chars */
444 #define NN_IO 3 /* The number of entries */
457 } ttyperm_t[NN_IO][M_NN];
459 typedef unsigned char ttychar_t[NN_IO][C_NCC];
461 protected int tty_init (EditLine *);
462 protected void tty_end (EditLine *);
463 protected int tty_stty (EditLine *, int, char**);
464 protected int tty_rawmode (EditLine *);
465 protected int tty_cookedmode (EditLine *);
466 protected int tty_quotemode (EditLine *);
467 protected int tty_noquotemode (EditLine *);
468 protected void tty_bind_char (EditLine *, int);
473 struct termios t_ex, t_ed, t_ts;
478 unsigned char t_vdisable;
482 #endif /* _h_el_tty */