summaryrefslogtreecommitdiffstats
path: root/tty.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@openbsd.org>2012-02-15 17:25:02 +0000
committerNicholas Marriott <nicm@openbsd.org>2012-02-15 17:25:02 +0000
commitfddbd44c185c44ad1fff37d5113519eda883e702 (patch)
treed9b892ff41a00d09b237ba1980b286b0bf43f22d /tty.c
parent67949de0a173901fc741674c31bb971172442ec9 (diff)
Add a wrapper function tty_set_size from George Nachman.
Diffstat (limited to 'tty.c')
-rw-r--r--tty.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/tty.c b/tty.c
index 6e3e2cf2..6b0e503d 100644
--- a/tty.c
+++ b/tty.c
@@ -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];