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

From: Rev. Bob 'Bob' Crispen <>
Date: Sat, 30 Dec 2000 20:05:06 -0600
Message-ID: <>

The voices are telling me that Daniel said on Saturday, December 30, 2000:

> Why not simply write it like:

> #ifdef O_BINARY
> #else
> #endif

> binfile = open(binname, HM_OPENMASK, set_filemode);

Doh! So obvious it's scary.

> a) to be really portable, we can't assume windows is the only cra^H^H^Hsystem
> that has this "feature"...

Good point, and I agree with you about that "feature". On that subject, do you happen to know the cvs command or argument to get it to transfer files in binary mode? cvs (I used the precompiled 1.10 command line version from one of the regular places) stuck 0x0d's in all the files I got the other day (including the GIFs for the webpages!). Which reminds me, I'll have to demoronize those files before I check them back in.

> b) you don't write much m4 when doing configure scripting

Good thing.

>> 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.

Or stick it right in parse.c just before it's used, which is generally my practice when something is only used once.

> 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.

Oh, I already declared some new symbols: LOCAL_DIRENT_H and HAVE_IO_H. I'm not married to the last one, and it may not show up when I'm done dusting, but in LCC-Win32 some symbols and prototypes that show up elsewhere on gnu systems are in io.h. Don't go rushing to write anything until I make some final decisions on the symbols.

But, to your main concern, I did absolutely nothing that wasn't surrounded by #ifdefs.

As to the symbol WIN32 or __WIN32_ or whatever, I'll need to check to find one that's present for LCC (and hopefully Borland, MSVC++, etc.) and absent for Cygwin (which can and I think should use configure).

>> 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.

Good thing. I got it working yesterday. I had to add in Michael Rendell/Ian Stewartson's dirent.c/.h and the GNU getopt.c/.h to get it to compile. One is BSD and the other is GPL. I stuck them in a Win32 subdirectory of src/.

I decided it was easier to bypass the whole getpwuid() call in Win32, since implementing it looked like fashioning a rod for our own backs. I've got some more dusting and cleaning to do, but among the delights I found were:

  1. A mkdir() that only takes one argument and a compiler that doesn't like it when you give it two. On the other hand, it's nice to have a compiler that's fastidious about function prototypes.
  2. strcasecmp() and strncasecmp() named stricmp() and strnicmp() -- that's common enough that I'm surprised we haven't run into that before.
  3. It did save me an ifdef, but out of curiosity, why is it traditional to declare the externs for getopt in the main file?

I'll do some more dusting and cleaning, and I'll definitely use your suggestion of having a config-win32.h.

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

"Or it could just be the midgets. You've got to be careful with midgets
in Spandex."
Received on Sun 31 Dec 2000 04:08:46 AM GMT

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