*BSD News Article 8512


Return to BSD News archive

Path: sserve!manuel.anu.edu.au!munnari.oz.au!hp9000.csc.cuhk.hk!saimiri.primate.wisc.edu!caen!uunet!mcsun!fuug!kiae!demos!newsserv
From: "Andrew A. Chernov, Black Mage" <ache@astral.msk.su>
Newsgroups: comp.unix.bsd
Subject: Re: Patch tty driver for correct handle COMPAT_43 tty modes (SECOND patch)
Date: Wed, 02 Dec 92 23:22:35 +0300
Distribution: world
Organization: Ha-oh-lahm Yetzirah
Message-ID: <qCBiH7hi40@astral.msk.su>
Sender: news-service@newcom.kiae.su
Reply-To: ache@astral.msk.su
Keywords: COMPAT_43 386bsd tty driver
References: <hF7BK5hiH1@astral.msk.su>
Lines: 68

In comp.unix.bsd article <hF7BK5hiH1@astral.msk.su> Andrew A. Chernov
    writes:

>Hi,
>I found this bug in following situation:
>my current tty modes: -parity cs8 -istrip
>When I call any program that use CBREAK (COMPAT_43) mode,
>tty modes resets to: cs7 parenb istrip,
>so, I lost my 8-bit characters.
>
>I produce this patch to fix this and some more situations.
>I made COMPAT_43 modes and POSIX modes as close as
>possible.

[first patch skipped]

I found another bug after my first patch:
if anybody set and clear RAW mode, OPOST & IXANY modes stuck.
Here is small patch (thanx to pasha@kiae.su) to correct this situation.
REMEMBER: it is SECOND patch, apply my first patch before.

*** tty_compat.c.was1	Thu Nov 26 22:38:06 1992
--- tty_compat.c	Wed Dec  2 23:05:17 1992
***************
*** 242,249 ****
  		} else
  			flags |= EVENP | ODDP;
  	}
- 	if (!(oflag&OPOST) && (!(cflag&PARENB) || (cflag&CSIZE) == CS8))
- 		flags |= LITOUT;
  	if ((cflag&CSIZE) == CS8 && !(iflag&ISTRIP))
  		flags |= PASS8;
  	
--- 242,247 ----
***************
*** 254,259 ****
--- 252,259 ----
  		else
  			flags |= RAW;
  	}
+ 	if (!(flags&RAW) && !(oflag&OPOST) && (!(cflag&PARENB) || (cflag&CSIZE) == CS8))
+ 		flags |= LITOUT;
  	if (oflag&OXTABS)
  		flags |= XTABS;
  	if (lflag&ECHOE)
***************
*** 283,289 ****
  	register long cflag = t->c_cflag;
  
  	if (flags & RAW) {
! 		iflag &= IXOFF;
  		oflag &= ~OPOST;
  		lflag &= ~(ECHOCTL|ISIG|ICANON|IEXTEN);
  	} else {
--- 283,289 ----
  	register long cflag = t->c_cflag;
  
  	if (flags & RAW) {
! 		iflag &= (IXOFF|IXANY);
  		oflag &= ~OPOST;
  		lflag &= ~(ECHOCTL|ISIG|ICANON|IEXTEN);
  	} else {
-- 
In-This-Life:  Andrew A. Chernov    |  "Hay mas dicha, mas contento
Internet:      ache@astral.msk.su   |  "Que adorar una hermosura
Organization:  The RELCOM Corp.,    |  "Brujuleada entre los lejos
               Moscow, Russia       |  "De lo imposible?!"  (Calderon)