This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Problem with patching unix files with patch b18 and earlier


Hi,

I used gnu patch for some time now to patch sources of a unix based mud that
can also be compiled under win32.

What i noticed was that :

1. patch only likes files in unix format (ie lf only) for both file to be
patched and the patch itself. It then patches correctly and signals plan A.
If the file to be patched is saved in dos mode (ie crlf terminated) patch
signals plan B and ruins the file. (i just use a simple commandline patch
<file to be patched> <patch file>).

2. if patch patches a unix file it returns a crlf (ie dos) file as a result
that can't be patched again without first saving it again in unix format. I
investigated this earlier for some other msvc based program and found that
no matter what you write to stdout, win95 and winnt always expands a lf (\n)
to crlf (\r\n). To correct this i found the following (msvc) code allows a
console application (as the gnu tool is) to emit both \r and \n as they were
intended.

 int result = _setmode( _fileno( stdout ), _O_BINARY );
 if( result == -1 )
   fprintf(stderr, "Cannot set mode\n" );

Any comments, tips or hints?

----------
Wim van der Vegt / Dutch Open University

-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]