2 #include <sys/unistd.h>
3 #include <sys/termios.h>
7 tcsendbreak (int fd
, int dur
) {
9 if (_ioctl (fd
, _TCSBRK
, 0) == -1)
17 return _ioctl (fd
, _TCSBRK
, 1);
21 tcflush(int fd
, int what
) {
22 return _ioctl (fd
, _TCFLSH
, what
);
26 * I'm not positive about this function. I *think* it's right,
27 * but I could be missing something.
31 tcflow (int fd
, int action
) {
37 return _ioctl (fd
, _TCXONC
, action
);
39 * Here is where I'm not terribly certain. 1003.1 says:
40 * if action is TCIOFF, the system shall transmit a STOP
41 * character, which is intended to cause the terminal device
42 * to stop transmitting data to the system. (Similarly for
44 * I *assume* that means I find out what VSTOP for the
45 * terminal device is, and then write it. 1003.1 also does
46 * not say what happens if c_cc[VSTOP] is _POSIX_VDISABLE;
47 * I assume it should reaturn EINVAL, so that's what I do.
48 * Anyway, here's the code. It might or might not be right.
51 if (tcgetattr (fd
, &t
) == -1)
53 if (tcgetattr (fd
, &t
) == -1)
55 #ifdef _POSIX_VDISABLE
56 if (t
.c_cc
[VSTOP
] == _POSIX_VDISABLE
) {
61 if (write (fd
, &t
.c_cc
[VSTOP
], 1) == 1)
66 if (tcgetattr (fd
, &t
) == -1)
68 if (tcgetattr (fd
, &t
) == -1)
70 #ifdef _POSIX_VDISABLE
71 if (t
.c_cc
[VSTART
] == _POSIX_VDISABLE
) {
76 if (write (fd
, &t
.c_cc
[VSTART
], 1) == 1)