From: wvd_vegt AT knoware DOT nl (Wim van der Vegt) Subject: Problem with patching unix files with patch b18 and earlier 29 Dec 1997 16:45:19 -0800 Message-ID: <000101bd14a1$250f6ce0$9e55b2c2.cygnus.gnu-win32@veg> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit To: 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 ). 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 AT cygnus DOT com" with one line of text: "help".