Subject: Re: When is \n converted to \r\n? and why?
From: [email-masked] (Earnie Boyd)

31 Oct 1998 23:15:13 -0800
Message-ID: <[email-masked]>
Reply-To: [email-masked]
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
To: Larry Hall <[email-masked]>, Urban Widmark <[email-masked]>,
        [email-masked]

---Larry Hall <[email-masked]> wrote:
>
> At 04:18 PM 10/28/98 +0100, Urban Widmark wrote:
> >(using cygwin32 19.3 & 19.1?)
> >
> >If I create a small example file:
> >
> >$ echo a > xx
> >$ ls -l xx
> >-rw-r--r--   1 544      everyone        3 Oct 28 15:43 xx
> >
> >it will contain "a\r\n" since I use the default (non-binary mounts)
> >
> >But if I do:
> >$ echo a | wc -c
> >      2
> >
> >I get only 2 chars ... ok, so the translation is done when writing to
> >disk. Then something like this will fail:
> >
> >$ echo a | tr -d '\r' > yy
> >$ ls -l yy
> >-rw-r--r--   1 544      everyone        3 Oct 28 15:48 yy
> >
> >So how am I supposed to remove the \r from the echo output?  Well,
I know
> >non-cygwin ways to remove the \r, the issue is if this is a tr bug, a
> >cygwin conversion bug or ...
> 
> Nope.  Its not a tr or any other kind of bug.  You said it yourself
above.
> Translation is done when writing to (and reading from) the disk. 
How can
> tr be expected to remove something that doesn't exist.  Remember,
text/
> binary modes have to do with how things are written to files on the
disk,
> not how they are handled in stdin, stdout, pipes, and whatever.
> 

`tr' should setmode(outdesc, O_BINARY) to avoid rewriting the \r.

==
-                  \\||//
-------------o0O0--Earnie--0O0o--------------
--          [email-masked]          --
-- http://www.freeyellow.com/members5/gw32 --
----------------ooo0O--O0ooo-----------------

PS: Newbie's, you should visit my page.
_________________________________________________________
DO YOU YAHOO!?
Get your free @yahoo.com address at http://mail.yahoo.com

-
For help on using this list (especially unsubscribing), send a message to
"[email-masked]" with one line of text: "help".