diff options
author | 2012-09-24 13:39:10 +0000 | |
---|---|---|
committer | 2012-09-24 13:39:10 +0000 | |
commit | c98b4ad2b69c3a8036c3aa43bc0021c390096c5b (patch) | |
tree | 52e65e037428cf19ed2678bd7d469bb52b95a88b | |
parent | Use pgrp of pty fd not pid of immediate child when recovering current (diff) | |
download | wireguard-openbsd-c98b4ad2b69c3a8036c3aa43bc0021c390096c5b.tar.xz wireguard-openbsd-c98b4ad2b69c3a8036c3aa43bc0021c390096c5b.zip |
Add control_write_buffer, from George Nachman.
-rw-r--r-- | usr.bin/tmux/control.c | 11 | ||||
-rw-r--r-- | usr.bin/tmux/tmux.h | 3 |
2 files changed, 12 insertions, 2 deletions
diff --git a/usr.bin/tmux/control.c b/usr.bin/tmux/control.c index c858a55a47e..7db20bc3024 100644 --- a/usr.bin/tmux/control.c +++ b/usr.bin/tmux/control.c @@ -1,4 +1,4 @@ -/* $OpenBSD: control.c,v 1.3 2012/09/03 09:32:38 nicm Exp $ */ +/* $OpenBSD: control.c,v 1.4 2012/09/24 13:39:10 nicm Exp $ */ /* * Copyright (c) 2012 Nicholas Marriott <nicm@users.sourceforge.net> @@ -79,6 +79,15 @@ control_write(struct client *c, const char *fmt, ...) server_push_stdout(c); } +/* Write a buffer, adding a terminal newline. Empties buffer. */ +void +control_write_buffer(struct client *c, struct evbuffer *buffer) +{ + evbuffer_add_buffer(c->stdout_data, buffer); + evbuffer_add(c->stdout_data, "\n", 1); + server_push_stdout(c); +} + /* Control input callback. Read lines and fire commands. */ void control_callback(struct client *c, int closed, unused void *data) diff --git a/usr.bin/tmux/tmux.h b/usr.bin/tmux/tmux.h index f5a23700a11..b0eeea156b1 100644 --- a/usr.bin/tmux/tmux.h +++ b/usr.bin/tmux/tmux.h @@ -1,4 +1,4 @@ -/* $OpenBSD: tmux.h,v 1.356 2012/09/24 13:05:10 nicm Exp $ */ +/* $OpenBSD: tmux.h,v 1.357 2012/09/24 13:39:10 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -2221,6 +2221,7 @@ void clear_signals(int); /* control.c */ void control_callback(struct client *, int, void*); void printflike2 control_write(struct client *, const char *, ...); +void control_write_buffer(struct client *, struct evbuffer *); /* control-notify.c */ void control_notify_window_layout_changed(struct window *); |