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

1 Nov 1998 01:34:41 -0800
Message-ID: <[email-masked]>
Reply-To: [email-masked]
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
To: Urban Widmark <[email-masked]>, Larry Hall <[email-masked]>
Cc: [email-masked]

---Urban Widmark <[email-masked]> wrote:
>
> On Thu, 29 Oct 1998, Larry Hall wrote:
> 
> > 
> > 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.
> > 
> 
> Which means writing the file to disk and then doing cat is not the
same as
> piping it directly. I think that is wrong.
> 

Yep!  Me too.

> Or is the \r removed when reading a \r\n file from disk with text
mode? 
> Is it always removed or does it depend on the program I use (eg cat
> doesn't remove it, tr/wc does ...).

In text mode processing the read function will remove the \r and
return subtract it from the count of bytes read.  If the file contains
only \n it will be read also, the only difference is that the \r is
removed and not counted as read and a C-z will cause a EOF.

Unless you've personally modified them cat, tr and wc use the default
processing mode which you have appropriately set to text mode.

> 
> The amount of problems this will cause seems endless if I have to
remember
> which programs convert and which doesn't. Assuming it matters for
the end
> result, which it did in this case, the windows program wouldn't work
if
> the configuration files we tried to generate contained \r. A bug in
that
> software? definitely! But the cygwin behaviour is still confusing.
> 

What _WINDOWS_ program doesn't like a \r\n?  Please inform us as this
is very unwindows like.

> 
> Btw, I don't have anything against \r\n, I just don't like when
programs
> convert things automagically when I haven't told them to do so ... I
guess
> it's a control thingy. :)

No what you mean.  But, if you understand what is happening you can
adjust for it.

==
-                  \\||//
-------------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".