summaryrefslogtreecommitdiffstats
path: root/usr.bin/tmux/tty.c
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2009-09-23 06:12:58 +0000
committernicm <nicm@openbsd.org>2009-09-23 06:12:58 +0000
commitb588e6bc1283674389e11702e39165a4a0240532 (patch)
tree0ee3b8e4564131003d0d9af77b86243ba8c98b00 /usr.bin/tmux/tty.c
parentDon't attempt to open() the tty path, rely on the client sending its stdin fd (diff)
downloadwireguard-openbsd-b588e6bc1283674389e11702e39165a4a0240532.tar.xz
wireguard-openbsd-b588e6bc1283674389e11702e39165a4a0240532.zip
Trim some code by moving the ioctl(TIOCGWINSZ) after SIGWINCH from the client
into the server. This is another (the second of four) protocol version changes coming this morning, so again the server should be killed before upgrading.
Diffstat (limited to 'usr.bin/tmux/tty.c')
-rw-r--r--usr.bin/tmux/tty.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/usr.bin/tmux/tty.c b/usr.bin/tmux/tty.c
index 9ec4b83e4d6..aa85f9e051a 100644
--- a/usr.bin/tmux/tty.c
+++ b/usr.bin/tmux/tty.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tty.c,v 1.30 2009/09/23 06:05:02 nicm Exp $ */
+/* $OpenBSD: tty.c,v 1.31 2009/09/23 06:12:58 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -73,6 +73,27 @@ tty_init(struct tty *tty, int fd, char *term)
tty->term_flags = 0;
}
+void
+tty_resize(struct tty *tty)
+{
+ struct winsize ws;
+
+ if (ioctl(tty->fd, TIOCGWINSZ, &ws) != -1) {
+ tty->sx = ws.ws_col;
+ tty->sy = ws.ws_row;
+ }
+ if (tty->sx == 0)
+ tty->sx = 80;
+ if (tty->sy == 0)
+ tty->sy = 24;
+
+ tty->cx = UINT_MAX;
+ tty->cy = UINT_MAX;
+
+ tty->rupper = UINT_MAX;
+ tty->rlower = UINT_MAX;
+}
+
int
tty_open(struct tty *tty, const char *overrides, char **cause)
{