summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2012-09-24 13:39:11 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2012-09-24 13:39:11 +0000
commitec63b693db1bc2b8a84150d1f438859d0b6ce1f5 (patch)
tree9f2718ce55bcc7846c10044aa9aeb78ad5f03481
parent861e810526bf6ff5ee92581472c63dcd370ecc2f (diff)
Add control_write_buffer, from George Nachman.
-rw-r--r--usr.bin/tmux/control.c11
-rw-r--r--usr.bin/tmux/tmux.h3
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 *);