delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2002/05/31/00:42:14

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: Fri, 31 May 2002 00:41:20 -0400
From: Christopher Faylor <cgf AT redhat DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: Difference between Sun OS and cygwin?
Message-ID: <20020531044120.GA14436@redhat.com>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <20020531033213 DOT GA11456 AT redhat DOT com> <AHENJAAPGAHKCFPLDPOJCEKJCGAA DOT relaxedrob AT optushome DOT com DOT au>
Mime-Version: 1.0
In-Reply-To: <AHENJAAPGAHKCFPLDPOJCEKJCGAA.relaxedrob@optushome.com.au>
User-Agent: Mutt/1.3.23.1i

On Fri, May 31, 2002 at 01:51:44PM +1000, Robert Mark Bram wrote:
>Howdy Christopher!
>
>Well, I get this when I do od:
>
>Robert Mark Bram AT DIJONG /home/Rob
>$ cat >file
>one.doc
>
>Robert Mark Bram AT DIJONG /home/Rob
>$ od -c file
>0000000   o   n   e   .   d   o   c  \r  \n
>0000011
>
>Robert Mark Bram AT DIJONG /home/Rob
>$ grep .doc$ file
>one.doc
>
>Robert Mark Bram AT DIJONG /home/Rob
>$
>
>
>
>So my question then is: why doesn't \r\n count as end of the line for $ in
>grep?
>
>And then.. is there a way I can fix it so it works the same in Cygwin as it
>would for Sun?

I spent the last hour trying to track down this "cygwin bug".  It sure didn't
seem to be working the way that I expected.

What I found is that this is a cat "feature":

  /* If stdin is a terminal device, and it is the ONLY
     input file (i.e. we didn't write anything to the
     output yet), switch the output back to TEXT mode.
     This is so "cat > xyzzy" creates a DOS-style text
     file, like people expect.  */
  if (tty_in && optind <= argc)
    setmode (output_desc, O_TEXT);

This is from the cat sources.  I'm a person but I wouldn't expect that
particular behavior.

A workaround may be to do:

cat /dev/tty > filter

That tricks cat into thinking it has an argument so it won't do
any help binmode/textmode conversions.

cgf

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.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