From ed@hoeg.nl  Mon Dec 31 14:56:14 2007
Return-Path: <ed@hoeg.nl>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 87EE616A476
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 31 Dec 2007 14:56:14 +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 2E29613C469
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 31 Dec 2007 14:56:14 +0000 (UTC)
	(envelope-from ed@hoeg.nl)
Received: by palm.hoeg.nl (Postfix, from userid 1000)
	id 982331CCD9; Mon, 31 Dec 2007 15:56:12 +0100 (CET)
Message-Id: <20071231145612.982331CCD9@palm.hoeg.nl>
Date: Mon, 31 Dec 2007 15:56:12 +0100 (CET)
From: Ed Schouten <ed@fxq.nl>
Reply-To: Ed Schouten <ed@fxq.nl>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: [Patch] chinese/celvis: use termios, not sgtty
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         119192
>Category:       ports
>Synopsis:       [Patch] chinese/celvis: use termios, not sgtty
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    miwi
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Dec 31 15:00:01 UTC 2007
>Closed-Date:    Thu Jan 10 11:47:57 UTC 2008
>Last-Modified:  Thu Jan 10 11:50:02 UTC 2008
>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:
The editor chinese/celvis makes use of the sgtty interface, which breaks
it when you run a kernel that has COMPAT_43TTY disabled. We'd better
port it to termios. It's simple in this case, because there is already
termio code.
>How-To-Repeat:
>Fix:
The following patch seems to fix celvis on my machine. Just place it in
the files/ directory.

--- curses.c	1991-09-21 23:42:07.000000000 +0200
+++ curses.c	2007-12-31 15:40:30.000000000 +0100
@@ -17,8 +17,13 @@
 #include "config.h"
 #include "vi.h"
 
+#undef BSD
+#undef UNIXV
+#define BSD	0
+#define UNIXV	1
+
 #if UNIXV
-# include	<termio.h>
+# include	<termios.h>
 #endif
 
 #if BSD || UNIX7 || MINIX
@@ -86,8 +91,8 @@
 char	ERASEKEY;	/* backspace key taken from ioctl structure */
 
 #if UNIXV
-static struct termio	oldtermio;	/* original tty mode */
-static struct termio	newtermio;	/* raw/noecho tty mode */
+static struct termios	oldtermio;	/* original tty mode */
+static struct termios	newtermio;	/* raw/noecho tty mode */
 #endif
 
 #if BSD || UNIX7 || MINIX
@@ -133,7 +138,7 @@
 
 	/* change the terminal mode to raw/noecho */
 #if UNIXV
-	ioctl(2, TCGETA, &oldtermio);
+	tcgetattr(2, &oldtermio);
 #endif
 
 #if BSD || UNIX7 || MINIX
@@ -170,7 +175,7 @@
 
 	/* change the terminal mode back the way it was */
 #if UNIXV
-	ioctl(2, TCSETAW, &oldtermio);
+	tcsetattr(2, TCSADRAIN, &oldtermio);
 #endif
 #if BSD || UNIX7 || MINIX
 	ioctl(2, TIOCSETP, &oldsgttyb);
@@ -190,7 +195,7 @@
 {	
 	/* change the terminal mode to raw/noecho */
 #if UNIXV
-	ospeed = (oldtermio.c_cflag & CBAUD);
+	ospeed = cfgetospeed(&oldtermio);
 	ERASEKEY = oldtermio.c_cc[VERASE];
 	newtermio = oldtermio;
 	newtermio.c_iflag &= (IXON|IXOFF|IXANY|ISTRIP|IGNBRK);
@@ -199,7 +204,7 @@
 	newtermio.c_cc[VINTR] = ctrl('C'); /* always use ^C for interrupts */
 	newtermio.c_cc[VEOF] = 1;	/* minimum # characters to read */
 	newtermio.c_cc[VEOL] = 2;	/* allow at least 0.2 seconds */
-	ioctl(2, TCSETAW, &newtermio);
+	tcsetattr(2, TCSADRAIN, &newtermio);
 #endif
 #if BSD || UNIX7 || MINIX
 	struct tchars	tbuf;
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-ports-bugs->miwi 
Responsible-Changed-By: miwi 
Responsible-Changed-When: Mon Dec 31 15:58:28 UTC 2007 
Responsible-Changed-Why:  
I'll take it. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=119192 
State-Changed-From-To: open->closed 
State-Changed-By: miwi 
State-Changed-When: Thu Jan 10 11:47:56 UTC 2008 
State-Changed-Why:  
Committed. Thanks! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=119192 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: ports/119192: commit references a PR
Date: Thu, 10 Jan 2008 11:47:53 +0000 (UTC)

 miwi        2008-01-10 11:47:48 UTC
 
   FreeBSD ports repository
 
   Added files:
     chinese/celvis/files patch-curses.c 
   Log:
   - Use termios, not sgtty
   
   PR:             119192
   Submitted by:   Ed Schouten <ed@fxq.nl>
   
   Revision  Changes    Path
   1.1       +67 -0     ports/chinese/celvis/files/patch-curses.c (new)
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 
>Unformatted:
