1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-26 00:55:14 +00:00
freebsd-ports/japanese/mh/files/patch-uip_trmsbr.c
Edwin Groothuis 2851d32044 [Patch] japanese/mh: port to termios
The japanese/mh port is one of the last ports that still depends on
	COMPAT_43TTY, because it uses the sgtty programming interface. We'd
	better port it to the POSIX termios interface. The source code already
	contains code for SysV termio, which makes it easier to port.

PR:		ports/124466
Submitted by:	Ed Schouten <ed@FreeBSD.org>
Approved by:	maintainer timeout
2008-07-05 01:15:43 +00:00

52 lines
1.1 KiB
C

--- uip/trmsbr.c
+++ uip/trmsbr.c
@@ -5,19 +5,8 @@
#include "../h/mh.h"
#include <stdio.h>
-#ifndef SYS5
-#include <sgtty.h>
-#if defined(ULTRIX) && !defined(BSD43)
-#undef TIOCGWINSZ
-#endif
-#else /* SYS5 */
-#include <sys/types.h>
-#include <termio.h>
-#ifndef NOIOCTLH
#include <sys/ioctl.h>
-#endif /* NOIOCTLH */
-#undef TIOCGWINSZ
-#endif /* SYS5 */
+#include <termios.h>
#if BUFSIZ<2048
@@ -58,11 +47,7 @@
*term;
char *cp,
myterm[TXTSIZ];
-#ifndef SYS5
- struct sgttyb sg;
-#else /* SYS5 */
- struct termio sg;
-#endif /* SYS5 */
+ struct termios sg;
static int inited = 0;
if (inited++)
@@ -71,13 +56,7 @@
if ((term = getenv ("TERM")) == NULL || tgetent (myterm, term) <= OK)
return;
-#ifndef SYS5
- ospeed = ioctl (fileno (stdout), TIOCGETP, (char *) &sg) != NOTOK
- ? sg.sg_ospeed : 0;
-#else /* SYS5 */
- ospeed = ioctl (fileno (stdout), TCGETA, &sg) != NOTOK
- ? sg.c_cflag & CBAUD : 0;
-#endif /* SYS5 */
+ ospeed = tcgetattr (fileno (stdout), &sg) != NOTOK ? cfgetospeed(&sg) : 0;
HC = tgetflag ("hc");