Add a wrapper function tty_set_size from George Nachman.

This commit is contained in:
Nicholas Marriott
2012-02-15 17:25:02 +00:00
parent 67949de0a1
commit fddbd44c18
2 changed files with 11 additions and 3 deletions

13
tty.c
View File

@@ -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;
@@ -116,6 +114,15 @@ tty_resize(struct tty *tty)
return (1);
}
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)
{