summaryrefslogtreecommitdiffstats
path: root/usr.bin/mail/main.c
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>1996-08-19 20:23:35 +0000
committerpeter <peter@FreeBSD.org>1996-08-19 20:23:35 +0000
commitd093c7b48e95c00d2fcbc70970b1e99c1a5712b7 (patch)
tree2f7a1aed406bea4049bb1f4e000e564c5c306112 /usr.bin/mail/main.c
parent65b6e7181bc8bde1918c94186c38543764663453 (diff)
downloadFreeBSD-src-d093c7b48e95c00d2fcbc70970b1e99c1a5712b7.zip
FreeBSD-src-d093c7b48e95c00d2fcbc70970b1e99c1a5712b7.tar.gz
Simplistic conversion of mail to use termios instead of sgtty.
Diffstat (limited to 'usr.bin/mail/main.c')
-rw-r--r--usr.bin/mail/main.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/usr.bin/mail/main.c b/usr.bin/mail/main.c
index 1e1579b..e912ccb 100644
--- a/usr.bin/mail/main.c
+++ b/usr.bin/mail/main.c
@@ -274,16 +274,19 @@ hdrstop(signo)
void
setscreensize()
{
- struct sgttyb tbuf;
struct winsize ws;
+ struct termios tio;
+ speed_t speed = 0;
if (ioctl(1, TIOCGWINSZ, (char *) &ws) < 0)
ws.ws_col = ws.ws_row = 0;
- if (ioctl(1, TIOCGETP, &tbuf) < 0)
- tbuf.sg_ospeed = B9600;
- if (tbuf.sg_ospeed < B1200)
+ if (tcgetattr(1, &tio) != -1)
+ speed = cfgetospeed(&tio);
+ if (speed <= 0)
+ speed = B9600;
+ if (speed < B1200)
screenheight = 9;
- else if (tbuf.sg_ospeed == B1200)
+ else if (speed == B1200)
screenheight = 14;
else if (ws.ws_row != 0)
screenheight = ws.ws_row;
OpenPOWER on IntegriCloud