Eli Zaretskii wrote: > At some point between Diffutils 2.8.7 and 2.9, the code that handles > binary files was removed from io.c. The changes below resurrect the > correct behavior. To accomplish this, I needed to add the binary-io > module, and make changes there as well.
I can't comment on the rationale of the diffutils/src/io.c change in http://git.savannah.gnu.org/gitweb/?p=diffutils.git;a=commitdiff;h=91b8605708cf2d7c49679a46a80b4039167da2cd But regarding <binary-io.h>, I am unhappy about another macro UNSET_BINARY. If you need 1. to reset the value to O_TEXT, 2. to get the previous value in return, then I would suggest to use a function int setmode (int fd, int o_mode); exactly like in Cygwin, so that no code is needed on Cygwin. If we had the chance to design a new API would prefer bool set_binary_mode (int fd, bool binary); but this interface would have no significant advantage over the well-known Cygwin one. > --- lib/binary-io.h~1 2012-05-12 17:31:43.639250000 +0300 > +++ lib/binary-io.h 2012-05-12 18:19:53.842375000 +0300 > -# if defined __EMX__ || defined __DJGPP__ || defined __CYGWIN__ > +# if defined __EMX__ || defined __DJGPP__ || defined __CYGWIN__ || defined > _WIN32 > # include <io.h> /* declares setmode() */ > # else > # define setmode _setmode This change is wrong. The MSVC headers don't unconditionally declare 'setmode' and 'fileno'. And, please, for consistency with the other codes, use "defined _WIN32 || defined __WIN32__", not just "defined _WIN32". Bruno
