aboutsummaryrefslogtreecommitdiff
path: root/tty-write.c
diff options
context:
space:
mode:
authorTiago Cunha <tcunha@gmx.com>2009-07-22 18:08:56 +0000
committerTiago Cunha <tcunha@gmx.com>2009-07-22 18:08:56 +0000
commitb6afa30c3954d2d98304ea69b1375d7b51091cc9 (patch)
tree0443ed5819d4cf4499ab1993f14f889f91535adc /tty-write.c
parent75a44d856e6b8bf6b1b09c57d630e99c66774214 (diff)
downloadrtmux-b6afa30c3954d2d98304ea69b1375d7b51091cc9.tar.gz
rtmux-b6afa30c3954d2d98304ea69b1375d7b51091cc9.tar.bz2
rtmux-b6afa30c3954d2d98304ea69b1375d7b51091cc9.zip
Sync OpenBSD patchset 159:
There are relatively few arguments to tty_cmd_* functions now, so tidy them up by using a struct rather than hiding everything with varargs.
Diffstat (limited to 'tty-write.c')
-rw-r--r--tty-write.c48
1 files changed, 34 insertions, 14 deletions
diff --git a/tty-write.c b/tty-write.c
index 5f13bbda..08c2981b 100644
--- a/tty-write.c
+++ b/tty-write.c
@@ -1,4 +1,4 @@
-/* $Id: tty-write.c,v 1.19 2009-07-15 17:42:44 nicm Exp $ */
+/* $Id: tty-write.c,v 1.20 2009-07-22 18:08:56 tcunha Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -18,26 +18,48 @@
#include <sys/types.h>
+#include <string.h>
+
#include "tmux.h"
-void tty_vwrite_cmd(struct window_pane *, enum tty_cmd, va_list);
+void
+tty_write0(struct window_pane *wp, enum tty_cmd cmd)
+{
+ struct tty_ctx ctx;
+
+ memset(&ctx, 0, sizeof ctx);
+ ctx.wp = wp;
+ tty_write_cmd(cmd, &ctx);
+}
+
+void
+tty_writenum(struct window_pane *wp, enum tty_cmd cmd, u_int num)
+{
+ struct tty_ctx ctx;
+
+ memset(&ctx, 0, sizeof ctx);
+ ctx.wp = wp;
+ ctx.num = num;
+ tty_write_cmd(cmd, &ctx);
+}
void
-tty_write_cmd(struct window_pane *wp, enum tty_cmd cmd, ...)
+tty_writeptr(struct window_pane *wp, enum tty_cmd cmd, void *ptr)
{
- va_list ap;
+ struct tty_ctx ctx;
- va_start(ap, cmd);
- tty_vwrite_cmd(wp, cmd, ap);
- va_end(ap);
+ memset(&ctx, 0, sizeof ctx);
+ ctx.wp = wp;
+ ctx.ptr = ptr;
+ tty_write_cmd(cmd, &ctx);
}
void
-tty_vwrite_cmd(struct window_pane *wp, enum tty_cmd cmd, va_list ap)
+tty_write_cmd(enum tty_cmd cmd, struct tty_ctx *ctx)
{
- struct client *c;
- va_list aq;
- u_int i;
+ struct window_pane *wp = ctx->wp;
+ struct client *c;
+ u_int i;
if (wp == NULL)
return;
@@ -57,9 +79,7 @@ tty_vwrite_cmd(struct window_pane *wp, enum tty_cmd cmd, va_list ap)
if (c->session->curw->window == wp->window) {
tty_update_mode(&c->tty, c->tty.mode & ~MODE_CURSOR);
- va_copy(aq, ap);
- tty_vwrite(&c->tty, wp, cmd, aq);
- va_end(aq);
+ tty_write(&c->tty, cmd, ctx);
}
}
}