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

From: Daniel Stenberg <daniel_at_haxx.se_at_hypermail-project.org>
Date: Tue, 2 Jan 2001 10:39:33 +0100 (MET)
Message-ID: <Pine.GSO.4.30.0101020854060.17096-100000_at_pm1.contactor.se>


On Sat, 30 Dec 2000, Rev. Bob 'Bob' Crispen wrote:

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

I'm afraid I don't know that. My CVS skills aren't that complete...

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

Oh yes, if that's needed only once then I too think it should go into the source file.

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

:-) I'm also concerned that things are properly #ifdef HAVE_FEATURE and not #ifdef THIS_PARTICULAR_SYSTEM

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

My experience tells me that _WIN32 or WIN32 is often used by those compilers. But, to make things worse, there's the mingw32 compiler as well that works pretty much as the cygwin one but without configure support and a few other differences...

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

Sounds wise.

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

Right. It should probably get some clever defaults instead.

> 2. strcasecmp() and strncasecmp() named stricmp() and
> strnicmp() -- that's common enough that I'm surprised we
> haven't run into that before.

There are even systems without any of those. We should add checks for them in the configure script and then use the proper one using a macro or wrapper function. IMHO.

I have this function in curl that looks like:

int strequal(const char *first, const char *second) {
#if defined(HAVE_STRCASECMP)
  return !strcasecmp(first, second);
#elif defined(HAVE_STRCMPI)
  return !strcmpi(first, second);
#elif defined(HAVE_STRICMP)
  return !stricmp(first, second);
#else
  while (*first && *second) {
    if (toupper(*first) != toupper(*second)) {       break;
    }
    first++;
    second++;
  }
  return toupper(*first) == toupper(*second); #endif
}

Now, this returns a non-compatible return code but as can be seen, that is easily fixed should we consider this a good thing...

> 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've no idea! ;-)

-- 
      Daniel Stenberg - http://daniel.haxx.se - +46-705-44 31 77
   ech`echo xiun|tr nu oc|sed 'sx\([sx]\)\([xoi]\)xo un\2\1 is xg'`ol
Received on Tue 02 Jan 2001 11:45:13 AM GMT

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