This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Difference between Sun OS and cygwin?


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@DIJONG /home/Rob
>$ cat >file
>one.doc
>
>Robert Mark Bram@DIJONG /home/Rob
>$ od -c file
>0000000   o   n   e   .   d   o   c  \r  \n
>0000011
>
>Robert Mark Bram@DIJONG /home/Rob
>$ grep .doc$ file
>one.doc
>
>Robert Mark Bram@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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]