diff options
Diffstat (limited to '')
-rw-r--r-- | broadcast.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/broadcast.c b/broadcast.c index afea3e4..c31112e 100644 --- a/broadcast.c +++ b/broadcast.c @@ -85,6 +85,7 @@ int main(int argc, char *argv[]) { } char buf[4096]; + ssize_t totalSize = 0; struct pollfd fds[2] = { { .fd = input, .events = POLLIN }, { .fd = pty, .events = POLLIN }, @@ -110,6 +111,14 @@ int main(int argc, char *argv[]) { writeSize = write(remote, buf, readSize); if (writeSize < 0) err(EX_IOERR, "write(%d)", remote); if (writeSize < readSize) errx(EX_IOERR, "short write(%d)", remote); + + totalSize += readSize; + if (totalSize > 1024 * 1024) { + buf[0] = CTRL('L'); + writeSize = write(pty, buf, 1); + if (writeSize < 0) err(EX_IOERR, "write(%d)", pty); + totalSize = 0; + } } int status; |