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,
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 gcc's 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 When people are free to do as they please, they usually imitate each other.Received on Fri 29 Dec 2000 06:26:13 AM GMT
This archive was generated by hypermail 2.2.0 : Thu 22 Feb 2007 07:33:52 PM GMT GMT