From: Ramsay Jones Date: Thu, 16 Dec 2010 21:03:03 GMT Subject: Re: [PATCH 08/14] help.c: Fix detection of custom merge strategy on cygwin Message-ID: <4D0A7E87.3020203@ramsay1.demon.co.uk> In-Reply-To: Erik Faye-Lund wrote: >> diff --git a/help.c b/help.c >> index 7f4928e..eabadc9 100644 >> --- a/help.c >> +++ b/help.c >> @@ -126,7 +126,10 @@ static int is_executable(const char *name) >> !S_ISREG(st.st_mode)) >> return 0; >> >> -#ifdef WIN32 >> +#if defined(WIN32) || defined(__CYGWIN__) >> +#if defined(__CYGWIN__) >> +if ((st.st_mode & S_IXUSR) == 0) >> +#endif > > Perhaps the first check should simply be changed to check for _WIN32 > instead of WIN32? IIRC _WIN32 is set on Cygwin, but I could be > mistaken... No, neither WIN32 or _WIN32 will be defined here (and they should not be). It's actually quite tricky, particularly when #including , viz: $ cat -n test.c 1 #include 2 3 #ifdef IW 4 # include 5 #endif 6 7 int main(int argc, char *argv[]) 8 { 9 #ifdef WIN32 10 printf("WIN32 "); 11 #endif 12 #ifdef _WIN32 13 printf("_WIN32 "); 14 #endif 15 #ifdef __CYGWIN__ 16 printf("__CYGWIN__ "); 17 #endif 18 #ifdef __MINGW32__ 19 printf("__MINGW32__ "); 20 #endif 21 printf("\n"); 22 return 0; 23 } $ gcc -o test test.c $ ./test __CYGWIN__ $ gcc -o test -DIW test.c $ ./test WIN32 _WIN32 __CYGWIN__ $ gcc -o test -mno-cygwin test.c $ ./test WIN32 _WIN32 __MINGW32__ ATB, Ramsay Jones