xref: /titanic_51/usr/src/lib/libast/amd64/include/ast/ast_tty.h (revision 3e14f97f673e8a630f076077de35afdd43dc1587)
1 /***********************************************************************
2 *                                                                      *
3 *               This software is part of the ast package               *
4 *          Copyright (c) 1985-2010 AT&T Intellectual Property          *
5 *                      and is licensed under the                       *
6 *                  Common Public License, Version 1.0                  *
7 *                    by AT&T Intellectual Property                     *
8 *                                                                      *
9 *                A copy of the License is available at                 *
10 *            http://www.opensource.org/licenses/cpl1.0.txt             *
11 *         (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9)         *
12 *                                                                      *
13 *              Information and Software Systems Research               *
14 *                            AT&T Research                             *
15 *                           Florham Park NJ                            *
16 *                                                                      *
17 *                 Glenn Fowler <gsf@research.att.com>                  *
18 *                  David Korn <dgk@research.att.com>                   *
19 *                   Phong Vo <kpv@research.att.com>                    *
20 *                                                                      *
21 ***********************************************************************/
22 /* : : generated from /home/gisburn/ksh93/ast_ksh_20100309/build_i386_64bit/src/lib/libast/features/tty by iffe version 2009-12-04 : : */
23 #ifndef _def_tty_ast
24 #define _def_tty_ast	1
25 #define _sys_types	1	/* #include <sys/types.h> ok */
26 #define _hdr_termios	1	/* #include <termios.h> ok */
27 #define _hdr_termio	1	/* #include <termio.h> ok */
28 #define _hdr_sgtty	1	/* #include <sgtty.h> ok */
29 #define _sys_termios	1	/* #include <sys/termios.h> ok */
30 #define _sys_termio	1	/* #include <sys/termio.h> ok */
31 #define _sys_ioctl	1	/* #include <sys/ioctl.h> ok */
32 #define _lib_tcgetattr	1	/* tcgetattr() in default lib(s) */
33 #define _lib_tcgetpgrp	1	/* tcgetpgrp() in default lib(s) */
34 #define _mac__POSIX_VDISABLE	1	/* _POSIX_VDISABLE is a macro */
35 
36 #ifdef _hdr_termios
37 #   if _mac__POSIX_VDISABLE
38 #	undef _POSIX_VDISABLE
39 #   endif
40 #   include	<termios.h>
41 #else
42 #   if defined(_sys_termios) && defined(_lib_tcgetattr)
43 #	include	<sys/termios.h>
44 #	define _hdr_termios	1
45 #   else
46 #	undef _sys_termios
47 #   endif /* _sys_termios */
48 #endif /* _hdr_termios */
49 
50 #ifdef _hdr_termios
51 #   undef _hdr_sgtty
52 #   undef tcgetattr
53 #   undef tcsetattr
54 #   undef tcgetpgrp
55 #   undef tcsetpgrp
56 #   undef cfgetospeed
57 #   ifndef TCSANOW
58 #	define TCSANOW		TCSETS
59 #	define TCSADRAIN	TCSETSW
60 #	define TCSAFLUSH	TCSETSF
61 #   endif /* TCSANOW */
62    /* The following corrects bugs in some implementations */
63 #   if defined(TCSADFLUSH) && !defined(TCSAFLUSH)
64 #	define TCSAFLUSH	TCSADFLUSH
65 #   endif /* TCSADFLUSH */
66 #   ifndef _lib_tcgetattr
67 #	undef  tcgetattr
68 #	define tcgetattr(fd,tty)	ioctl(fd, TCGETS, tty)
69 #	undef  tcsetattr
70 #	define tcsetattr(fd,action,tty)	ioctl(fd, action, tty)
71 #	undef  cfgetospeed
72 #	define cfgetospeed(tp)		((tp)->c_cflag & CBAUD)
73 #   endif /* _lib_tcgetattr */
74 #   undef TIOCGETC
75 #else
76 #   define cfgetospeed(tp)	((tp)->c_cflag & CBAUD)
77 #   define cfgetispeed(tp)	((tp)->c_cflag & CBAUD)
78 #   define cfsetispeed(tp,val)	((tp)->c_cflag &=~ CBAUD,(tp)->c_cflag|=(val))
79 #   define cfsetospeed(tp,val)	((tp)->c_cflag &=~ CBAUD,(tp)->c_cflag|=(val))
80 #   ifdef _hdr_termio
81 #	include	<termio.h>
82 #   else
83 #	ifdef _sys_termio
84 #	    include	<sys/termio.h>
85 #	    define _hdr_termio 1
86 #	endif /* _sys_termio */
87 #   endif /* _hdr_termio */
88 #   ifdef _hdr_termio
89 #	define termios termio
90 #	undef TIOCGETC
91 #	define tcgetattr(fd,tty)	ioctl(fd, TCGETA, tty)
92 #	define tcsetattr(fd,action,tty)	ioctl(fd, action, tty)
93 
94 #	ifdef _sys_bsdtty
95 #	   include	<sys/bsdtty.h>
96 #	endif /* _sys_bsdtty */
97 #   else
98 #	ifdef _hdr_sgtty
99 #	    include	<sgtty.h>
100 #	    ifndef LPENDIN
101 #	        ifdef _sys_nttyio
102 #		    include	<sys/nttyio.h>
103 #	        endif /* _sys_nttyio */
104 #	    endif /* LPENDIN */
105 #	    define termios sgttyb
106 #	    ifdef TIOCSETN
107 #	 	undef TCSETAW
108 #	    endif /* TIOCSETN */
109 #	    ifdef TIOCGETP
110 #		define tcgetattr(fd,tty)	ioctl(fd, TIOCGETP, tty)
111 #		define tcsetattr(fd,action,tty)	ioctl(fd, action, tty)
112 #	    else
113 #		define tcgetattr(fd,tty)	gtty(fd, tty)
114 #		define tcsetattr(fd,action,tty)	stty(fd, tty)
115 #	    endif /* TIOCGETP */
116 #	else
117 #		ifdef _sys_ttyio
118 #			include <sys/ttyio.h>
119 #		endif
120 #	endif /* _hdr_sgtty */
121 #   endif /* hdr_termio */
122 
123 #   ifndef TCSANOW
124 #	ifdef TCSETAW
125 #	    define TCSANOW		TCSETA
126 #	    define TCSAFLUSH		TCSETAF
127 #	else
128 #	    ifdef TIOCSETN
129 #		define TCSANOW		TIOCSETN
130 #		define TCSADRAIN	TIOCSETN
131 #		define TCSAFLUSH	TIOCSETP
132 #	    endif /* TIOCSETN */
133 #	endif /* TCSETAW */
134 #   endif /* TCSANOW */
135 #endif /* _hdr_termios */
136 
137 /* set ECHOCTL if driver can echo control charaters as ^c */
138 #ifdef LCTLECH
139 #   ifndef ECHOCTL
140 #	define ECHOCTL	LCTLECH
141 #   endif /* !ECHOCTL */
142 #endif /* LCTLECH */
143 #ifdef LNEW_CTLECH
144 #   ifndef ECHOCTL
145 #	define ECHOCTL  LNEW_CTLECH
146 #   endif /* !ECHOCTL */
147 #endif /* LNEW_CTLECH */
148 #ifdef LNEW_PENDIN
149 #   ifndef PENDIN
150 #	define PENDIN LNEW_PENDIN
151 #  endif /* !PENDIN */
152 #endif /* LNEW_PENDIN */
153 
154 
155 #endif
156