Re: [hypermail] Wanted: a good flag for Win32 and an m4 guru

From: Daniel Stenberg <>
Date: Sat, 30 Dec 2000 13:40:56 +0100 (MET)
Message-ID: <>

On Thu, 28 Dec 2000, Rev. Bob 'Bob' Crispen wrote:

> The bug (at least for Windows) is on line 2011 in parse.c:
> binfile = open(binname, O_WRONLY | O_CREAT,
> set_filemode);
> That needs to be changed to:
> binfile = open(binname, O_WRONLY | O_CREAT | O_BINARY,
> set_filemode);
> because good old Windows opens files by default in ASCII mode which adds
> a 0x0d every time it finds a 0x0a, which doesn't do JPEGs etc. a bit of
> good.
> Unfortunately, while the symbol O_BINARY is defined in fcntl.h (at least
> for Cygwin and lcc), it isn't defined in any header file in Digital Unix
> v 4.0F, which my ISP runs, and which I use as my paradigm for oddball
> Unixes ;-) -- if I can get something to compile on Digital Unix, I can
> generally get it to compile on anything.

Why not simply write it like:

#ifdef O_BINARY

 binfile = open(binname, HM_OPENMASK, set_filemode);

> Soooooo, what I'm looking for is (a) a good, reliable flag that indicates
> that the system is in fact a Windows system, and (b) an m4 guru to write
> the code to test for it in configure and do something appropriate.

  1. to be really portable, we can't assume windows is the only cra^H^H^Hsystem that has this "feature"...
  2. you don't write much m4 when doing configure scripting

> Btw, I think, but wouldn't swear to it, that O_BINARY is harmless on real
> honest to goodness Unix systems that have it defined, so maybe as good a
> way as any is to check for O_BINARY defined in fcntl.h and just define
> O_BINARY as 0 in config.h when it's not.

Or we just make my operation above in a suitable header file.

> I'm off to try my hand at compiling hypermail on LCCWin32 which, because
> of lcc's lack of anything like configure, is going to be a plug-and-pray
> exercise.

I'd advice you to make a config-win32.h file that looks exactly as the config.h file would on a win32 system. Then we include that file instead of config.h if 'WIN32' is defined (as it can be on the command line for win32 compilations). That makes all source codes rather transparant and independent of win32 or not, configure or not.

> Personally, I think having a Win32 build capability is a good thing, and
> might open up the possibility for people to use hypermail on sites that
> lack Unix.

I agree with you.

      Daniel Stenberg - - +46-705-44 31 77
   ech`echo xiun|tr nu oc|sed 'sx\([sx]\)\([xoi]\)xo un\2\1 is xg'`ol
Received on Sat 30 Dec 2000 02:45:21 PM GMT

This archive was generated by hypermail 2.3.0 : Sat 13 Mar 2010 03:46:12 AM GMT GMT