From bernd@heitec.net  Thu Jul 29 15:42:26 2004
Return-Path: <bernd@heitec.net>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 45AFB16A4CE
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 29 Jul 2004 15:42:26 +0000 (GMT)
Received: from christel.heitec.net (christel.heitec.net [213.70.109.3])
	by mx1.FreeBSD.org (Postfix) with ESMTP id AC58D43D60
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 29 Jul 2004 15:42:25 +0000 (GMT)
	(envelope-from bernd@heitec.net)
Received: from heitec.net (paladin.heitec.net [193.101.232.30])
	by christel.heitec.net (Postfix) with ESMTP id C563655479
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 29 Jul 2004 17:42:06 +0200 (CEST)
Received: (from bernd@localhost)
	by  heitec.net (8.12.11/8.12.11) id i6TFg6LY062260;
	Thu, 29 Jul 2004 17:42:06 +0200 (CEST)
	(envelope-from bernd)
Message-Id: <200407291542.i6TFg6LY062260@ heitec.net>
Date: Thu, 29 Jul 2004 17:42:06 +0200 (CEST)
From: Bernd Luevelsmeyer <bernd@heitec.net>
Reply-To: Bernd Luevelsmeyer <bdluevel@heitec.net>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: /usr/bin/tip strips hi-bit
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         69763
>Category:       bin
>Synopsis:       [patch] /usr/bin/tip strips hi-bit
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Jul 29 15:50:21 GMT 2004
>Closed-Date:    Tue May 03 00:55:20 GMT 2005
>Last-Modified:  Tue May 03 00:55:20 GMT 2005
>Originator:     Bernd Luevelsmeyer
>Release:        FreeBSD 4.10-STABLE i386
>Organization:
>Environment:
System: FreeBSD 4.10-STABLE

>Description:
The tool /usr/bin/tip (a terminal program for serial lines)
strips input and output to 7 bits. This makes it impossible to
e.g. use german umlauts or accented characters.

>How-To-Repeat:
Connect to a remote system with tip, and type such characters
or 'cat' a file that contains them.

>Fix:
Apply these two patches:

--- usr.bin/tip/tip/tip.c.orig	Sat Jun  2 10:08:24 2001
+++ usr.bin/tip/tip/tip.c	Thu Jul 29 16:07:19 2004
@@ -231,10 +231,10 @@
 	tcgetattr (0, &otermios);
 	ctermios = otermios;
 #ifndef _POSIX_SOURCE
-	ctermios.c_iflag = (IMAXBEL|IXANY|ISTRIP|IXON|BRKINT);
+	ctermios.c_iflag = (IMAXBEL|IXANY|IXON|BRKINT);
 	ctermios.c_lflag = (PENDIN|IEXTEN|ISIG|ECHOCTL|ECHOE|ECHOKE);
 #else
-	ctermios.c_iflag = (ISTRIP|IXON|BRKINT);
+	ctermios.c_iflag = (IXON|BRKINT);
 	ctermios.c_lflag = (PENDIN|IEXTEN|ISIG|ECHOE);
 #endif
 	ctermios.c_cflag = (CLOCAL|HUPCL|CREAD|CS8);
@@ -435,7 +435,8 @@
 tipin()
 {
 	int i;
-	char gch, bol = 1;
+	unsigned char gch;
+	char bol = 1;
 
 	atexit(killchild);
 
@@ -455,11 +456,11 @@
 		i = getchar();
 		if (i == EOF)
 			break;
-		gch = i&0177;
-		if ((gch == character(value(ESCAPE))) && bol) {
+		gch = i;
+		if (((gch&0177) == character(value(ESCAPE))) && bol) {
 			if (!(gch = escape()))
 				continue;
-		} else if (!cumode && gch == character(value(RAISECHAR))) {
+		} else if (!cumode && (gch&0177) == character(value(RAISECHAR))) {
 			boolean(value(RAISE)) = !boolean(value(RAISE));
 			continue;
 		} else if (gch == '\r') {
@@ -468,11 +469,11 @@
 			if (boolean(value(HALFDUPLEX)))
 				printf("\r\n");
 			continue;
-		} else if (!cumode && gch == character(value(FORCE))) {
+		} else if (!cumode && (gch&0177) == character(value(FORCE))) {
 			i = getchar();
 			if (i == EOF)
 				break;
-			gch = i & 0177;
+			gch = i;
 		}
 		bol = any(gch, value(EOL));
 		if (boolean(value(RAISE)) && islower(gch))

--- usr.bin/tip/tip/tipout.c.orig	Sat Jun  2 10:08:24 2001
+++ usr.bin/tip/tip/tipout.c	Thu Jul 29 16:05:50 2004
@@ -158,8 +158,6 @@
 		}
 #define	ALLSIGS	sigmask(SIGEMT)|sigmask(SIGTERM)|sigmask(SIGIOT)|sigmask(SIGSYS)
 		omask = sigblock(ALLSIGS);
-		for (cp = buf; cp < buf + cnt; cp++)
-			*cp &= 0177;
 		if (write(1, buf, cnt) < 0)
 			exit(1);
 		if (boolean(value(SCRIPT)) && fscript != NULL) {
>Release-Note:
>Audit-Trail:
Fix synopsis to contain [patch]-tag. -- vs

From: Bernd Luevelsmeyer <bdluevel@heitec.net>
To: bug-followup@FreeBSD.org, bdluevel@heitec.net
Cc:  
Subject: Re: bin/69763: [patch] /usr/bin/tip strips hi-bit
Date: Mon, 02 May 2005 15:39:14 +0200

 After upgrading to 5-STABLE, I found that tip is no longer stripping the
 8th bit. The PR should be closed.
State-Changed-From-To: open->closed 
State-Changed-By: linimon 
State-Changed-When: Tue May 3 00:54:51 GMT 2005 
State-Changed-Why:  
Submitter notes that the problem does not recur on 5-STABLE. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=69763 
>Unformatted:
