2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
6 * These libraries and programs are free software; you can
7 * redistribute them and/or modify them under the terms of the GNU
8 * Lesser General Public License as published by the Free Software
9 * Foundation; either version 2 of the License, or (at your option)
12 * These libraries and programs are distributed in the hope that
13 * they will be useful, but WITHOUT ANY WARRANTY; without even the
14 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU Lesser General Public License for more
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with these librararies and programs; if not, write
20 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21 * Floor, Boston, MA 02110-1301 USA
23 /* $XConsortium: terminal.h /main/3 1995/11/01 16:43:45 rswiston $ */
24 /***************************************************************
26 * AT&T - PROPRIETARY *
28 * THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF *
29 * AT&T BELL LABORATORIES *
30 * AND IS NOT TO BE DISCLOSED OR USED EXCEPT IN *
31 * ACCORDANCE WITH APPLICABLE AGREEMENTS *
33 * Copyright (c) 1995 AT&T Corp. *
34 * Unpublished & Not for Publication *
35 * All Rights Reserved *
37 * The copyright notice above does not evidence any *
38 * actual or intended publication of such source code *
40 * This software was created by the *
41 * Advanced Software Technology Department *
42 * AT&T Bell Laboratories *
44 * For further information contact *
45 * {research,attmail}!dgk *
47 ***************************************************************/
49 /* : : generated by proto : : */
53 #if !defined(__PROTO__)
54 #if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus)
55 #if defined(__cplusplus)
56 #define __MANGLE__ "C"
61 #define __PROTO__(x) x
63 #define __PARAM__(n,o) n
64 #if !defined(__STDC__) && !defined(__cplusplus)
65 #if !defined(c_plusplus)
76 #define __PROTO__(x) ()
77 #define __OTORP__(x) x
78 #define __PARAM__(n,o) o
86 #if defined(__cplusplus) || defined(c_plusplus)
87 #define __VARARG__ ...
91 #if defined(__STDARG__)
92 #define __VA_START__(p,a) va_start(p,a)
94 #define __VA_START__(p,a) va_start(p)
100 #include "FEATURE/ttys"
103 * complicated by the fact that there are so many variations
104 * This will use POSIX <termios.h> interface where available
108 # define tcgetattr _SYS_tcgetattr
109 # define tcsetattr _SYS_tcsetattr
110 # define tcgetpgrp _SYS_tcgetpgrp
111 # define tcsetpgrp _SYS_tcsetpgrp
112 # define cfgetospeed _SYS_cfgetospeed
113 # include <termios.h>
114 # if __sgi__ || sgi /* special hack to eliminate ^M problem */
116 # define ECHOCTL ECHOE
117 # endif /* ECHOCTL */
119 # define CNSUSP CNSWTCH
123 # define _lib_tcgetattr 1
124 # define _lib_tcgetpgrp 1
125 # endif /* _NEXT_SOURCE */
127 # if defined(_sys_termios) && defined(_lib_tcgetattr)
128 # define tcgetattr _SYS_tcgetattr
129 # define tcsetattr _SYS_tcsetattr
130 # define tcgetpgrp _SYS_tcgetpgrp
131 # define tcsetpgrp _SYS_tcsetpgrp
132 # define cfgetospeed _SYS_cfgetospeed
133 # include <sys/termios.h>
134 # define _hdr_termios
137 # endif /* _sys_termios */
138 #endif /* _hdr_termios */
148 # define TCSANOW TCSETS
149 # define TCSADRAIN TCSETSW
150 # define TCSAFLUSH TCSETSF
151 # endif /* TCSANOW */
152 /* The following corrects bugs in some implementations */
153 # if defined(TCSADFLUSH) && !defined(TCSAFLUSH)
154 # define TCSAFLUSH TCSADFLUSH
155 # endif /* TCSADFLUSH */
156 # ifndef _lib_tcgetattr
157 # define tcgetattr(fd,tty) ioctl(fd, TCGETS, tty)
158 # define tcsetattr(fd,action,tty) ioctl(fd, action, tty)
159 # define cfgetospeed(tp) ((tp)->c_cflag & CBAUD)
161 extern __MANGLE__ int tcgetattr __PROTO__((int, struct termios*));
162 extern __MANGLE__ int tcsetattr __PROTO__((int, int, const struct termios*));
163 extern __MANGLE__ int cfgetospeed __PROTO__((const struct termios*));
164 # endif /* _lib_tcgetattr */
166 # ifdef SHOPT_OLDTERMIO /* use both termios and termio */
171 # include <sys/termio.h>
172 # define _hdr_termio 1
174 # undef SHOPT_OLDTERMIO
175 # endif /* _sys_termio */
176 # endif /* _hdr_termio */
177 # endif /* SHOPT_OLDTERMIO */
179 # define cfgetospeed(tp) ((tp)->c_cflag & CBAUD)
180 # undef SHOPT_OLDTERMIO
185 # include <sys/termio.h>
186 # define _hdr_termio 1
187 # endif /* _sys_termio */
188 # endif /* _hdr_termio */
190 # define termios termio
192 # define tcgetattr(fd,tty) ioctl(fd, TCGETA, tty)
193 # define tcsetattr(fd,action,tty) ioctl(fd, action, tty)
196 # include <sys/bsdtty.h>
197 # endif /* _sys_bsdtty */
203 # include <sys/nttyio.h>
204 # endif /* _sys_nttyio */
205 # endif /* LPENDIN */
206 # define termios sgttyb
209 # endif /* TIOCSETN */
211 # define tcgetattr(fd,tty) ioctl(fd, TIOCGETP, tty)
212 # define tcsetattr(fd,action,tty) ioctl(fd, action, tty)
214 # define tcgetattr(fd,tty) gtty(fd, tty)
215 # define tcsetattr(fd,action,tty) stty(fd, tty)
216 # endif /* TIOCGETP */
217 # endif /* _hdr_sgtty */
218 # endif /* hdr_termio */
222 # define TCSANOW TCSETA
224 /* delays are too long, don't wait for output to drain */
225 # define TCSADRAIN TCSETA
227 # define TCSADRAIN TCSETAW
229 # define TCSAFLUSH TCSETAF
232 # define TCSANOW TIOCSETN
233 # define TCSADRAIN TIOCSETN
234 # define TCSAFLUSH TIOCSETP
235 # endif /* TIOCSETN */
236 # endif /* TCSETAW */
237 # endif /* TCSANOW */
238 #endif /* _hdr_termios */
240 /* set ECHOCTL if driver can echo control charaters as ^c */
243 # define ECHOCTL LCTLECH
244 # endif /* !ECHOCTL */
248 # define ECHOCTL LNEW_CTLECH
249 # endif /* !ECHOCTL */
250 #endif /* LNEW_CTLECH */
253 # define PENDIN LNEW_PENDIN
254 # endif /* !PENDIN */
255 #endif /* LNEW_PENDIN */
260 #endif /* !ECHOCTL */
264 # include <sys/filio.h>
265 # endif /* FIONREAD */
266 #endif /* _sys_filio */
267 /* set FIORDCHK if you can check for characters in input queue */
270 # define FIORDCHK FIONREAD
271 # endif /* !FIORDCHK */
272 #endif /* FIONREAD */
274 extern __MANGLE__ int tty_alt __PROTO__((int));
275 extern __MANGLE__ void tty_cooked __PROTO__((int));
276 extern __MANGLE__ int tty_get __PROTO__((int,struct termios*));
277 extern __MANGLE__ int tty_raw __PROTO__((int,int));
278 extern __MANGLE__ int tty_check __PROTO__((int));
279 extern __MANGLE__ int tty_set __PROTO__((int, int, struct termios*));
281 #endif /* _terminal_ */