delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2003/04/22/22:41:19

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Date: Tue, 22 Apr 2003 21:52:55 -0400
From: "Pierre A. Humblet" <pierre DOT humblet AT ieee DOT org>
To: cygwin AT cygwin DOT com
Subject: Re: Erroneous line endings (cat,gawk,text mount)
Message-ID: <20030423015254.GA38081907@hpn5170x>
Mail-Followup-To: "Pierre A. Humblet" <pierre DOT humblet AT ieee DOT org>,
cygwin AT cygwin DOT com
References: <20030422232407 DOT GA41890375 AT hpn5170x> <Pine DOT GSO DOT 4 DOT 44 DOT 0304221942520 DOT 19398-100000 AT slinky DOT cs DOT nyu DOT edu>
Mime-Version: 1.0
In-Reply-To: <Pine.GSO.4.44.0304221942520.19398-100000@slinky.cs.nyu.edu>
User-Agent: Mutt/1.4i

On Tue, Apr 22, 2003 at 07:54:17PM -0400, Igor Pechtchanski wrote:
> On Tue, 22 Apr 2003, Pierre A. Humblet wrote:
> 
> > On Tue, Apr 22, 2003 at 10:54:41PM +0100, Peter S Tillier wrote:
> > > Replying to Igor Pechtchanski who wrote:
> > >
> > > > Also, "cat" will not translate line endings or anything at all --
> > > > it's just a character-by-character copy of stdin to stdout.
> > >
> > > Fair enough (and what I expect it to be) thanks for the clarification.
> >
> > Igor, how do you explain the following behavior?
> > ~: od -c
> > abc
> > 0000000   a   b   c  \n
> > 0000004
> > ~: cat | od -c
> > abc
> > 0000000   a   b   c  \r  \n
> > 0000005
> > This is with CYGWIN undefined and stty -igncr icrnl
> > I get the \r no matter what I try for CYGWIN and stty.
> >
> > Pierre
> 
> Pierre,
> 
> Simple - cat opens files (including stdin) in binary mode, and a Return on
> the console apparently sends a CRLF.  Try, for example, "cat -s" -- it
> opens stdin in text mode, and you will not get a CR.  I don't think there
> currently is an option that controls whether a console Return sends a CR.
> Intuitively, IMO, it should also be controlled by "binmode".  I'm guessing
> it's just a matter of copying some code from pipe.cc to fhandler_console.cc
> 	Igor

OK, but don't you expect "od" to also open files in binary mode? 
And what do you make out of this?
~: cat /dev/tty | od -c
abc
0000000   a   b   c  \n
0000004

Pierre


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019