Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 13 Aug 1995 09:08:31 -0600
From:      kelly@fsl.noaa.gov
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   bin/680: tip & termios problem
Message-ID:  <199508131508.JAA07381@rose.rg.com>
Resent-Message-ID: <199508131510.IAA26821@freefall.FreeBSD.org>

next in thread | raw e-mail | index | archive | help

>Number:         680
>Category:       bin
>Synopsis:       2.0.5's tip using termios doesn't act the way it did with sgtty
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Aug 13 08:10:01 PDT 1995
>Last-Modified:
>Originator:     Sean Kelly
>Organization:
NOAA Forecast Systems Laboratory - Boulder, Colorado USA
>Release:        FreeBSD 2.0-BUILT-19950603 i386
>Environment:

Any FreeBSD 2.0.5 environment with a modem should do.

>Description:

Some time between 2.0 and 2.0.5, someone upgraded tip so it stopped
using the old sgtty interface and used termios instead.  In doing so,
tip's handling of special control characters sent by the remote host
got fouled.  The function in question was raw(), in tip.c.  If I
substituted the old sgtty stuff in this function only, tip acted
correctly, like the way it did before.

Not one to hinder progress, I wanted to find out what was different
between tip's use of the sgtty and termios interfaces.  After all, the
sgtty interface should just go to functions in /sys/kern/tty_compat.c,
which should transform them into termios-styled settings, right?

USING SGTTY, HERE ARE TERMIOS SETTINGS AFTER raw():

termios iflag = 0x401 (IGNBRK, IXOFF)
        oflag = 0x2 (ONLCR)
        cflag = 0xb00 (CREAD, CS8)
        lflag = 0x20000003 (ECHOKE, ECHOE, PENDIN)
termios cc = 00 00 0377 00 00 00 00 0377 00 00 00 00 00 00 00 00 01 00 0377 0377 
termios ispeed = 0, ospeed = 0


USING TERMIOS, HERE ARE TERMIOS SETTINGS AFTER raw():

termios iflag = 0x2a22 (BRKINT, ISTRIP, IXANY, IXON, IMAXBEL)
        oflag = 0x3  (ONLCR, OPOST)
        cflag = 0xcb00  (CREAD, CS8, CLOCAL, HUPCL)
        lflag = 0x200004c3 (ECHOE, ECHOKE, ISIG, ECHOCTL, IEXTEN, PENDIN)
termios cc = 04 0377 0377 0177 027 025 022 0377 0377 0377 0377 0377 021 023 0377 0377 01 00 0377 0377 
termios ispeed = 9600, ospeed = 9600


Curiously enough, just clearing OPOST fixes the problem.


>How-To-Repeat:

Run tip over a modem to your favorite host; there, run Emacs.  Edit
files, move around.  In almost no time, Emacs's status line will get
fouled.  Indentation on screen should also get cruddy on seemingly
random lines.

>Fix:
	
*** tip.c.orig	Fri Mar 31 04:47:30 1995
--- tip.c	Sun Aug 13 08:21:30 1995
***************
*** 219,227 ****
--- 219,229 ----
  #ifndef _POSIX_SOURCE
  	ctermios.c_iflag = (IMAXBEL|IXANY|ISTRIP|IXON|BRKINT);
  	ctermios.c_lflag = (PENDIN|IEXTEN|ISIG|ECHOCTL|ECHOE|ECHOKE);
+ 	ctermios.c_oflag &= ~OPOST;
  #else
  	ctermios.c_iflag = (ISTRIP|IXON|BRKINT);
  	ctermios.c_lflag = (PENDIN|IEXTEN|ISIG|ECHOE);
+ 	ctermios.c_oflag &= ~OPOST;
  #endif
  	ctermios.c_cflag = (CLOCAL|HUPCL|CREAD|CS8);
  	ctermios.c_cc[VINTR] = 	ctermios.c_cc[VQUIT] = -1;


>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199508131508.JAA07381>