Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
* mailx-5.5 fix
@ 1996-12-10  3:20 David Mosberger-Tang
  0 siblings, 0 replies; only message in thread
From: David Mosberger-Tang @ 1996-12-10  3:20 UTC (permalink / raw)


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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1996-12-10  3:20 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1996-12-10  3:20 mailx-5.5 fix David Mosberger-Tang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox