From owner-freebsd-current Sun Aug 13 21:52:06 1995 Return-Path: current-owner Received: (from majordom@localhost) by freefall.FreeBSD.org (8.6.11/8.6.6) id VAA28152 for current-outgoing; Sun, 13 Aug 1995 21:52:06 -0700 Received: from godzilla.zeta.org.au (godzilla.zeta.org.au [203.2.228.34]) by freefall.FreeBSD.org (8.6.11/8.6.6) with ESMTP id VAA28145 for ; Sun, 13 Aug 1995 21:51:58 -0700 Received: (from bde@localhost) by godzilla.zeta.org.au (8.6.9/8.6.9) id OAA18575; Mon, 14 Aug 1995 14:47:00 +1000 Date: Mon, 14 Aug 1995 14:47:00 +1000 From: Bruce Evans Message-Id: <199508140447.OAA18575@godzilla.zeta.org.au> To: kelly@fsl.noaa.gov Subject: Re: bin/680: tip & termios problem Cc: current@freebsd.org Sender: current-owner@freebsd.org Precedence: bulk >Curiously enough, just clearing OPOST fixes the problem. >... >>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; The sgttyb code simply set the RAW flag (and optionally the TANDEM flag) so the new code should simply call cfmakeraw() (and optionally set the IXOFF flag). All the flag settings above (except the new c_oflag one :-) are almost completely bogus: 1. Unseen flags are cleared unconditionally. Termios flags shall be set using "|=" and cleared using "&=". 2. All the iflags and lflags that are set should actually be cleared (see the cfmakeraw()) source. 3. HUPCL probably shouldn't be changed here and CLOCAL certainly shouldn't be changed here. 4. CSIZE must be cleared when CS8 is set; PARENB should probably be cleared when CS8 is set. 5. PENDIN shouldn't be in c_lflag. It isn't POSIX and shouldn't be changed by aplications, although cfmakeraw() clears it. 6. POSIXness of the source has little to do with POSIXness of the environment. Thus the application has to worry about warts like IMAXBEL (others like ECHOCTL and output flags are no problem because they are controlled by the standard flags ECHO and OPOST). I usually use `#undef _POSIX_SOURCE ... #ifdef IMAXBEL ... c_iflag &= ~IMAXBEL'. Bruce