From owner-freebsd-ports-bugs@FreeBSD.ORG Mon Jan 28 20:20:03 2008 Return-Path: Delivered-To: freebsd-ports-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6010616A41A for ; Mon, 28 Jan 2008 20:20:03 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 43AFB13C478 for ; Mon, 28 Jan 2008 20:20:03 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.2/8.14.2) with ESMTP id m0SKK3Dp065141 for ; Mon, 28 Jan 2008 20:20:03 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.2/8.14.1/Submit) id m0SKK3IQ065140; Mon, 28 Jan 2008 20:20:03 GMT (envelope-from gnats) Resent-Date: Mon, 28 Jan 2008 20:20:03 GMT Resent-Message-Id: <200801282020.m0SKK3IQ065140@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ports-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Ed Schouten Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B121D16A468 for ; Mon, 28 Jan 2008 20:13:52 +0000 (UTC) (envelope-from ed@hoeg.nl) Received: from palm.hoeg.nl (mx0.hoeg.nl [IPv6:2001:610:652::211]) by mx1.freebsd.org (Postfix) with ESMTP id 4083113C4CE for ; Mon, 28 Jan 2008 20:13:52 +0000 (UTC) (envelope-from ed@hoeg.nl) Received: by palm.hoeg.nl (Postfix, from userid 1000) id 9D19E1CDAB; Mon, 28 Jan 2008 21:13:51 +0100 (CET) Message-Id: <20080128201351.9D19E1CDAB@palm.hoeg.nl> Date: Mon, 28 Jan 2008 21:13:51 +0100 (CET) From: Ed Schouten To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Cc: Subject: ports/120097: [Patch] japanese/kterm16c: don't use sgtty, but termios X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Ed Schouten List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jan 2008 20:20:03 -0000 >Number: 120097 >Category: ports >Synopsis: [Patch] japanese/kterm16c: don't use sgtty, but termios >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Mon Jan 28 20:20:02 UTC 2008 >Closed-Date: >Last-Modified: >Originator: Ed Schouten >Release: FreeBSD 6.3-PRERELEASE i386 >Organization: >Environment: System: FreeBSD palm.hoeg.nl 6.3-PRERELEASE FreeBSD 6.3-PRERELEASE #0: Wed Dec 19 16:07:46 CET 2007 ed@palm.hoeg.nl:/usr/obj/usr/src/sys/PALM i386 >Description: One of the last remaining FreeBSD ports that still uses sgtty is japanese/kterm16c. If we switch this port to termios, it can still be used on systems that don't have COMPAT_43TTY in the kernel. We'd better port it to termios, which isn't hard, because it already runs on other platforms that use termios. >How-To-Repeat: >Fix: Place the following patch in the files/ directory. --- main.c 2008-01-28 08:42:32.000000000 +0100 +++ main.c 2008-01-28 08:42:25.000000000 +0100 @@ -224,8 +224,14 @@ #define HAS_UTMP_UT_HOST #endif #else /* } !SYSV { */ /* BSD systems */ -#ifndef linux -#include +#ifdef __FreeBSD__ +#include +#define USE_TERMIOS +#define USE_TERMINFO +#define USE_SYSV_TERMIO +#define termio termios +#define USE_POSIX_WAIT +#define HAS_POSIX_SAVED_IDS #endif #include #define HAS_UTMP_UT_HOST @@ -249,11 +255,6 @@ #include /* for NOFILE */ #endif -#if (BSD >= 199103) -#define USE_POSIX_WAIT -#define HAS_POSIX_SAVED_IDS -#endif - #include #include #include @@ -1293,7 +1294,7 @@ ** implementation to implementation). */ d_tio.c_iflag = ICRNL|IXON; - d_tio.c_oflag = OPOST|ONLCR|TAB3; + d_tio.c_oflag = OPOST|ONLCR|OXTABS; #if defined(macII) || defined(ATT) || defined(CRAY) /* { */ d_tio.c_cflag = B9600|CS8|CREAD|PARENB|HUPCL; d_tio.c_lflag = ISIG|ICANON|ECHO|ECHOE|ECHOK; @@ -1349,11 +1350,13 @@ #ifdef ECHOCTL d_tio.c_lflag |= ECHOCTL|IEXTEN; #endif +#ifndef __FreeBSD__ #ifdef NTTYDISC d_tio.c_line = NTTYDISC; #else d_tio.c_line = 0; #endif +#endif #ifdef __sgi d_tio.c_cflag &= ~(HUPCL|PARENB); d_tio.c_iflag |= BRKINT|ISTRIP|IGNPAR; @@ -1403,7 +1406,11 @@ for (i = 0; i <= 2; i++) { struct termio deftio; +#ifdef USE_TERMIOS + if (tcgetattr(i, &deftio) == 0) { +#else if (ioctl (i, TCGETA, &deftio) == 0) { +#endif d_tio.c_cc[VINTR] = deftio.c_cc[VINTR]; d_tio.c_cc[VQUIT] = deftio.c_cc[VQUIT]; d_tio.c_cc[VERASE] = deftio.c_cc[VERASE]; @@ -2370,7 +2377,11 @@ lmode = d_lmode; #endif /* TIOCLSET */ #ifdef USE_SYSV_TERMIO +#ifdef USE_TERMIOS + if(tcgetattr(tty, &tio) == -1) +#else if(ioctl(tty, TCGETA, &tio) == -1) +#endif tio = d_tio; #else /* not USE_SYSV_TERMIO */ @@ -2770,19 +2781,17 @@ tio.c_iflag &= ~(INLCR|IGNCR); tio.c_iflag |= ICRNL; /* ouput: cr->cr, nl is not return, no delays, ln->cr/nl */ - tio.c_oflag &= - ~(OCRNL|ONLRET|NLDLY|CRDLY|TABDLY|BSDLY|VTDLY|FFDLY); + tio.c_oflag &= ~(OCRNL|ONLRET); tio.c_oflag |= ONLCR; #ifdef OPOST tio.c_oflag |= OPOST; #endif /* OPOST */ #ifdef BAUD_0 /* baud rate is 0 (don't care) */ - tio.c_cflag &= ~(CBAUD); + cfsetspeed(&tio, 0); #else /* !BAUD_0 */ /* baud rate is 9600 (nice default) */ - tio.c_cflag &= ~(CBAUD); - tio.c_cflag |= B9600; + cfsetspeed(&tio, 9600); #endif /* !BAUD_0 */ tio.c_cflag &= ~CSIZE; if (screen->input_eight_bits) @@ -2895,7 +2904,11 @@ if (ioctl (tty, TIOCLSET, (char *)&lmode) == -1) HsSysError(cp_pipe[1], ERROR_TIOCLSET); #endif /* TIOCLSET */ +#ifdef USE_TERMIOS + if (tcsetattr(tty, TCSANOW, &tio) == -1) +#else if (ioctl (tty, TCSETA, &tio) == -1) +#endif HsSysError(cp_pipe[1], ERROR_TIOCSETP); #else /* USE_SYSV_TERMIO */ #ifdef KTERM >Release-Note: >Audit-Trail: >Unformatted: