1*0a6a1f1dSLionel Sambuc /* $NetBSD: tty.h,v 1.15 2014/05/19 19:54:12 christos Exp $ */ 23e1db26aSLionel Sambuc 33e1db26aSLionel Sambuc /*- 43e1db26aSLionel Sambuc * Copyright (c) 1992, 1993 53e1db26aSLionel Sambuc * The Regents of the University of California. All rights reserved. 63e1db26aSLionel Sambuc * 73e1db26aSLionel Sambuc * This code is derived from software contributed to Berkeley by 83e1db26aSLionel Sambuc * Christos Zoulas of Cornell University. 93e1db26aSLionel Sambuc * 103e1db26aSLionel Sambuc * Redistribution and use in source and binary forms, with or without 113e1db26aSLionel Sambuc * modification, are permitted provided that the following conditions 123e1db26aSLionel Sambuc * are met: 133e1db26aSLionel Sambuc * 1. Redistributions of source code must retain the above copyright 143e1db26aSLionel Sambuc * notice, this list of conditions and the following disclaimer. 153e1db26aSLionel Sambuc * 2. Redistributions in binary form must reproduce the above copyright 163e1db26aSLionel Sambuc * notice, this list of conditions and the following disclaimer in the 173e1db26aSLionel Sambuc * documentation and/or other materials provided with the distribution. 183e1db26aSLionel Sambuc * 3. Neither the name of the University nor the names of its contributors 193e1db26aSLionel Sambuc * may be used to endorse or promote products derived from this software 203e1db26aSLionel Sambuc * without specific prior written permission. 213e1db26aSLionel Sambuc * 223e1db26aSLionel Sambuc * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 233e1db26aSLionel Sambuc * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 243e1db26aSLionel Sambuc * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 253e1db26aSLionel Sambuc * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 263e1db26aSLionel Sambuc * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 273e1db26aSLionel Sambuc * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 283e1db26aSLionel Sambuc * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 293e1db26aSLionel Sambuc * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 303e1db26aSLionel Sambuc * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 313e1db26aSLionel Sambuc * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 323e1db26aSLionel Sambuc * SUCH DAMAGE. 333e1db26aSLionel Sambuc * 343e1db26aSLionel Sambuc * @(#)tty.h 8.1 (Berkeley) 6/4/93 353e1db26aSLionel Sambuc */ 363e1db26aSLionel Sambuc 373e1db26aSLionel Sambuc /* 383e1db26aSLionel Sambuc * el.tty.h: Local terminal header 393e1db26aSLionel Sambuc */ 403e1db26aSLionel Sambuc #ifndef _h_el_tty 413e1db26aSLionel Sambuc #define _h_el_tty 423e1db26aSLionel Sambuc 433e1db26aSLionel Sambuc #include "sys.h" 443e1db26aSLionel Sambuc #include "histedit.h" 453e1db26aSLionel Sambuc #include <termios.h> 463e1db26aSLionel Sambuc #include <unistd.h> 473e1db26aSLionel Sambuc 483e1db26aSLionel Sambuc /* Define our own since everyone gets it wrong! */ 493e1db26aSLionel Sambuc #define CONTROL(A) ((A) & 037) 503e1db26aSLionel Sambuc 513e1db26aSLionel Sambuc /* 523e1db26aSLionel Sambuc * Aix compatible names 533e1db26aSLionel Sambuc */ 543e1db26aSLionel Sambuc # if defined(VWERSE) && !defined(VWERASE) 553e1db26aSLionel Sambuc # define VWERASE VWERSE 563e1db26aSLionel Sambuc # endif /* VWERSE && !VWERASE */ 573e1db26aSLionel Sambuc 583e1db26aSLionel Sambuc # if defined(VDISCRD) && !defined(VDISCARD) 593e1db26aSLionel Sambuc # define VDISCARD VDISCRD 603e1db26aSLionel Sambuc # endif /* VDISCRD && !VDISCARD */ 613e1db26aSLionel Sambuc 623e1db26aSLionel Sambuc # if defined(VFLUSHO) && !defined(VDISCARD) 633e1db26aSLionel Sambuc # define VDISCARD VFLUSHO 643e1db26aSLionel Sambuc # endif /* VFLUSHO && VDISCARD */ 653e1db26aSLionel Sambuc 663e1db26aSLionel Sambuc # if defined(VSTRT) && !defined(VSTART) 673e1db26aSLionel Sambuc # define VSTART VSTRT 683e1db26aSLionel Sambuc # endif /* VSTRT && ! VSTART */ 693e1db26aSLionel Sambuc 703e1db26aSLionel Sambuc # if defined(VSTAT) && !defined(VSTATUS) 713e1db26aSLionel Sambuc # define VSTATUS VSTAT 723e1db26aSLionel Sambuc # endif /* VSTAT && ! VSTATUS */ 733e1db26aSLionel Sambuc 743e1db26aSLionel Sambuc # ifndef ONLRET 753e1db26aSLionel Sambuc # define ONLRET 0 763e1db26aSLionel Sambuc # endif /* ONLRET */ 773e1db26aSLionel Sambuc 783e1db26aSLionel Sambuc # ifndef TAB3 793e1db26aSLionel Sambuc # ifdef OXTABS 803e1db26aSLionel Sambuc # define TAB3 OXTABS 813e1db26aSLionel Sambuc # else 823e1db26aSLionel Sambuc # define TAB3 0 833e1db26aSLionel Sambuc # endif /* OXTABS */ 843e1db26aSLionel Sambuc # endif /* !TAB3 */ 853e1db26aSLionel Sambuc 863e1db26aSLionel Sambuc # if defined(OXTABS) && !defined(XTABS) 873e1db26aSLionel Sambuc # define XTABS OXTABS 883e1db26aSLionel Sambuc # endif /* OXTABS && !XTABS */ 893e1db26aSLionel Sambuc 903e1db26aSLionel Sambuc # ifndef ONLCR 913e1db26aSLionel Sambuc # define ONLCR 0 923e1db26aSLionel Sambuc # endif /* ONLCR */ 933e1db26aSLionel Sambuc 943e1db26aSLionel Sambuc # ifndef IEXTEN 953e1db26aSLionel Sambuc # define IEXTEN 0 963e1db26aSLionel Sambuc # endif /* IEXTEN */ 973e1db26aSLionel Sambuc 983e1db26aSLionel Sambuc # ifndef ECHOCTL 993e1db26aSLionel Sambuc # define ECHOCTL 0 1003e1db26aSLionel Sambuc # endif /* ECHOCTL */ 1013e1db26aSLionel Sambuc 1023e1db26aSLionel Sambuc # ifndef PARENB 1033e1db26aSLionel Sambuc # define PARENB 0 1043e1db26aSLionel Sambuc # endif /* PARENB */ 1053e1db26aSLionel Sambuc 1063e1db26aSLionel Sambuc # ifndef EXTPROC 1073e1db26aSLionel Sambuc # define EXTPROC 0 1083e1db26aSLionel Sambuc # endif /* EXTPROC */ 1093e1db26aSLionel Sambuc 1103e1db26aSLionel Sambuc # ifndef FLUSHO 1113e1db26aSLionel Sambuc # define FLUSHO 0 1123e1db26aSLionel Sambuc # endif /* FLUSHO */ 1133e1db26aSLionel Sambuc 1143e1db26aSLionel Sambuc 1153e1db26aSLionel Sambuc # if defined(VDISABLE) && !defined(_POSIX_VDISABLE) 1163e1db26aSLionel Sambuc # define _POSIX_VDISABLE VDISABLE 1173e1db26aSLionel Sambuc # endif /* VDISABLE && ! _POSIX_VDISABLE */ 1183e1db26aSLionel Sambuc 1193e1db26aSLionel Sambuc /* 1203e1db26aSLionel Sambuc * Work around ISC's definition of IEXTEN which is 1213e1db26aSLionel Sambuc * XCASE! 1223e1db26aSLionel Sambuc */ 1233e1db26aSLionel Sambuc # ifdef ISC 1243e1db26aSLionel Sambuc # if defined(IEXTEN) && defined(XCASE) 1253e1db26aSLionel Sambuc # if IEXTEN == XCASE 1263e1db26aSLionel Sambuc # undef IEXTEN 1273e1db26aSLionel Sambuc # define IEXTEN 0 1283e1db26aSLionel Sambuc # endif /* IEXTEN == XCASE */ 1293e1db26aSLionel Sambuc # endif /* IEXTEN && XCASE */ 1303e1db26aSLionel Sambuc # if defined(IEXTEN) && !defined(XCASE) 1313e1db26aSLionel Sambuc # define XCASE IEXTEN 1323e1db26aSLionel Sambuc # undef IEXTEN 1333e1db26aSLionel Sambuc # define IEXTEN 0 1343e1db26aSLionel Sambuc # endif /* IEXTEN && !XCASE */ 1353e1db26aSLionel Sambuc # endif /* ISC */ 1363e1db26aSLionel Sambuc 1373e1db26aSLionel Sambuc /* 1383e1db26aSLionel Sambuc * Work around convex weirdness where turning off IEXTEN makes us 1393e1db26aSLionel Sambuc * lose all postprocessing! 1403e1db26aSLionel Sambuc */ 1413e1db26aSLionel Sambuc #if defined(convex) || defined(__convex__) 1423e1db26aSLionel Sambuc # if defined(IEXTEN) && IEXTEN != 0 1433e1db26aSLionel Sambuc # undef IEXTEN 1443e1db26aSLionel Sambuc # define IEXTEN 0 1453e1db26aSLionel Sambuc # endif /* IEXTEN != 0 */ 1463e1db26aSLionel Sambuc #endif /* convex || __convex__ */ 1473e1db26aSLionel Sambuc 1483e1db26aSLionel Sambuc /* 1493e1db26aSLionel Sambuc * So that we don't lose job control. 1503e1db26aSLionel Sambuc */ 1513e1db26aSLionel Sambuc #ifdef __SVR4 1523e1db26aSLionel Sambuc # undef CSWTCH 1533e1db26aSLionel Sambuc #endif 1543e1db26aSLionel Sambuc 1553e1db26aSLionel Sambuc #ifndef _POSIX_VDISABLE 1563e1db26aSLionel Sambuc # define _POSIX_VDISABLE ((unsigned char) -1) 1573e1db26aSLionel Sambuc #endif /* _POSIX_VDISABLE */ 1583e1db26aSLionel Sambuc 1593e1db26aSLionel Sambuc #if !defined(CREPRINT) && defined(CRPRNT) 1603e1db26aSLionel Sambuc # define CREPRINT CRPRNT 1613e1db26aSLionel Sambuc #endif /* !CREPRINT && CRPRNT */ 1623e1db26aSLionel Sambuc #if !defined(CDISCARD) && defined(CFLUSH) 1633e1db26aSLionel Sambuc # define CDISCARD CFLUSH 1643e1db26aSLionel Sambuc #endif /* !CDISCARD && CFLUSH */ 1653e1db26aSLionel Sambuc 1663e1db26aSLionel Sambuc #ifndef CINTR 1673e1db26aSLionel Sambuc # define CINTR CONTROL('c') 1683e1db26aSLionel Sambuc #endif /* CINTR */ 1693e1db26aSLionel Sambuc #ifndef CQUIT 1703e1db26aSLionel Sambuc # define CQUIT 034 /* ^\ */ 1713e1db26aSLionel Sambuc #endif /* CQUIT */ 1723e1db26aSLionel Sambuc #ifndef CERASE 1733e1db26aSLionel Sambuc # define CERASE 0177 /* ^? */ 1743e1db26aSLionel Sambuc #endif /* CERASE */ 1753e1db26aSLionel Sambuc #ifndef CKILL 1763e1db26aSLionel Sambuc # define CKILL CONTROL('u') 1773e1db26aSLionel Sambuc #endif /* CKILL */ 1783e1db26aSLionel Sambuc #ifndef CEOF 1793e1db26aSLionel Sambuc # define CEOF CONTROL('d') 1803e1db26aSLionel Sambuc #endif /* CEOF */ 1813e1db26aSLionel Sambuc #ifndef CEOL 1823e1db26aSLionel Sambuc # define CEOL _POSIX_VDISABLE 1833e1db26aSLionel Sambuc #endif /* CEOL */ 1843e1db26aSLionel Sambuc #ifndef CEOL2 1853e1db26aSLionel Sambuc # define CEOL2 _POSIX_VDISABLE 1863e1db26aSLionel Sambuc #endif /* CEOL2 */ 1873e1db26aSLionel Sambuc #ifndef CSWTCH 1883e1db26aSLionel Sambuc # define CSWTCH _POSIX_VDISABLE 1893e1db26aSLionel Sambuc #endif /* CSWTCH */ 1903e1db26aSLionel Sambuc #ifndef CDSWTCH 1913e1db26aSLionel Sambuc # define CDSWTCH _POSIX_VDISABLE 1923e1db26aSLionel Sambuc #endif /* CDSWTCH */ 1933e1db26aSLionel Sambuc #ifndef CERASE2 1943e1db26aSLionel Sambuc # define CERASE2 _POSIX_VDISABLE 1953e1db26aSLionel Sambuc #endif /* CERASE2 */ 1963e1db26aSLionel Sambuc #ifndef CSTART 1973e1db26aSLionel Sambuc # define CSTART CONTROL('q') 1983e1db26aSLionel Sambuc #endif /* CSTART */ 1993e1db26aSLionel Sambuc #ifndef CSTOP 2003e1db26aSLionel Sambuc # define CSTOP CONTROL('s') 2013e1db26aSLionel Sambuc #endif /* CSTOP */ 2023e1db26aSLionel Sambuc #ifndef CSUSP 2033e1db26aSLionel Sambuc # define CSUSP CONTROL('z') 2043e1db26aSLionel Sambuc #endif /* CSUSP */ 2053e1db26aSLionel Sambuc #ifndef CDSUSP 2063e1db26aSLionel Sambuc # define CDSUSP CONTROL('y') 2073e1db26aSLionel Sambuc #endif /* CDSUSP */ 2083e1db26aSLionel Sambuc 2093e1db26aSLionel Sambuc #ifdef hpux 2103e1db26aSLionel Sambuc 2113e1db26aSLionel Sambuc # ifndef CREPRINT 2123e1db26aSLionel Sambuc # define CREPRINT _POSIX_VDISABLE 2133e1db26aSLionel Sambuc # endif /* CREPRINT */ 2143e1db26aSLionel Sambuc # ifndef CDISCARD 2153e1db26aSLionel Sambuc # define CDISCARD _POSIX_VDISABLE 2163e1db26aSLionel Sambuc # endif /* CDISCARD */ 2173e1db26aSLionel Sambuc # ifndef CLNEXT 2183e1db26aSLionel Sambuc # define CLNEXT _POSIX_VDISABLE 2193e1db26aSLionel Sambuc # endif /* CLNEXT */ 2203e1db26aSLionel Sambuc # ifndef CWERASE 2213e1db26aSLionel Sambuc # define CWERASE _POSIX_VDISABLE 2223e1db26aSLionel Sambuc # endif /* CWERASE */ 2233e1db26aSLionel Sambuc 2243e1db26aSLionel Sambuc #else /* !hpux */ 2253e1db26aSLionel Sambuc 2263e1db26aSLionel Sambuc # ifndef CREPRINT 2273e1db26aSLionel Sambuc # define CREPRINT CONTROL('r') 2283e1db26aSLionel Sambuc # endif /* CREPRINT */ 2293e1db26aSLionel Sambuc # ifndef CDISCARD 2303e1db26aSLionel Sambuc # define CDISCARD CONTROL('o') 2313e1db26aSLionel Sambuc # endif /* CDISCARD */ 2323e1db26aSLionel Sambuc # ifndef CLNEXT 2333e1db26aSLionel Sambuc # define CLNEXT CONTROL('v') 2343e1db26aSLionel Sambuc # endif /* CLNEXT */ 2353e1db26aSLionel Sambuc # ifndef CWERASE 2363e1db26aSLionel Sambuc # define CWERASE CONTROL('w') 2373e1db26aSLionel Sambuc # endif /* CWERASE */ 2383e1db26aSLionel Sambuc 2393e1db26aSLionel Sambuc #endif /* hpux */ 2403e1db26aSLionel Sambuc 2413e1db26aSLionel Sambuc #ifndef CSTATUS 2423e1db26aSLionel Sambuc # define CSTATUS CONTROL('t') 2433e1db26aSLionel Sambuc #endif /* CSTATUS */ 2443e1db26aSLionel Sambuc #ifndef CPAGE 2453e1db26aSLionel Sambuc # define CPAGE ' ' 2463e1db26aSLionel Sambuc #endif /* CPAGE */ 2473e1db26aSLionel Sambuc #ifndef CPGOFF 2483e1db26aSLionel Sambuc # define CPGOFF CONTROL('m') 2493e1db26aSLionel Sambuc #endif /* CPGOFF */ 2503e1db26aSLionel Sambuc #ifndef CKILL2 2513e1db26aSLionel Sambuc # define CKILL2 _POSIX_VDISABLE 2523e1db26aSLionel Sambuc #endif /* CKILL2 */ 2533e1db26aSLionel Sambuc #ifndef CBRK 2543e1db26aSLionel Sambuc # ifndef masscomp 2553e1db26aSLionel Sambuc # define CBRK 0377 2563e1db26aSLionel Sambuc # else 2573e1db26aSLionel Sambuc # define CBRK '\0' 2583e1db26aSLionel Sambuc # endif /* masscomp */ 2593e1db26aSLionel Sambuc #endif /* CBRK */ 2603e1db26aSLionel Sambuc #ifndef CMIN 2613e1db26aSLionel Sambuc # define CMIN CEOF 2623e1db26aSLionel Sambuc #endif /* CMIN */ 2633e1db26aSLionel Sambuc #ifndef CTIME 2643e1db26aSLionel Sambuc # define CTIME CEOL 2653e1db26aSLionel Sambuc #endif /* CTIME */ 2663e1db26aSLionel Sambuc 2673e1db26aSLionel Sambuc /* 2683e1db26aSLionel Sambuc * Fix for sun inconsistency. On termio VSUSP and the rest of the 2693e1db26aSLionel Sambuc * ttychars > NCC are defined. So we undefine them. 2703e1db26aSLionel Sambuc */ 2713e1db26aSLionel Sambuc #if defined(TERMIO) || defined(POSIX) 2723e1db26aSLionel Sambuc # if defined(POSIX) && defined(NCCS) 2733e1db26aSLionel Sambuc # define NUMCC NCCS 2743e1db26aSLionel Sambuc # else 2753e1db26aSLionel Sambuc # ifdef NCC 2763e1db26aSLionel Sambuc # define NUMCC NCC 2773e1db26aSLionel Sambuc # endif /* NCC */ 2783e1db26aSLionel Sambuc # endif /* POSIX && NCCS */ 2793e1db26aSLionel Sambuc # ifdef NUMCC 2803e1db26aSLionel Sambuc # ifdef VINTR 2813e1db26aSLionel Sambuc # if NUMCC <= VINTR 2823e1db26aSLionel Sambuc # undef VINTR 2833e1db26aSLionel Sambuc # endif /* NUMCC <= VINTR */ 2843e1db26aSLionel Sambuc # endif /* VINTR */ 2853e1db26aSLionel Sambuc # ifdef VQUIT 2863e1db26aSLionel Sambuc # if NUMCC <= VQUIT 2873e1db26aSLionel Sambuc # undef VQUIT 2883e1db26aSLionel Sambuc # endif /* NUMCC <= VQUIT */ 2893e1db26aSLionel Sambuc # endif /* VQUIT */ 2903e1db26aSLionel Sambuc # ifdef VERASE 2913e1db26aSLionel Sambuc # if NUMCC <= VERASE 2923e1db26aSLionel Sambuc # undef VERASE 2933e1db26aSLionel Sambuc # endif /* NUMCC <= VERASE */ 2943e1db26aSLionel Sambuc # endif /* VERASE */ 2953e1db26aSLionel Sambuc # ifdef VKILL 2963e1db26aSLionel Sambuc # if NUMCC <= VKILL 2973e1db26aSLionel Sambuc # undef VKILL 2983e1db26aSLionel Sambuc # endif /* NUMCC <= VKILL */ 2993e1db26aSLionel Sambuc # endif /* VKILL */ 3003e1db26aSLionel Sambuc # ifdef VEOF 3013e1db26aSLionel Sambuc # if NUMCC <= VEOF 3023e1db26aSLionel Sambuc # undef VEOF 3033e1db26aSLionel Sambuc # endif /* NUMCC <= VEOF */ 3043e1db26aSLionel Sambuc # endif /* VEOF */ 3053e1db26aSLionel Sambuc # ifdef VEOL 3063e1db26aSLionel Sambuc # if NUMCC <= VEOL 3073e1db26aSLionel Sambuc # undef VEOL 3083e1db26aSLionel Sambuc # endif /* NUMCC <= VEOL */ 3093e1db26aSLionel Sambuc # endif /* VEOL */ 3103e1db26aSLionel Sambuc # ifdef VEOL2 3113e1db26aSLionel Sambuc # if NUMCC <= VEOL2 3123e1db26aSLionel Sambuc # undef VEOL2 3133e1db26aSLionel Sambuc # endif /* NUMCC <= VEOL2 */ 3143e1db26aSLionel Sambuc # endif /* VEOL2 */ 3153e1db26aSLionel Sambuc # ifdef VSWTCH 3163e1db26aSLionel Sambuc # if NUMCC <= VSWTCH 3173e1db26aSLionel Sambuc # undef VSWTCH 3183e1db26aSLionel Sambuc # endif /* NUMCC <= VSWTCH */ 3193e1db26aSLionel Sambuc # endif /* VSWTCH */ 3203e1db26aSLionel Sambuc # ifdef VDSWTCH 3213e1db26aSLionel Sambuc # if NUMCC <= VDSWTCH 3223e1db26aSLionel Sambuc # undef VDSWTCH 3233e1db26aSLionel Sambuc # endif /* NUMCC <= VDSWTCH */ 3243e1db26aSLionel Sambuc # endif /* VDSWTCH */ 3253e1db26aSLionel Sambuc # ifdef VERASE2 3263e1db26aSLionel Sambuc # if NUMCC <= VERASE2 3273e1db26aSLionel Sambuc # undef VERASE2 3283e1db26aSLionel Sambuc # endif /* NUMCC <= VERASE2 */ 3293e1db26aSLionel Sambuc # endif /* VERASE2 */ 3303e1db26aSLionel Sambuc # ifdef VSTART 3313e1db26aSLionel Sambuc # if NUMCC <= VSTART 3323e1db26aSLionel Sambuc # undef VSTART 3333e1db26aSLionel Sambuc # endif /* NUMCC <= VSTART */ 3343e1db26aSLionel Sambuc # endif /* VSTART */ 3353e1db26aSLionel Sambuc # ifdef VSTOP 3363e1db26aSLionel Sambuc # if NUMCC <= VSTOP 3373e1db26aSLionel Sambuc # undef VSTOP 3383e1db26aSLionel Sambuc # endif /* NUMCC <= VSTOP */ 3393e1db26aSLionel Sambuc # endif /* VSTOP */ 3403e1db26aSLionel Sambuc # ifdef VWERASE 3413e1db26aSLionel Sambuc # if NUMCC <= VWERASE 3423e1db26aSLionel Sambuc # undef VWERASE 3433e1db26aSLionel Sambuc # endif /* NUMCC <= VWERASE */ 3443e1db26aSLionel Sambuc # endif /* VWERASE */ 3453e1db26aSLionel Sambuc # ifdef VSUSP 3463e1db26aSLionel Sambuc # if NUMCC <= VSUSP 3473e1db26aSLionel Sambuc # undef VSUSP 3483e1db26aSLionel Sambuc # endif /* NUMCC <= VSUSP */ 3493e1db26aSLionel Sambuc # endif /* VSUSP */ 3503e1db26aSLionel Sambuc # ifdef VDSUSP 3513e1db26aSLionel Sambuc # if NUMCC <= VDSUSP 3523e1db26aSLionel Sambuc # undef VDSUSP 3533e1db26aSLionel Sambuc # endif /* NUMCC <= VDSUSP */ 3543e1db26aSLionel Sambuc # endif /* VDSUSP */ 3553e1db26aSLionel Sambuc # ifdef VREPRINT 3563e1db26aSLionel Sambuc # if NUMCC <= VREPRINT 3573e1db26aSLionel Sambuc # undef VREPRINT 3583e1db26aSLionel Sambuc # endif /* NUMCC <= VREPRINT */ 3593e1db26aSLionel Sambuc # endif /* VREPRINT */ 3603e1db26aSLionel Sambuc # ifdef VDISCARD 3613e1db26aSLionel Sambuc # if NUMCC <= VDISCARD 3623e1db26aSLionel Sambuc # undef VDISCARD 3633e1db26aSLionel Sambuc # endif /* NUMCC <= VDISCARD */ 3643e1db26aSLionel Sambuc # endif /* VDISCARD */ 3653e1db26aSLionel Sambuc # ifdef VLNEXT 3663e1db26aSLionel Sambuc # if NUMCC <= VLNEXT 3673e1db26aSLionel Sambuc # undef VLNEXT 3683e1db26aSLionel Sambuc # endif /* NUMCC <= VLNEXT */ 3693e1db26aSLionel Sambuc # endif /* VLNEXT */ 3703e1db26aSLionel Sambuc # ifdef VSTATUS 3713e1db26aSLionel Sambuc # if NUMCC <= VSTATUS 3723e1db26aSLionel Sambuc # undef VSTATUS 3733e1db26aSLionel Sambuc # endif /* NUMCC <= VSTATUS */ 3743e1db26aSLionel Sambuc # endif /* VSTATUS */ 3753e1db26aSLionel Sambuc # ifdef VPAGE 3763e1db26aSLionel Sambuc # if NUMCC <= VPAGE 3773e1db26aSLionel Sambuc # undef VPAGE 3783e1db26aSLionel Sambuc # endif /* NUMCC <= VPAGE */ 3793e1db26aSLionel Sambuc # endif /* VPAGE */ 3803e1db26aSLionel Sambuc # ifdef VPGOFF 3813e1db26aSLionel Sambuc # if NUMCC <= VPGOFF 3823e1db26aSLionel Sambuc # undef VPGOFF 3833e1db26aSLionel Sambuc # endif /* NUMCC <= VPGOFF */ 3843e1db26aSLionel Sambuc # endif /* VPGOFF */ 3853e1db26aSLionel Sambuc # ifdef VKILL2 3863e1db26aSLionel Sambuc # if NUMCC <= VKILL2 3873e1db26aSLionel Sambuc # undef VKILL2 3883e1db26aSLionel Sambuc # endif /* NUMCC <= VKILL2 */ 3893e1db26aSLionel Sambuc # endif /* VKILL2 */ 3903e1db26aSLionel Sambuc # ifdef VBRK 3913e1db26aSLionel Sambuc # if NUMCC <= VBRK 3923e1db26aSLionel Sambuc # undef VBRK 3933e1db26aSLionel Sambuc # endif /* NUMCC <= VBRK */ 3943e1db26aSLionel Sambuc # endif /* VBRK */ 3953e1db26aSLionel Sambuc # ifdef VMIN 3963e1db26aSLionel Sambuc # if NUMCC <= VMIN 3973e1db26aSLionel Sambuc # undef VMIN 3983e1db26aSLionel Sambuc # endif /* NUMCC <= VMIN */ 3993e1db26aSLionel Sambuc # endif /* VMIN */ 4003e1db26aSLionel Sambuc # ifdef VTIME 4013e1db26aSLionel Sambuc # if NUMCC <= VTIME 4023e1db26aSLionel Sambuc # undef VTIME 4033e1db26aSLionel Sambuc # endif /* NUMCC <= VTIME */ 4043e1db26aSLionel Sambuc # endif /* VTIME */ 4053e1db26aSLionel Sambuc # endif /* NUMCC */ 4063e1db26aSLionel Sambuc #endif /* !POSIX */ 4073e1db26aSLionel Sambuc 4083e1db26aSLionel Sambuc #define C_INTR 0 4093e1db26aSLionel Sambuc #define C_QUIT 1 4103e1db26aSLionel Sambuc #define C_ERASE 2 4113e1db26aSLionel Sambuc #define C_KILL 3 4123e1db26aSLionel Sambuc #define C_EOF 4 4133e1db26aSLionel Sambuc #define C_EOL 5 4143e1db26aSLionel Sambuc #define C_EOL2 6 4153e1db26aSLionel Sambuc #define C_SWTCH 7 4163e1db26aSLionel Sambuc #define C_DSWTCH 8 4173e1db26aSLionel Sambuc #define C_ERASE2 9 4183e1db26aSLionel Sambuc #define C_START 10 4193e1db26aSLionel Sambuc #define C_STOP 11 4203e1db26aSLionel Sambuc #define C_WERASE 12 4213e1db26aSLionel Sambuc #define C_SUSP 13 4223e1db26aSLionel Sambuc #define C_DSUSP 14 4233e1db26aSLionel Sambuc #define C_REPRINT 15 4243e1db26aSLionel Sambuc #define C_DISCARD 16 4253e1db26aSLionel Sambuc #define C_LNEXT 17 4263e1db26aSLionel Sambuc #define C_STATUS 18 4273e1db26aSLionel Sambuc #define C_PAGE 19 4283e1db26aSLionel Sambuc #define C_PGOFF 20 4293e1db26aSLionel Sambuc #define C_KILL2 21 4303e1db26aSLionel Sambuc #define C_BRK 22 4313e1db26aSLionel Sambuc #define C_MIN 23 4323e1db26aSLionel Sambuc #define C_TIME 24 4333e1db26aSLionel Sambuc #define C_NCC 25 4343e1db26aSLionel Sambuc #define C_SH(A) ((unsigned int)(1 << (A))) 4353e1db26aSLionel Sambuc 4363e1db26aSLionel Sambuc /* 4373e1db26aSLionel Sambuc * Terminal dependend data structures 4383e1db26aSLionel Sambuc */ 4393e1db26aSLionel Sambuc #define EX_IO 0 /* while we are executing */ 4403e1db26aSLionel Sambuc #define ED_IO 1 /* while we are editing */ 4413e1db26aSLionel Sambuc #define TS_IO 2 /* new mode from terminal */ 4423e1db26aSLionel Sambuc #define QU_IO 2 /* used only for quoted chars */ 4433e1db26aSLionel Sambuc #define NN_IO 3 /* The number of entries */ 4443e1db26aSLionel Sambuc 445*0a6a1f1dSLionel Sambuc /* Don't re-order */ 4463e1db26aSLionel Sambuc #define MD_INP 0 4473e1db26aSLionel Sambuc #define MD_OUT 1 4483e1db26aSLionel Sambuc #define MD_CTL 2 4493e1db26aSLionel Sambuc #define MD_LIN 3 4503e1db26aSLionel Sambuc #define MD_CHAR 4 4513e1db26aSLionel Sambuc #define MD_NN 5 4523e1db26aSLionel Sambuc 4533e1db26aSLionel Sambuc typedef struct { 4543e1db26aSLionel Sambuc const char *t_name; 4553e1db26aSLionel Sambuc unsigned int t_setmask; 4563e1db26aSLionel Sambuc unsigned int t_clrmask; 4573e1db26aSLionel Sambuc } ttyperm_t[NN_IO][MD_NN]; 4583e1db26aSLionel Sambuc 4593e1db26aSLionel Sambuc typedef unsigned char ttychar_t[NN_IO][C_NCC]; 4603e1db26aSLionel Sambuc 4613e1db26aSLionel Sambuc protected int tty_init(EditLine *); 4623e1db26aSLionel Sambuc protected void tty_end(EditLine *); 4633e1db26aSLionel Sambuc protected int tty_stty(EditLine *, int, const Char **); 4643e1db26aSLionel Sambuc protected int tty_rawmode(EditLine *); 4653e1db26aSLionel Sambuc protected int tty_cookedmode(EditLine *); 4663e1db26aSLionel Sambuc protected int tty_quotemode(EditLine *); 4673e1db26aSLionel Sambuc protected int tty_noquotemode(EditLine *); 4683e1db26aSLionel Sambuc protected void tty_bind_char(EditLine *, int); 4693e1db26aSLionel Sambuc 4703e1db26aSLionel Sambuc typedef struct { 4713e1db26aSLionel Sambuc ttyperm_t t_t; 4723e1db26aSLionel Sambuc ttychar_t t_c; 4733e1db26aSLionel Sambuc struct termios t_or, t_ex, t_ed, t_ts; 4743e1db26aSLionel Sambuc int t_tabs; 4753e1db26aSLionel Sambuc int t_eight; 4763e1db26aSLionel Sambuc speed_t t_speed; 4773e1db26aSLionel Sambuc int t_mode; 4783e1db26aSLionel Sambuc unsigned char t_vdisable; 4793e1db26aSLionel Sambuc } el_tty_t; 4803e1db26aSLionel Sambuc 4813e1db26aSLionel Sambuc 4823e1db26aSLionel Sambuc #endif /* _h_el_tty */ 483