summaryrefslogtreecommitdiffstats
path: root/buffer-poll.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicholas.marriott@gmail.com>2007-11-30 11:08:35 +0000
committerNicholas Marriott <nicholas.marriott@gmail.com>2007-11-30 11:08:35 +0000
commit3962c5f706adb92c3ca83aa1a8672920fe2aabf6 (patch)
treed11135f4e0c3ed5a04047deabcf441332d28b1e3 /buffer-poll.c
parent77386db04bfdfc6b1b5d81a5c0ebaf7280d0d019 (diff)
Change window name on \ek...\e\.
Diffstat (limited to 'buffer-poll.c')
-rw-r--r--buffer-poll.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/buffer-poll.c b/buffer-poll.c
index 50785e54..099ee4ad 100644
--- a/buffer-poll.c
+++ b/buffer-poll.c
@@ -1,4 +1,4 @@
-/* $Id: buffer-poll.c,v 1.3 2007-11-27 19:23:33 nicm Exp $ */
+/* $Id: buffer-poll.c,v 1.4 2007-11-30 11:08:34 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -24,6 +24,17 @@
#include "tmux.h"
+/* Set up pollfd for buffers. */
+void
+buffer_set(
+ struct pollfd *pfd, int fd, unused struct buffer *in, struct buffer *out)
+{
+ pfd->fd = fd;
+ pfd->events = POLLIN;
+ if (BUFFER_USED(out) > 0)
+ pfd->events |= POLLOUT;
+}
+
/* Fill buffers from socket based on poll results. */
int
buffer_poll(struct pollfd *pfd, struct buffer *in, struct buffer *out)
@@ -61,8 +72,7 @@ buffer_flush(int fd, struct buffer *in, struct buffer *out)
struct pollfd pfd;
while (BUFFER_USED(out) > 0) {
- pfd.fd = fd;
- pfd.events = POLLIN|POLLOUT;
+ buffer_set(&pfd, fd, in, out);
if (poll(&pfd, 1, INFTIM) == -1) {
if (errno == EAGAIN || errno == EINTR)