diff options
author | Nicholas Marriott <nicm@openbsd.org> | 2009-09-23 06:12:58 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@openbsd.org> | 2009-09-23 06:12:58 +0000 |
commit | 962fa20b36cc6d38d9a44612441f3f706c29b71e (patch) | |
tree | 67bd9d4f19a42af4dddda24051323e332e56b98f /tty.c | |
parent | 64caf59e84c3ae1c06773bb8ec91165eeedabe6d (diff) | |
download | rtmux-962fa20b36cc6d38d9a44612441f3f706c29b71e.tar.gz rtmux-962fa20b36cc6d38d9a44612441f3f706c29b71e.tar.bz2 rtmux-962fa20b36cc6d38d9a44612441f3f706c29b71e.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 'tty.c')
-rw-r--r-- | tty.c | 21 |
1 files changed, 21 insertions, 0 deletions
@@ -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) { |