ports/122889: [Patch] chinese/ve: remove sgtty

Ed Schouten ed at 80386.nl
Fri Apr 18 14:20:04 UTC 2008


>Number:         122889
>Category:       ports
>Synopsis:       [Patch] chinese/ve: remove sgtty
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Apr 18 14:20:03 UTC 2008
>Closed-Date:
>Last-Modified:
>Originator:     Ed Schouten
>Release:        FreeBSD 6.3-STABLE i386
>Organization:
>Environment:
System: FreeBSD palm.hoeg.nl 6.3-STABLE FreeBSD 6.3-STABLE #0: Fri Feb 1 16:35:28 CET 2008 root at palm.hoeg.nl:/usr/obj/usr/src/sys/PALM i386
>Description:
The chinese/ve port still uses sgtty. The source code is quite odd,
because it assumes termios is Linux-only, but also calls stty(1)
manually. We should just port this to termios, to make it work without
COMPAT_43TTY. I hope I've done it right.
>How-To-Repeat:
>Fix:
Apply the following patch:

--- chinese/ve/files/patch-bbs.h
+++ chinese/ve/files/patch-bbs.h
@@ -0,0 +1,16 @@
+--- bbs.h
++++ bbs.h
+@@ -26,13 +26,6 @@
+ #include <sys/file.h>
+ 
+ 
+-#ifdef	LINUX
+-#include <bsd/sgtty.h>
+-#else
+-#include <sgtty.h>
+-#endif
+-
+-
+ #ifdef  SYSV
+ 
+ #ifndef LOCK_EX
--- chinese/ve/files/patch-term.c
+++ chinese/ve/files/patch-term.c
@@ -0,0 +1,95 @@
+--- term.c
++++ term.c
+@@ -9,17 +9,16 @@
+ 
+ #include "bbs.h"
+ #include <sys/ioctl.h>
++#include <stdlib.h>
+ 
+ #ifdef HP_UX
+ #define O_HUPCL 01
+ #define O_XTABS 02
+ #endif
+ 
+-#ifdef LINUX
+-#include <linux/termios.h>
+-#define stty(fd, data) tcsetattr( fd, TCSETS, data )
++#include <termios.h>
++#define stty(fd, data) tcsetattr( fd, TCSANOW, data )
+ #define gtty(fd, data) tcgetattr( fd, data )
+-#endif
+ 
+ #ifndef TANDEM
+ #define TANDEM  0x00000001
+@@ -29,11 +28,7 @@
+ #define CBREAK  0x00000002
+ #endif
+ 
+-#ifdef LINUX
+ struct termios tty_state, tty_new;
+-#else
+-struct sgttyb tty_state, tty_new;
+-#endif
+ 
+ 
+ /* ----------------------------------------------------- */
+@@ -62,37 +57,11 @@
+   }
+   memcpy(&tty_new, &tty_state, sizeof(tty_new));
+ 
+-#ifdef  LINUX
+-
+-  tty_new.c_lflag &= ~(ICANON | ECHO | RAW | ISIG);
+-  tcsetattr(1, TCSANOW, &tty_new);
++  tty_new.c_lflag &= ~(ICANON | ECHO | ISIG);
+   restore_tty();
+-
+-#else
+-
+-  tty_new.sg_flags |= RAW;
+-
+-#ifdef  HP_UX
+-  tty_new.sg_flags &= ~(O_HUPCL | O_XTABS | LCASE | ECHO | CRMOD);
+-#else
+-  tty_new.sg_flags &= ~(TANDEM | CBREAK | LCASE | ECHO | CRMOD);
+-#endif
+-
+-  stty(1, &tty_new);
+-#endif
+ }
+ 
+ 
+-#ifdef LINUX
+-reset_tty()
+-{
+-   system("stty -raw echo");
+-}
+-restore_tty()
+-{
+-   system("stty raw -echo");
+-}
+-#else
+ void
+ reset_tty()
+ {
+@@ -104,8 +73,6 @@
+   stty(1, &tty_new);
+ }
+ 
+-#endif
+-
+ 
+ 
+ /* ----------------------------------------------------- */
+@@ -171,11 +138,7 @@
+   char *sbp, *s;
+   char *tgetstr();
+ 
+-#ifdef LINUX
+   ospeed = cfgetospeed(&tty_state);
+-#else
+-  ospeed = tty_state.sg_ospeed;
+-#endif
+ 
+   if (tgetent(buf, term) != 1)
+     return NA;
>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list