aboutsummaryrefslogtreecommitdiff
path: root/server.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@openbsd.org>2009-10-11 10:04:27 +0000
committerNicholas Marriott <nicm@openbsd.org>2009-10-11 10:04:27 +0000
commit64b5f39656f02a7c4cc6d5d4690c9b0ccc3f6c15 (patch)
tree8bed8b653ea30e3ff461250de53d37ab011b4fb2 /server.c
parent325e20d76d25685a3a7d9e5042928b2691c7bc8f (diff)
downloadrtmux-64b5f39656f02a7c4cc6d5d4690c9b0ccc3f6c15.tar.gz
rtmux-64b5f39656f02a7c4cc6d5d4690c9b0ccc3f6c15.tar.bz2
rtmux-64b5f39656f02a7c4cc6d5d4690c9b0ccc3f6c15.zip
Add a pipe-pane command to allow a pane to be piped to a shell command, for
example: pipe-pane 'cat >~/out' No arguments stops outputing and closes the pipe; the -o flag toggles a pipe and on and off (useful for key bindings). Suggested by espie@.
Diffstat (limited to 'server.c')
-rw-r--r--server.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/server.c b/server.c
index bf9aba94..18152b85 100644
--- a/server.c
+++ b/server.c
@@ -572,6 +572,13 @@ server_fill_windows(void)
if (BUFFER_USED(wp->out) > 0)
events |= POLLOUT;
server_poll_add(wp->fd, events);
+
+ if (wp->pipe_fd == -1)
+ continue;
+ events = 0;
+ if (BUFFER_USED(wp->pipe_buf) > 0)
+ events |= POLLOUT;
+ server_poll_add(wp->pipe_fd, events);
}
}
}
@@ -600,6 +607,16 @@ server_handle_windows(void)
wp->fd = -1;
} else
server_handle_window(w, wp);
+
+ if (wp->pipe_fd == -1)
+ continue;
+ if ((pfd = server_poll_lookup(wp->pipe_fd)) == NULL)
+ continue;
+ if (buffer_poll(pfd, NULL, wp->pipe_buf) != 0) {
+ buffer_destroy(wp->pipe_buf);
+ close(wp->pipe_fd);
+ wp->pipe_fd = -1;
+ }
}
server_check_window(w);