Date: Fri, 18 Apr 2008 16:15:24 +0200 (CEST) From: Ed Schouten <ed@80386.nl> To: FreeBSD-gnats-submit@FreeBSD.org Subject: ports/122889: [Patch] chinese/ve: remove sgtty Message-ID: <20080418141524.EF7E51CC6F@palm.hoeg.nl> Resent-Message-ID: <200804181420.m3IEK4dI047020@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>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@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:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20080418141524.EF7E51CC6F>