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