diff options
author | Tiago Cunha <tcunha@gmx.com> | 2009-09-23 14:44:02 +0000 |
---|---|---|
committer | Tiago Cunha <tcunha@gmx.com> | 2009-09-23 14:44:02 +0000 |
commit | 2acf349d4e855eeb8b5d8303cc89aec016210e30 (patch) | |
tree | e508d208378741436f6b487cc91f89087522f11a /tty.c | |
parent | acedc2dcf2673cf199ba1ba08705dc8fd270c0c7 (diff) | |
download | rtmux-2acf349d4e855eeb8b5d8303cc89aec016210e30.tar.gz rtmux-2acf349d4e855eeb8b5d8303cc89aec016210e30.tar.bz2 rtmux-2acf349d4e855eeb8b5d8303cc89aec016210e30.zip |
Sync OpenBSD patchset 346:
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 | 23 |
1 files changed, 22 insertions, 1 deletions
@@ -1,4 +1,4 @@ -/* $Id: tty.c,v 1.134 2009-09-23 14:39:30 tcunha Exp $ */ +/* $Id: tty.c,v 1.135 2009-09-23 14:44:02 tcunha 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) { |