summaryrefslogtreecommitdiffstats
path: root/server.c
diff options
context:
space:
mode:
authorTiago Cunha <tcunha@gmx.com>2009-10-12 00:35:08 +0000
committerTiago Cunha <tcunha@gmx.com>2009-10-12 00:35:08 +0000
commit6091b051fbf0a19ee9108b235b37265461727a41 (patch)
tree2d157d7642e44d890ea612e8c33ce9c2e7c5904d /server.c
parenta053aeddf89094080bb6744795d2539f7063a05f (diff)
Sync OpenBSD patchset 387:
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.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/server.c b/server.c
index 27ad3d34..0f9a0f4d 100644
--- a/server.c
+++ b/server.c
@@ -1,4 +1,4 @@
-/* $Id: server.c,v 1.205 2009-10-12 00:25:25 tcunha Exp $ */
+/* $Id: server.c,v 1.206 2009-10-12 00:35:08 tcunha Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -575,6 +575,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);
}
}
}
@@ -603,6 +610,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);