[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: (ITS#5604) sbin executable names not recognised on Win32



Hallvard B Furuseth wrote:
> Might be better to insert the following at the end of
> libraries/liblutil/utils.c:lutil_progname():
> 
> #if <something>
> 	{
> 		size_t len = strlen( progname );
> 		if ( len > 4 && strcasecmp( progname + len - 4, ".exe" ) == 0 )
> 			progname[len - 4] = '\0';
> 	}
> #endif
> 
> I have no idea what the #if should be though.  Does #ifdef _WIN32 still
> work with cross-compilation?

Yes, I think that's a neater solution. Having a runtime conditional
avoids breaking Cygwin binaries that might not have .exe in progname,
too.

To be honest, I'm not sure whether the compiler/configure defines _WIN32
for cross compilation by default. I could easily find out, but to be
honest, I don't think it's worth it: you pretty much have to ensure it's
defined because there are many places in the source code it is used.
Using it here as well seems smart.

Cheers,

Ben.