bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Text tools, line endings, and O_TEXT


From: Bob Proulx
Subject: Re: Text tools, line endings, and O_TEXT
Date: Thu, 6 Sep 2007 13:26:56 -0600
User-agent: Mutt/1.5.9i

Micah Cowan wrote:
> If you intend for all text tools to recognize all line endings, wouldn't
> it be better to always open in binary mode so the program can handle the
> line-endings?

I often feel that way too.  If everything is binary mode then
everything always makes sense all of the time.  Of course I am coming
from a Unix background and this is the way of things there.

But this is difficult in practice.  A classic example is 'cat'.
Should it open the files in binary or text mode?  If concatenating
binary data files then text mode would corrupt the data.  If the
output is a file then perhaps binary always works.  But if the input
are text files and the output is a terminal then text mode is
desirable.  I don't think there is one right answer in that case
because the operating model is just too different.  This is why
heuristics are applied such as cygwin is doing to take the best guess
possible at doing what the user wants.  It is a compromise.

Bob




reply via email to

[Prev in Thread] Current Thread [Next in Thread]