bug-gnu-utils
[Top][All Lists]
Advanced

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

Re: grep-2.4 and Macintosh files on GNU/Linux


From: Eli Zaretskii
Subject: Re: grep-2.4 and Macintosh files on GNU/Linux
Date: Fri, 15 Dec 2000 23:25:53 +0200

> From: Paul Eggert <address@hidden>
> Date: Fri, 15 Dec 2000 09:51:53 -0800 (PST)
> 
> > From: address@hidden (JF)
> > Date: Fri, 15 Dec 2000 07:24:24 +0100
> > 
> > So I have changed grep, to introduce a new option that will allow all
> > three formats in the same file at the same time.
> 
> In other words, you autoconvert input CRLF and plain CR to LF?

That behavior sounds as almost certianly a wrong one.  A given file
comes either from Unix-like system, or from DOS-like system, or from
Mac-like system.  So it will normally have one of the three possible
end-of-line (EOL) formats, but not all of them.  A file which mixes
several EOL formats is either a text file with random control
characters in it, or most probably a corrupted file which a user would
need to know about (because many other programs will choke on such a
file).

So I think it's okay to have two options that would convert DOS and
Mac EOLs to LF when the file is read, but an option that does both is
not a good idea.

> Is there precedent for this in other utilities?  If so, we should look
> to that precedent, for consistency.

Emacs is the only program I know of that supports all 3 EOL formats.
Emacs requires that a text file whose EOL format is not the Unix LF
style should have a consistent EOL format, either DOS or Mac.  If the
EOL format is consistent, Emacs determines what that format is and
converts it to the LF form; otherwise it shows all the CR characters
verbatim in the buffer.

You can force Emacs to convert DOS EOLs to Unix EOLs or Mac EOLs to
Unix EOLs, when it visits the file, but you cannot force it to convert
both DOS and Mac EOLs for the same file.



reply via email to

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