version 1.10, 2007/10/17 20:10:44 |
version 1.11, 2013/04/21 09:51:24 |
|
|
|
|
/* EmptyTerminal - called to make sure that the terminal buffer is empty. |
/* EmptyTerminal - called to make sure that the terminal buffer is empty. |
* Note that we consider the buffer to run all the |
* Note that we consider the buffer to run all the |
* way to the kernel (thus the select). |
* way to the kernel (thus the poll). |
*/ |
*/ |
|
|
void |
void |
EmptyTerminal() |
EmptyTerminal() |
{ |
{ |
#if defined(unix) |
struct pollfd pfd[1]; |
fd_set outs; |
|
|
|
FD_ZERO(&outs); |
pfd[0].fd = tout; |
#endif /* defined(unix) */ |
pfd[0].events = POLLOUT; |
|
|
if (TTYBYTES() == 0) { |
if (TTYBYTES() == 0) { |
#if defined(unix) |
(void) poll(pfd, 1, -1); /* wait for TTLOWAT */ |
FD_SET(tout, &outs); |
|
(void) select(tout+1, (fd_set *) 0, &outs, (fd_set *) 0, |
|
(struct timeval *) 0); /* wait for TTLOWAT */ |
|
#endif /* defined(unix) */ |
|
} else { |
} else { |
while (TTYBYTES()) { |
while (TTYBYTES()) { |
(void) ttyflush(0); |
(void) ttyflush(0); |
#if defined(unix) |
(void) poll(pfd, 1, -1); /* wait for TTLOWAT */ |
ttyflush(0); |
|
FD_SET(tout, &outs); |
|
(void) select(tout+1, (fd_set *) 0, &outs, (fd_set *) 0, |
|
(struct timeval *) 0); /* wait for TTLOWAT */ |
|
#endif /* defined(unix) */ |
|
} |
} |
} |
} |
} |
} |