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