MySQL 5.6.14 Source Code Document
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
tty.h
1
/* $NetBSD: tty.h,v 1.13 2011/08/16 16:25:15 christos Exp $ */
2
3
/*-
4
* Copyright (c) 1992, 1993
5
* The Regents of the University of California. All rights reserved.
6
*
7
* This code is derived from software contributed to Berkeley by
8
* Christos Zoulas of Cornell University.
9
*
10
* Redistribution and use in source and binary forms, with or without
11
* modification, are permitted provided that the following conditions
12
* are met:
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.
21
*
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
32
* SUCH DAMAGE.
33
*
34
* @(#)tty.h 8.1 (Berkeley) 6/4/93
35
*/
36
37
/*
38
* el.tty.h: Local terminal header
39
*/
40
#ifndef _h_el_tty
41
#define _h_el_tty
42
43
#include "sys.h"
44
#include "histedit.h"
45
#include <termios.h>
46
#include <unistd.h>
47
48
/* Define our own since everyone gets it wrong! */
49
#define CONTROL(A) ((A) & 037)
50
51
/*
52
* Aix compatible names
53
*/
54
# if defined(VWERSE) && !defined(VWERASE)
55
# define VWERASE VWERSE
56
# endif
/* VWERSE && !VWERASE */
57
58
# if defined(VDISCRD) && !defined(VDISCARD)
59
# define VDISCARD VDISCRD
60
# endif
/* VDISCRD && !VDISCARD */
61
62
# if defined(VFLUSHO) && !defined(VDISCARD)
63
# define VDISCARD VFLUSHO
64
# endif
/* VFLUSHO && VDISCARD */
65
66
# if defined(VSTRT) && !defined(VSTART)
67
# define VSTART VSTRT
68
# endif
/* VSTRT && ! VSTART */
69
70
# if defined(VSTAT) && !defined(VSTATUS)
71
# define VSTATUS VSTAT
72
# endif
/* VSTAT && ! VSTATUS */
73
74
# ifndef ONLRET
75
# define ONLRET 0
76
# endif
/* ONLRET */
77
78
# ifndef TAB3
79
# ifdef OXTABS
80
# define TAB3 OXTABS
81
# else
82
# define TAB3 0
83
# endif
/* OXTABS */
84
# endif
/* !TAB3 */
85
86
# if defined(OXTABS) && !defined(XTABS)
87
# define XTABS OXTABS
88
# endif
/* OXTABS && !XTABS */
89
90
# ifndef ONLCR
91
# define ONLCR 0
92
# endif
/* ONLCR */
93
94
# ifndef IEXTEN
95
# define IEXTEN 0
96
# endif
/* IEXTEN */
97
98
# ifndef ECHOCTL
99
# define ECHOCTL 0
100
# endif
/* ECHOCTL */
101
102
# ifndef PARENB
103
# define PARENB 0
104
# endif
/* PARENB */
105
106
# ifndef EXTPROC
107
# define EXTPROC 0
108
# endif
/* EXTPROC */
109
110
# ifndef FLUSHO
111
# define FLUSHO 0
112
# endif
/* FLUSHO */
113
114
115
# if defined(VDISABLE) && !defined(_POSIX_VDISABLE)
116
# define _POSIX_VDISABLE VDISABLE
117
# endif
/* VDISABLE && ! _POSIX_VDISABLE */
118
119
/*
120
* Work around ISC's definition of IEXTEN which is
121
* XCASE!
122
*/
123
# ifdef ISC
124
# if defined(IEXTEN) && defined(XCASE)
125
# if IEXTEN == XCASE
126
# undef IEXTEN
127
# define IEXTEN 0
128
# endif
/* IEXTEN == XCASE */
129
# endif
/* IEXTEN && XCASE */
130
# if defined(IEXTEN) && !defined(XCASE)
131
# define XCASE IEXTEN
132
# undef IEXTEN
133
# define IEXTEN 0
134
# endif
/* IEXTEN && !XCASE */
135
# endif
/* ISC */
136
137
/*
138
* Work around convex weirdness where turning off IEXTEN makes us
139
* lose all postprocessing!
140
*/
141
#if defined(convex) || defined(__convex__)
142
# if defined(IEXTEN) && IEXTEN != 0
143
# undef IEXTEN
144
# define IEXTEN 0
145
# endif
/* IEXTEN != 0 */
146
#endif
/* convex || __convex__ */
147
148
/*
149
* So that we don't lose job control.
150
*/
151
#ifdef __SVR4
152
# undef CSWTCH
153
#endif
154
155
#ifndef _POSIX_VDISABLE
156
# define _POSIX_VDISABLE ((unsigned char) -1)
157
#endif
/* _POSIX_VDISABLE */
158
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 */
165
166
#ifndef CINTR
167
# define CINTR CONTROL('c')
168
#endif
/* CINTR */
169
#ifndef CQUIT
170
# define CQUIT 034
/* ^\ */
171
#endif
/* CQUIT */
172
#ifndef CERASE
173
# define CERASE 0177
/* ^? */
174
#endif
/* CERASE */
175
#ifndef CKILL
176
# define CKILL CONTROL('u')
177
#endif
/* CKILL */
178
#ifndef CEOF
179
# define CEOF CONTROL('d')
180
#endif
/* CEOF */
181
#ifndef CEOL
182
# define CEOL _POSIX_VDISABLE
183
#endif
/* CEOL */
184
#ifndef CEOL2
185
# define CEOL2 _POSIX_VDISABLE
186
#endif
/* CEOL2 */
187
#ifndef CSWTCH
188
# define CSWTCH _POSIX_VDISABLE
189
#endif
/* CSWTCH */
190
#ifndef CDSWTCH
191
# define CDSWTCH _POSIX_VDISABLE
192
#endif
/* CDSWTCH */
193
#ifndef CERASE2
194
# define CERASE2 _POSIX_VDISABLE
195
#endif
/* CERASE2 */
196
#ifndef CSTART
197
# define CSTART CONTROL('q')
198
#endif
/* CSTART */
199
#ifndef CSTOP
200
# define CSTOP CONTROL('s')
201
#endif
/* CSTOP */
202
#ifndef CSUSP
203
# define CSUSP CONTROL('z')
204
#endif
/* CSUSP */
205
#ifndef CDSUSP
206
# define CDSUSP CONTROL('y')
207
#endif
/* CDSUSP */
208
209
#ifdef hpux
210
211
# ifndef CREPRINT
212
# define CREPRINT _POSIX_VDISABLE
213
# endif
/* CREPRINT */
214
# ifndef CDISCARD
215
# define CDISCARD _POSIX_VDISABLE
216
# endif
/* CDISCARD */
217
# ifndef CLNEXT
218
# define CLNEXT _POSIX_VDISABLE
219
# endif
/* CLNEXT */
220
# ifndef CWERASE
221
# define CWERASE _POSIX_VDISABLE
222
# endif
/* CWERASE */
223
224
#else
/* !hpux */
225
226
# ifndef CREPRINT
227
# define CREPRINT CONTROL('r')
228
# endif
/* CREPRINT */
229
# ifndef CDISCARD
230
# define CDISCARD CONTROL('o')
231
# endif
/* CDISCARD */
232
# ifndef CLNEXT
233
# define CLNEXT CONTROL('v')
234
# endif
/* CLNEXT */
235
# ifndef CWERASE
236
# define CWERASE CONTROL('w')
237
# endif
/* CWERASE */
238
239
#endif
/* hpux */
240
241
#ifndef CSTATUS
242
# define CSTATUS CONTROL('t')
243
#endif
/* CSTATUS */
244
#ifndef CPAGE
245
# define CPAGE ' '
246
#endif
/* CPAGE */
247
#ifndef CPGOFF
248
# define CPGOFF CONTROL('m')
249
#endif
/* CPGOFF */
250
#ifndef CKILL2
251
# define CKILL2 _POSIX_VDISABLE
252
#endif
/* CKILL2 */
253
#ifndef CBRK
254
# ifndef masscomp
255
# define CBRK 0377
256
# else
257
# define CBRK '\0'
258
# endif
/* masscomp */
259
#endif
/* CBRK */
260
#ifndef CMIN
261
# define CMIN CEOF
262
#endif
/* CMIN */
263
#ifndef CTIME
264
# define CTIME CEOL
265
#endif
/* CTIME */
266
267
/*
268
* Fix for sun inconsistency. On termio VSUSP and the rest of the
269
* ttychars > NCC are defined. So we undefine them.
270
*/
271
#if defined(TERMIO) || defined(POSIX)
272
# if defined(POSIX) && defined(NCCS)
273
# define NUMCC NCCS
274
# else
275
# ifdef NCC
276
# define NUMCC NCC
277
# endif
/* NCC */
278
# endif
/* POSIX && NCCS */
279
# ifdef NUMCC
280
# ifdef VINTR
281
# if NUMCC <= VINTR
282
# undef VINTR
283
# endif
/* NUMCC <= VINTR */
284
# endif
/* VINTR */
285
# ifdef VQUIT
286
# if NUMCC <= VQUIT
287
# undef VQUIT
288
# endif
/* NUMCC <= VQUIT */
289
# endif
/* VQUIT */
290
# ifdef VERASE
291
# if NUMCC <= VERASE
292
# undef VERASE
293
# endif
/* NUMCC <= VERASE */
294
# endif
/* VERASE */
295
# ifdef VKILL
296
# if NUMCC <= VKILL
297
# undef VKILL
298
# endif
/* NUMCC <= VKILL */
299
# endif
/* VKILL */
300
# ifdef VEOF
301
# if NUMCC <= VEOF
302
# undef VEOF
303
# endif
/* NUMCC <= VEOF */
304
# endif
/* VEOF */
305
# ifdef VEOL
306
# if NUMCC <= VEOL
307
# undef VEOL
308
# endif
/* NUMCC <= VEOL */
309
# endif
/* VEOL */
310
# ifdef VEOL2
311
# if NUMCC <= VEOL2
312
# undef VEOL2
313
# endif
/* NUMCC <= VEOL2 */
314
# endif
/* VEOL2 */
315
# ifdef VSWTCH
316
# if NUMCC <= VSWTCH
317
# undef VSWTCH
318
# endif
/* NUMCC <= VSWTCH */
319
# endif
/* VSWTCH */
320
# ifdef VDSWTCH
321
# if NUMCC <= VDSWTCH
322
# undef VDSWTCH
323
# endif
/* NUMCC <= VDSWTCH */
324
# endif
/* VDSWTCH */
325
# ifdef VERASE2
326
# if NUMCC <= VERASE2
327
# undef VERASE2
328
# endif
/* NUMCC <= VERASE2 */
329
# endif
/* VERASE2 */
330
# ifdef VSTART
331
# if NUMCC <= VSTART
332
# undef VSTART
333
# endif
/* NUMCC <= VSTART */
334
# endif
/* VSTART */
335
# ifdef VSTOP
336
# if NUMCC <= VSTOP
337
# undef VSTOP
338
# endif
/* NUMCC <= VSTOP */
339
# endif
/* VSTOP */
340
# ifdef VWERASE
341
# if NUMCC <= VWERASE
342
# undef VWERASE
343
# endif
/* NUMCC <= VWERASE */
344
# endif
/* VWERASE */
345
# ifdef VSUSP
346
# if NUMCC <= VSUSP
347
# undef VSUSP
348
# endif
/* NUMCC <= VSUSP */
349
# endif
/* VSUSP */
350
# ifdef VDSUSP
351
# if NUMCC <= VDSUSP
352
# undef VDSUSP
353
# endif
/* NUMCC <= VDSUSP */
354
# endif
/* VDSUSP */
355
# ifdef VREPRINT
356
# if NUMCC <= VREPRINT
357
# undef VREPRINT
358
# endif
/* NUMCC <= VREPRINT */
359
# endif
/* VREPRINT */
360
# ifdef VDISCARD
361
# if NUMCC <= VDISCARD
362
# undef VDISCARD
363
# endif
/* NUMCC <= VDISCARD */
364
# endif
/* VDISCARD */
365
# ifdef VLNEXT
366
# if NUMCC <= VLNEXT
367
# undef VLNEXT
368
# endif
/* NUMCC <= VLNEXT */
369
# endif
/* VLNEXT */
370
# ifdef VSTATUS
371
# if NUMCC <= VSTATUS
372
# undef VSTATUS
373
# endif
/* NUMCC <= VSTATUS */
374
# endif
/* VSTATUS */
375
# ifdef VPAGE
376
# if NUMCC <= VPAGE
377
# undef VPAGE
378
# endif
/* NUMCC <= VPAGE */
379
# endif
/* VPAGE */
380
# ifdef VPGOFF
381
# if NUMCC <= VPGOFF
382
# undef VPGOFF
383
# endif
/* NUMCC <= VPGOFF */
384
# endif
/* VPGOFF */
385
# ifdef VKILL2
386
# if NUMCC <= VKILL2
387
# undef VKILL2
388
# endif
/* NUMCC <= VKILL2 */
389
# endif
/* VKILL2 */
390
# ifdef VBRK
391
# if NUMCC <= VBRK
392
# undef VBRK
393
# endif
/* NUMCC <= VBRK */
394
# endif
/* VBRK */
395
# ifdef VMIN
396
# if NUMCC <= VMIN
397
# undef VMIN
398
# endif
/* NUMCC <= VMIN */
399
# endif
/* VMIN */
400
# ifdef VTIME
401
# if NUMCC <= VTIME
402
# undef VTIME
403
# endif
/* NUMCC <= VTIME */
404
# endif
/* VTIME */
405
# endif
/* NUMCC */
406
#endif
/* !POSIX */
407
408
#define C_INTR 0
409
#define C_QUIT 1
410
#define C_ERASE 2
411
#define C_KILL 3
412
#define C_EOF 4
413
#define C_EOL 5
414
#define C_EOL2 6
415
#define C_SWTCH 7
416
#define C_DSWTCH 8
417
#define C_ERASE2 9
418
#define C_START 10
419
#define C_STOP 11
420
#define C_WERASE 12
421
#define C_SUSP 13
422
#define C_DSUSP 14
423
#define C_REPRINT 15
424
#define C_DISCARD 16
425
#define C_LNEXT 17
426
#define C_STATUS 18
427
#define C_PAGE 19
428
#define C_PGOFF 20
429
#define C_KILL2 21
430
#define C_BRK 22
431
#define C_MIN 23
432
#define C_TIME 24
433
#define C_NCC 25
434
#define C_SH(A) ((unsigned int)(1 << (A)))
435
436
/*
437
* Terminal dependend data structures
438
*/
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 */
444
445
#define MD_INP 0
446
#define MD_OUT 1
447
#define MD_CTL 2
448
#define MD_LIN 3
449
#define MD_CHAR 4
450
#define MD_NN 5
451
452
typedef
struct
{
453
const
char
*t_name;
454
unsigned
int
t_setmask;
455
unsigned
int
t_clrmask;
456
}
ttyperm_t
[NN_IO][MD_NN];
457
458
typedef
unsigned
char
ttychar_t[NN_IO][C_NCC];
459
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
);
468
469
typedef
struct
{
470
ttyperm_t
t_t;
471
ttychar_t t_c;
472
struct
termios t_ex, t_ed, t_ts;
473
int
t_tabs;
474
int
t_eight;
475
speed_t t_speed;
476
int
t_mode;
477
unsigned
char
t_vdisable;
478
}
el_tty_t
;
479
480
481
#endif
/* _h_el_tty */
cmd-line-utils
libedit
tty.h
Generated on Sat Nov 9 2013 01:24:40 for MySQL 5.6.14 Source Code Document by
1.8.1.2