[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Comparing binary files with Diff 3.2 compiled with MinGW
From: |
Bruno Haible |
Subject: |
Re: Comparing binary files with Diff 3.2 compiled with MinGW |
Date: |
Sat, 12 May 2012 21:04:17 +0200 |
User-agent: |
KMail/4.7.4 (Linux/3.1.10-1.9-desktop; KDE/4.7.4; x86_64; ; ) |
Eli Zaretskii wrote:
> > 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.
>
> You mean, us it directly, not through a macro?
I meant, through a macro or a function, depending on what's easiest on each
platform.
> If I use setmode, then #ifdef's are necessary.
I meant that setmode should be defined, either as a function or as a
function-like macro, on all platforms.
> But then why does gnulib provide SET_BINARY as a macro?
SET_BINARY is a simpler-to-use macro for the simpler cases. Many GNU
programs do things like this:
if (strcmp (filename, "-") == 0 || strcmp (filename, "/dev/stdin") == 0)
{
fp = stdin;
SET_BINARY (fileno (fp));
}
else
{
fp = fopen (filename, "rb");
...
}
> Using UNSET_BINARY allowed me to avoid any #ifdef's in the application
> code.
I prefer a macro or function that takes an additional boolean argument
to another macro.
Bruno
Re: Comparing binary files with Diff 3.2 compiled with MinGW, Bruno Haible, 2012/05/12
Re: Comparing binary files with Diff 3.2 compiled with MinGW, Paul Eggert, 2012/05/12
Re: Comparing binary files with Diff 3.2 compiled with MinGW, Paul Eggert, 2012/05/13
Re: Comparing binary files with Diff 3.2 compiled with MinGW, Bruno Haible, 2012/05/13