xref: /illumos-gate/usr/src/cmd/ast/libast/amd64/FEATURE/tty (revision b30d1939)
1/* : : generated from contrib/ast/src/lib/libast/features/tty by iffe version 2012-07-17 : : */
2#ifndef _def_tty_ast
3#define _def_tty_ast	1
4#define _sys_types	1	/* #include <sys/types.h> ok */
5#define _hdr_termios	1	/* #include <termios.h> ok */
6#define _hdr_termio	1	/* #include <termio.h> ok */
7#define _hdr_sgtty	1	/* #include <sgtty.h> ok */
8#define _sys_termios	1	/* #include <sys/termios.h> ok */
9#define _sys_termio	1	/* #include <sys/termio.h> ok */
10#define _sys_ioctl	1	/* #include <sys/ioctl.h> ok */
11#define _lib_tcgetattr	1	/* tcgetattr() in default lib(s) */
12#define _lib_tcgetpgrp	1	/* tcgetpgrp() in default lib(s) */
13#define _mac__POSIX_VDISABLE	1	/* _POSIX_VDISABLE is a macro */
14
15#ifdef _hdr_termios
16#   if _mac__POSIX_VDISABLE
17#	undef _POSIX_VDISABLE
18#   endif
19#   include	<termios.h>
20#else
21#   if defined(_sys_termios) && defined(_lib_tcgetattr)
22#	include	<sys/termios.h>
23#	define _hdr_termios	1
24#   else
25#	undef _sys_termios
26#   endif /* _sys_termios */
27#endif /* _hdr_termios */
28
29#ifdef _hdr_termios
30#   undef _hdr_sgtty
31#   undef tcgetattr
32#   undef tcsetattr
33#   undef tcgetpgrp
34#   undef tcsetpgrp
35#   undef cfgetospeed
36#   ifndef TCSANOW
37#	define TCSANOW		TCSETS
38#	define TCSADRAIN	TCSETSW
39#	define TCSAFLUSH	TCSETSF
40#   endif /* TCSANOW */
41   /* The following corrects bugs in some implementations */
42#   if defined(TCSADFLUSH) && !defined(TCSAFLUSH)
43#	define TCSAFLUSH	TCSADFLUSH
44#   endif /* TCSADFLUSH */
45#   ifndef _lib_tcgetattr
46#	undef  tcgetattr
47#	define tcgetattr(fd,tty)	ioctl(fd, TCGETS, tty)
48#	undef  tcsetattr
49#	define tcsetattr(fd,action,tty)	ioctl(fd, action, tty)
50#	undef  cfgetospeed
51#	define cfgetospeed(tp)		((tp)->c_cflag & CBAUD)
52#   endif /* _lib_tcgetattr */
53#   undef TIOCGETC
54#else
55#   define cfgetospeed(tp)	((tp)->c_cflag & CBAUD)
56#   define cfgetispeed(tp)	((tp)->c_cflag & CBAUD)
57#   define cfsetispeed(tp,val)	((tp)->c_cflag &=~ CBAUD,(tp)->c_cflag|=(val))
58#   define cfsetospeed(tp,val)	((tp)->c_cflag &=~ CBAUD,(tp)->c_cflag|=(val))
59#   ifdef _hdr_termio
60#	include	<termio.h>
61#   else
62#	ifdef _sys_termio
63#	    include	<sys/termio.h>
64#	    define _hdr_termio 1
65#	endif /* _sys_termio */
66#   endif /* _hdr_termio */
67#   ifdef _hdr_termio
68#	define termios termio
69#	undef TIOCGETC
70#	define tcgetattr(fd,tty)	ioctl(fd, TCGETA, tty)
71#	define tcsetattr(fd,action,tty)	ioctl(fd, action, tty)
72
73#	ifdef _sys_bsdtty
74#	   include	<sys/bsdtty.h>
75#	endif /* _sys_bsdtty */
76#   else
77#	ifdef _hdr_sgtty
78#	    include	<sgtty.h>
79#	    ifndef LPENDIN
80#	        ifdef _sys_nttyio
81#		    include	<sys/nttyio.h>
82#	        endif /* _sys_nttyio */
83#	    endif /* LPENDIN */
84#	    define termios sgttyb
85#	    ifdef TIOCSETN
86#	 	undef TCSETAW
87#	    endif /* TIOCSETN */
88#	    ifdef TIOCGETP
89#		define tcgetattr(fd,tty)	ioctl(fd, TIOCGETP, tty)
90#		define tcsetattr(fd,action,tty)	ioctl(fd, action, tty)
91#	    else
92#		define tcgetattr(fd,tty)	gtty(fd, tty)
93#		define tcsetattr(fd,action,tty)	stty(fd, tty)
94#	    endif /* TIOCGETP */
95#	else
96#		ifdef _sys_ttyio
97#			include <sys/ttyio.h>
98#		endif
99#	endif /* _hdr_sgtty */
100#   endif /* hdr_termio */
101
102#   ifndef TCSANOW
103#	ifdef TCSETAW
104#	    define TCSANOW		TCSETA
105#	    define TCSAFLUSH		TCSETAF
106#	else
107#	    ifdef TIOCSETN
108#		define TCSANOW		TIOCSETN
109#		define TCSADRAIN	TIOCSETN
110#		define TCSAFLUSH	TIOCSETP
111#	    endif /* TIOCSETN */
112#	endif /* TCSETAW */
113#   endif /* TCSANOW */
114#endif /* _hdr_termios */
115
116/* set ECHOCTL if driver can echo control charaters as ^c */
117#ifdef LCTLECH
118#   ifndef ECHOCTL
119#	define ECHOCTL	LCTLECH
120#   endif /* !ECHOCTL */
121#endif /* LCTLECH */
122#ifdef LNEW_CTLECH
123#   ifndef ECHOCTL
124#	define ECHOCTL  LNEW_CTLECH
125#   endif /* !ECHOCTL */
126#endif /* LNEW_CTLECH */
127#ifdef LNEW_PENDIN
128#   ifndef PENDIN
129#	define PENDIN LNEW_PENDIN
130#  endif /* !PENDIN */
131#endif /* LNEW_PENDIN */
132
133
134#endif
135