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

From: Rev. Bob 'Bob' Crispen <crispen_at_hiwaay.net_at_hypermail-project.org>
Date: Thu, 28 Dec 2000 22:37:08 -0600
Message-ID: <38159940169.20001228223708_at_hiwaay.net>

I tried out a "port" to Win32 and ran into a subtle problem. I put "port" in quotes because, apart from one bug, porting to Cygwin consists of:

% sh ./configure
% make
% make install

The bug (at least for Windows) is on line 2011 in parse.c:

    binfile = open(binname, O_WRONLY | O_CREAT,


That needs to be changed to:

    binfile = open(binname, O_WRONLY | O_CREAT | O_BINARY,


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.

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.

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, if you really want to be elegant, define a symbol in config.h something like OPENBINMODE which you set to O_WRONLY | O_CREAT | O_BINARY on Win32 systems and O_WRONLY | O_CREAT on other systems.

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'll stick it up on my website if I get it cracked before I lose patience so those of you with MSVC++, Borland, etc. will have something to start with. 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.

Rev. Bob "Bob" Crispen
crispen at hiwaay dot net

USER ERROR:  Replace user and press any key to continue.
Received on Fri 29 Dec 2000 06:38:51 AM GMT

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