summaryrefslogtreecommitdiffstats
path: root/usr.bin/tmux/tty.c
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2012-02-15 17:25:02 +0000
committernicm <nicm@openbsd.org>2012-02-15 17:25:02 +0000
commit22d9fc4091f8869ffae7f0606bc70b7b321139a3 (patch)
treef6f82ea06402755727f90a6bc0f4cc6ec1c045c7 /usr.bin/tmux/tty.c
parentadd -A to usage(); (diff)
downloadwireguard-openbsd-22d9fc4091f8869ffae7f0606bc70b7b321139a3.tar.xz
wireguard-openbsd-22d9fc4091f8869ffae7f0606bc70b7b321139a3.zip
Add a wrapper function tty_set_size from George Nachman.
Diffstat (limited to 'usr.bin/tmux/tty.c')
-rw-r--r--usr.bin/tmux/tty.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/usr.bin/tmux/tty.c b/usr.bin/tmux/tty.c
index 3f5d0a2cd5a..1ce4b8fb8e8 100644
--- a/usr.bin/tmux/tty.c
+++ b/usr.bin/tmux/tty.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tty.c,v 1.113 2012/01/29 09:37:02 nicm Exp $ */
+/* $OpenBSD: tty.c,v 1.114 2012/02/15 17:25:02 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -93,10 +93,8 @@ tty_resize(struct tty *tty)
sx = 80;
sy = 24;
}
- if (sx == tty->sx && sy == tty->sy)
+ if (!tty_set_size(tty, sx, sy))
return (0);
- tty->sx = sx;
- tty->sy = sy;
tty->cx = UINT_MAX;
tty->cy = UINT_MAX;
@@ -117,6 +115,15 @@ tty_resize(struct tty *tty)
}
int
+tty_set_size(struct tty *tty, u_int sx, u_int sy) {
+ if (sx == tty->sx && sy == tty->sy)
+ return (0);
+ tty->sx = sx;
+ tty->sy = sy;
+ return (1);
+}
+
+int
tty_open(struct tty *tty, const char *overrides, char **cause)
{
char out[64];