=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/Attic/tty-write.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- src/usr.bin/tmux/Attic/tty-write.c 2009/07/14 07:23:36 1.4 +++ src/usr.bin/tmux/Attic/tty-write.c 2009/07/22 16:45:31 1.5 @@ -1,4 +1,4 @@ -/* $OpenBSD: tty-write.c,v 1.4 2009/07/14 07:23:36 nicm Exp $ */ +/* $OpenBSD: tty-write.c,v 1.5 2009/07/22 16:45:31 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -18,27 +18,49 @@ #include +#include + #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_write_cmd(struct window_pane *wp, enum tty_cmd cmd, ...) +tty_writenum(struct window_pane *wp, enum tty_cmd cmd, u_int num) { - 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.num = num; + tty_write_cmd(cmd, &ctx); } void -tty_vwrite_cmd(struct window_pane *wp, enum tty_cmd cmd, va_list ap) +tty_writeptr(struct window_pane *wp, enum tty_cmd cmd, void *ptr) { - struct client *c; - va_list aq; - u_int i; + struct tty_ctx ctx; + memset(&ctx, 0, sizeof ctx); + ctx.wp = wp; + ctx.ptr = ptr; + tty_write_cmd(cmd, &ctx); +} + +void +tty_write_cmd(enum tty_cmd cmd, struct tty_ctx *ctx) +{ + struct window_pane *wp = ctx->wp; + struct client *c; + u_int i; + if (wp == NULL) return; @@ -57,9 +79,7 @@ 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); } } }