git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 08/14] help.c: Fix detection of custom merge strategy on cygwin

From
Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Date
Dec 16, 2010, 21:03 UTC
Message-ID
<4D0A7E87.3020203@ramsay1.demon.co.uk>
In-Reply-To
<AANLkTimt3w9GVCXa_n1_HXivyRmnRyUhhdSArrHOT6fs@mail.gmail.com>
Erik Faye-Lund wrote:
Show 17 quoted lines
>> 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 <windows.h>, viz:

    $ cat -n test.c
     1	#include <stdio.h>
     2	
     3	#ifdef IW
     4	# include <windows.h>
     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

Previous: Erik Faye-LundNext: Erik Faye-Lund
Message 3 of 8 in “help.c: Fix detection of custom merge strategy on cygwin”
  1. 08/14 help.c: Fix detection of custom merge strategy on cygwinRamsay Jones, Dec 14, 2010
  2. Erik Faye-LundDec 14, 2010
  3. Ramsay JonesDec 16, 2010
  4. Erik Faye-LundDec 16, 2010
  5. Johannes SixtDec 14, 2010
  6. Ramsay JonesDec 16, 2010
  7. Johannes SixtDec 17, 2010
  8. Ramsay JonesDec 18, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.