1
/* $NetBSD: tty.h,v 1.13 2011/08/16 16:25:15 christos Exp $ */
4
* Copyright (c) 1992, 1993
5
* The Regents of the University of California. All rights reserved.
7
* This code is derived from software contributed to Berkeley by
8
* Christos Zoulas of Cornell University.
10
* Redistribution and use in source and binary forms, with or without
11
* modification, are permitted provided that the following conditions
13
* 1. Redistributions of source code must retain the above copyright
14
* notice, this list of conditions and the following disclaimer.
15
* 2. Redistributions in binary form must reproduce the above copyright
16
* notice, this list of conditions and the following disclaimer in the
17
* documentation and/or other materials provided with the distribution.
18
* 3. Neither the name of the University nor the names of its contributors
19
* may be used to endorse or promote products derived from this software
20
* without specific prior written permission.
22
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34
* @(#)tty.h 8.1 (Berkeley) 6/4/93
38
* el.tty.h: Local terminal header
48
/* Define our own since everyone gets it wrong! */
49
#define CONTROL(A) ((A) & 037)
52
* Aix compatible names
54
# if defined(VWERSE) && !defined(VWERASE)
55
# define VWERASE VWERSE
56
# endif /* VWERSE && !VWERASE */
58
# if defined(VDISCRD) && !defined(VDISCARD)
59
# define VDISCARD VDISCRD
60
# endif /* VDISCRD && !VDISCARD */
62
# if defined(VFLUSHO) && !defined(VDISCARD)
63
# define VDISCARD VFLUSHO
64
# endif /* VFLUSHO && VDISCARD */
66
# if defined(VSTRT) && !defined(VSTART)
68
# endif /* VSTRT && ! VSTART */
70
# if defined(VSTAT) && !defined(VSTATUS)
71
# define VSTATUS VSTAT
72
# endif /* VSTAT && ! VSTATUS */
86
# if defined(OXTABS) && !defined(XTABS)
88
# endif /* OXTABS && !XTABS */
100
# endif /* ECHOCTL */
108
# endif /* EXTPROC */
115
# if defined(VDISABLE) && !defined(_POSIX_VDISABLE)
116
# define _POSIX_VDISABLE VDISABLE
117
# endif /* VDISABLE && ! _POSIX_VDISABLE */
120
* Work around ISC's definition of IEXTEN which is
124
# if defined(IEXTEN) && defined(XCASE)
128
# endif /* IEXTEN == XCASE */
129
# endif /* IEXTEN && XCASE */
130
# if defined(IEXTEN) && !defined(XCASE)
131
# define XCASE IEXTEN
134
# endif /* IEXTEN && !XCASE */
138
* Work around convex weirdness where turning off IEXTEN makes us
139
* lose all postprocessing!
141
#if defined(convex) || defined(__convex__)
142
# if defined(IEXTEN) && IEXTEN != 0
145
# endif /* IEXTEN != 0 */
146
#endif /* convex || __convex__ */
149
* So that we don't lose job control.
155
#ifndef _POSIX_VDISABLE
156
# define _POSIX_VDISABLE ((unsigned char) -1)
157
#endif /* _POSIX_VDISABLE */
159
#if !defined(CREPRINT) && defined(CRPRNT)
160
# define CREPRINT CRPRNT
161
#endif /* !CREPRINT && CRPRNT */
162
#if !defined(CDISCARD) && defined(CFLUSH)
163
# define CDISCARD CFLUSH
164
#endif /* !CDISCARD && CFLUSH */
167
# define CINTR CONTROL('c')
170
# define CQUIT 034 /* ^\ */
173
# define CERASE 0177 /* ^? */
176
# define CKILL CONTROL('u')
179
# define CEOF CONTROL('d')
182
# define CEOL _POSIX_VDISABLE
185
# define CEOL2 _POSIX_VDISABLE
188
# define CSWTCH _POSIX_VDISABLE
191
# define CDSWTCH _POSIX_VDISABLE
194
# define CERASE2 _POSIX_VDISABLE
197
# define CSTART CONTROL('q')
200
# define CSTOP CONTROL('s')
203
# define CSUSP CONTROL('z')
206
# define CDSUSP CONTROL('y')
212
# define CREPRINT _POSIX_VDISABLE
213
# endif /* CREPRINT */
215
# define CDISCARD _POSIX_VDISABLE
216
# endif /* CDISCARD */
218
# define CLNEXT _POSIX_VDISABLE
221
# define CWERASE _POSIX_VDISABLE
222
# endif /* CWERASE */
227
# define CREPRINT CONTROL('r')
228
# endif /* CREPRINT */
230
# define CDISCARD CONTROL('o')
231
# endif /* CDISCARD */
233
# define CLNEXT CONTROL('v')
236
# define CWERASE CONTROL('w')
237
# endif /* CWERASE */
242
# define CSTATUS CONTROL('t')
248
# define CPGOFF CONTROL('m')
251
# define CKILL2 _POSIX_VDISABLE
258
# endif /* masscomp */
268
* Fix for sun inconsistency. On termio VSUSP and the rest of the
269
* ttychars > NCC are defined. So we undefine them.
271
#if defined(TERMIO) || defined(POSIX)
272
# if defined(POSIX) && defined(NCCS)
278
# endif /* POSIX && NCCS */
283
# endif /* NUMCC <= VINTR */
288
# endif /* NUMCC <= VQUIT */
293
# endif /* NUMCC <= VERASE */
298
# endif /* NUMCC <= VKILL */
303
# endif /* NUMCC <= VEOF */
308
# endif /* NUMCC <= VEOL */
313
# endif /* NUMCC <= VEOL2 */
318
# endif /* NUMCC <= VSWTCH */
321
# if NUMCC <= VDSWTCH
323
# endif /* NUMCC <= VDSWTCH */
324
# endif /* VDSWTCH */
326
# if NUMCC <= VERASE2
328
# endif /* NUMCC <= VERASE2 */
329
# endif /* VERASE2 */
333
# endif /* NUMCC <= VSTART */
338
# endif /* NUMCC <= VSTOP */
341
# if NUMCC <= VWERASE
343
# endif /* NUMCC <= VWERASE */
344
# endif /* VWERASE */
348
# endif /* NUMCC <= VSUSP */
353
# endif /* NUMCC <= VDSUSP */
356
# if NUMCC <= VREPRINT
358
# endif /* NUMCC <= VREPRINT */
359
# endif /* VREPRINT */
361
# if NUMCC <= VDISCARD
363
# endif /* NUMCC <= VDISCARD */
364
# endif /* VDISCARD */
368
# endif /* NUMCC <= VLNEXT */
371
# if NUMCC <= VSTATUS
373
# endif /* NUMCC <= VSTATUS */
374
# endif /* VSTATUS */
378
# endif /* NUMCC <= VPAGE */
383
# endif /* NUMCC <= VPGOFF */
388
# endif /* NUMCC <= VKILL2 */
393
# endif /* NUMCC <= VBRK */
398
# endif /* NUMCC <= VMIN */
403
# endif /* NUMCC <= VTIME */
434
#define C_SH(A) ((unsigned int)(1 << (A)))
437
* Terminal dependend data structures
439
#define EX_IO 0 /* while we are executing */
440
#define ED_IO 1 /* while we are editing */
441
#define TS_IO 2 /* new mode from terminal */
442
#define QU_IO 2 /* used only for quoted chars */
443
#define NN_IO 3 /* The number of entries */
454
unsigned int t_setmask;
455
unsigned int t_clrmask;
456
} ttyperm_t[NN_IO][MD_NN];
458
typedef unsigned char ttychar_t[NN_IO][C_NCC];
460
protected int tty_init(EditLine *);
461
protected void tty_end(EditLine *);
462
protected int tty_stty(EditLine *, int, const Char **);
463
protected int tty_rawmode(EditLine *);
464
protected int tty_cookedmode(EditLine *);
465
protected int tty_quotemode(EditLine *);
466
protected int tty_noquotemode(EditLine *);
467
protected void tty_bind_char(EditLine *, int);
472
struct termios t_ex, t_ed, t_ts;
477
unsigned char t_vdisable;
481
#endif /* _h_el_tty */