From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <199612100320.UAA00763@kangaroo.cs.arizona.edu> Date: Mon, 9 Dec 1996 20:20:56 -0700 From: David Mosberger-Tang Subject: mailx-5.5 fix I finally got tired of getting those silly 5 line windows when printing the mail headers from within "mail" ("h" command). Turns out setscreensize() in main.c depends on TIOCGETP which is not fully emulated in Linux (in particular the baudrates are always returned as 0). Since the TIOCGETP ioctl() call is deprecated, I figured it's better to fix mail (rather than the kernel). The patch below does this. I suppose it would be better to autoconf for tcgetattr(), but the check for __GNU_LIBRARY__ should be safe. Note that this bug is in no way Alpha specific. Also, I think it would be nice to document the "screen" variable. As far as I can tell, it's nowhere mentioned in the man page (sorry, I don't have a patch for this). --david --- main.c-old Mon Dec 9 20:08:32 1996 +++ main.c Mon Dec 9 20:07:39 1996 @@ -280,16 +280,29 @@ */ setscreensize() { - struct sgttyb tbuf; struct winsize ws; + speed_t ospeed = B9600; 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) +#ifdef __GNU_LIBRARY__ + { + struct termios tbuf; + + if (tcgetattr(1, &tbuf) == 0) + ospeed = cfgetospeed(&tbuf); + } +#else + { + struct sgttyb tbuf; + + if (ioctl(1, TIOCGETP, &tbuf) == 0) + ospeed = tbuf.sg_ospeed; + } +#endif + if (ospeed < B1200) screenheight = 9; - else if (tbuf.sg_ospeed == B1200) + else if (ospeed == B1200) screenheight = 14; else if (ws.ws_row != 0) screenheight = ws.ws_row; -- To unsubscribe: send e-mail to axp-list-request@redhat.com with 'unsubscribe' as the subject. Do not send it to axp-list@redhat.com