[Top][All Lists]

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

Re: Questions about patch

From: Eli Zaretskii
Subject: Re: Questions about patch
Date: Sat, 02 Apr 2005 13:06:23 +0300

> From: "Gary Setter" <address@hidden>
> Date: Fri, 1 Apr 2005 08:08:10 -0600
> Cc: address@hidden
> I'm sorry to take so long to respond to your e-mail. I've done
> some tests on my humble PC, and have not yet been able to create
> a version that is portable and that accepts diff files of all
> types. I have one problem with three parts. The parts are: the
> use of cr/lf to terminate lines verses, opening files as binary
> verses text and the failure of the fseek() function.
> The problem has a long history. Based on the newsgroups that I've
> been reading, the consensus is that the above fseek was not meant
> to work with text files.

I'm not Paul Eggert, but I'll try to put in my $0.02.

I know one implementation of fseek that does work with text files: the
one in the DJGPP project's (http://www.delorie.com/djgpp/) library.

> That seems to mean that patch should
> open files to read in binary mode only, throw out carriage
> returns, and terminate lines where line feeds are found.

I believe latest versions of Patch already do that: they remove CR
characters near the end of the line and print a message to that

> I have no problem doing that, but it would make the existing switch
> --binary meaningless.

The --binary switch affects _output_, not only _input_.  So, when
Patch is invoked with this switch, it produces patched files in Unix
format, i.e. each line is terminated by a single LF character.  That
is not what you might want, at least not in every situation.

In other words, --binary is mainly meant for the situation where you
patch Unix-style files, and the patch file itself is in Unix format.

reply via email to

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