Re: Comparing binary files with Diff 3.2 compiled with MinGW

Eric Blake <[email protected]>
Newsgroups gmane.comp.gnu.utils.bugs,gmane.comp.lib.gnulib.bugs
Organization Red Hat
Message-ID <[email protected]>
On 05/12/2012 05:37 PM, Paul Eggert wrote:
> On 05/12/2012 10:41 AM, Bruno Haible wrote:
>> I would suggest to use a function
>>
>>    int setmode (int fd, int o_mode);
> 
> That would clash with the setmode function defined
> in <unistd.h> in FreeBSD etc., which is partly why we
> removed this stuff from diffutils.
> I agree that it'd be nicer to have a function
> with an additional argument.  But I'd rather
> not use a name like 'setmode' that clashes with BSD.
> 
> 'set_binary_mode' would be OK, but wouldn't it
> be cleaner to use fcntl?  The standard way to
> set and clear O_* flags is fcntl, so shouldn't
> it look like this?
> 
>    flags = fcntl (fd, F_GETFL);
>    fcntl (fd, F_SETFL, flags | O_BINARY);

No, because cygwin doesn't do it that way.  The only way to change
between O_BINARY and O_TEXT on cygwin is via setmode(), and it is not
worth wrapping fcntl() to make that an alternate interface.

-- 
Eric Blake   [email protected]    +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc (application/pgp-signature, 620 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
Comment: Public key at http://people.redhat.com/eblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBCAAGBQJPsQArAAoJEKeha0olJ0Nq8BUH/1Yxzpn3W2xcYp09zzWnV9TY
JG6POYo1fSD9CaUYKrq+a7kgD7pIbkVBR7Y3+dsYx//XslMjJEItOtG3q3XfzfOr
r8LKbAblFb7ms3h+7nciJHSehzTTBIUgRUjN8+3S07A91P0kptKefXBnnUbuLDdd
gabFQm3Q+JeW5nfNLhX3roQyJArVKfZaf828bSn2RbHp3oghzbL4Dz3w+kt8F9Rp
SZKa2VtJ0MqKgbkI2hZthy+Ka6megxsL+u5jJhes+rnJ1mWXUk/Oxn90CgW31Ehr
TKh2FdMlHxZ9h6XNUBAg8VHI6OgXiUGDhWuWBcn7tA7ueYMtyg//R2vJiT/G2+U=
=HSCl
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.