Fossil SCM
Only use the Tcl-derived argv/argc parser when compiling on windows using a compiler other than mingw. The crt0 for mingw works, and it also does wildcard expansion. Need to update the parse_windows_command_line() function to do wildcard expansion in order to fix builds using non-mingw windows compilers. Ticket [8ca2aae39172f9]
Commit
fca9c526379c87f1d2de607df34b1b961f1d4c16
Parent
004a31a6c70f21c…
1 file changed
+4
-4
+4
-4
| --- src/main.c | ||
| +++ src/main.c | ||
| @@ -341,11 +341,11 @@ | ||
| 341 | 341 | if(g.db){ |
| 342 | 342 | db_close(0); |
| 343 | 343 | } |
| 344 | 344 | } |
| 345 | 345 | |
| 346 | -#if defined(_WIN32) | |
| 346 | +#if defined(_WIN32) && !defined(__MINGW32__) | |
| 347 | 347 | /* |
| 348 | 348 | ** Parse the command-line arguments passed to windows. We do this |
| 349 | 349 | ** ourselves to work around bugs in the command-line parsing of MinGW. |
| 350 | 350 | ** It is possible (in theory) to only use this routine when compiling |
| 351 | 351 | ** with MinGW and to use built-in command-line parsing for MSVC and |
| @@ -454,11 +454,11 @@ | ||
| 454 | 454 | } |
| 455 | 455 | argv[argc] = NULL; |
| 456 | 456 | *argcPtr = argc; |
| 457 | 457 | *((WCHAR ***)argvPtr) = argv; |
| 458 | 458 | } |
| 459 | -#endif /* defined(_WIN32) */ | |
| 459 | +#endif /* defined(_WIN32) && !defined(__MINGW32__) */ | |
| 460 | 460 | |
| 461 | 461 | |
| 462 | 462 | /* |
| 463 | 463 | ** Convert all arguments from mbcs (or unicode) to UTF-8. Then |
| 464 | 464 | ** search g.argv for arguments "--args FILENAME". If found, then |
| @@ -478,17 +478,17 @@ | ||
| 478 | 478 | int n; /* Number of bytes in one line */ |
| 479 | 479 | char *z; /* General use string pointer */ |
| 480 | 480 | char **newArgv; /* New expanded g.argv under construction */ |
| 481 | 481 | char const * zFileName; /* input file name */ |
| 482 | 482 | FILE * zInFile; /* input FILE */ |
| 483 | -#ifdef _WIN32 | |
| 483 | +#if defined(_WIN32) && !defined(__MINGW32__) | |
| 484 | 484 | WCHAR buf[MAX_PATH]; |
| 485 | 485 | #endif |
| 486 | 486 | |
| 487 | 487 | g.argc = argc; |
| 488 | 488 | g.argv = argv; |
| 489 | -#ifdef _WIN32 | |
| 489 | +#if defined(_WIN32) && !defined(__MINGW32__) | |
| 490 | 490 | parse_windows_command_line(&g.argc, &g.argv); |
| 491 | 491 | GetModuleFileNameW(NULL, buf, MAX_PATH); |
| 492 | 492 | g.nameOfExe = fossil_unicode_to_utf8(buf); |
| 493 | 493 | for(i=0; i<g.argc; i++) g.argv[i] = fossil_unicode_to_utf8(g.argv[i]); |
| 494 | 494 | #else |
| 495 | 495 |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -341,11 +341,11 @@ | |
| 341 | if(g.db){ |
| 342 | db_close(0); |
| 343 | } |
| 344 | } |
| 345 | |
| 346 | #if defined(_WIN32) |
| 347 | /* |
| 348 | ** Parse the command-line arguments passed to windows. We do this |
| 349 | ** ourselves to work around bugs in the command-line parsing of MinGW. |
| 350 | ** It is possible (in theory) to only use this routine when compiling |
| 351 | ** with MinGW and to use built-in command-line parsing for MSVC and |
| @@ -454,11 +454,11 @@ | |
| 454 | } |
| 455 | argv[argc] = NULL; |
| 456 | *argcPtr = argc; |
| 457 | *((WCHAR ***)argvPtr) = argv; |
| 458 | } |
| 459 | #endif /* defined(_WIN32) */ |
| 460 | |
| 461 | |
| 462 | /* |
| 463 | ** Convert all arguments from mbcs (or unicode) to UTF-8. Then |
| 464 | ** search g.argv for arguments "--args FILENAME". If found, then |
| @@ -478,17 +478,17 @@ | |
| 478 | int n; /* Number of bytes in one line */ |
| 479 | char *z; /* General use string pointer */ |
| 480 | char **newArgv; /* New expanded g.argv under construction */ |
| 481 | char const * zFileName; /* input file name */ |
| 482 | FILE * zInFile; /* input FILE */ |
| 483 | #ifdef _WIN32 |
| 484 | WCHAR buf[MAX_PATH]; |
| 485 | #endif |
| 486 | |
| 487 | g.argc = argc; |
| 488 | g.argv = argv; |
| 489 | #ifdef _WIN32 |
| 490 | parse_windows_command_line(&g.argc, &g.argv); |
| 491 | GetModuleFileNameW(NULL, buf, MAX_PATH); |
| 492 | g.nameOfExe = fossil_unicode_to_utf8(buf); |
| 493 | for(i=0; i<g.argc; i++) g.argv[i] = fossil_unicode_to_utf8(g.argv[i]); |
| 494 | #else |
| 495 |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -341,11 +341,11 @@ | |
| 341 | if(g.db){ |
| 342 | db_close(0); |
| 343 | } |
| 344 | } |
| 345 | |
| 346 | #if defined(_WIN32) && !defined(__MINGW32__) |
| 347 | /* |
| 348 | ** Parse the command-line arguments passed to windows. We do this |
| 349 | ** ourselves to work around bugs in the command-line parsing of MinGW. |
| 350 | ** It is possible (in theory) to only use this routine when compiling |
| 351 | ** with MinGW and to use built-in command-line parsing for MSVC and |
| @@ -454,11 +454,11 @@ | |
| 454 | } |
| 455 | argv[argc] = NULL; |
| 456 | *argcPtr = argc; |
| 457 | *((WCHAR ***)argvPtr) = argv; |
| 458 | } |
| 459 | #endif /* defined(_WIN32) && !defined(__MINGW32__) */ |
| 460 | |
| 461 | |
| 462 | /* |
| 463 | ** Convert all arguments from mbcs (or unicode) to UTF-8. Then |
| 464 | ** search g.argv for arguments "--args FILENAME". If found, then |
| @@ -478,17 +478,17 @@ | |
| 478 | int n; /* Number of bytes in one line */ |
| 479 | char *z; /* General use string pointer */ |
| 480 | char **newArgv; /* New expanded g.argv under construction */ |
| 481 | char const * zFileName; /* input file name */ |
| 482 | FILE * zInFile; /* input FILE */ |
| 483 | #if defined(_WIN32) && !defined(__MINGW32__) |
| 484 | WCHAR buf[MAX_PATH]; |
| 485 | #endif |
| 486 | |
| 487 | g.argc = argc; |
| 488 | g.argv = argv; |
| 489 | #if defined(_WIN32) && !defined(__MINGW32__) |
| 490 | parse_windows_command_line(&g.argc, &g.argv); |
| 491 | GetModuleFileNameW(NULL, buf, MAX_PATH); |
| 492 | g.nameOfExe = fossil_unicode_to_utf8(buf); |
| 493 | for(i=0; i<g.argc; i++) g.argv[i] = fossil_unicode_to_utf8(g.argv[i]); |
| 494 | #else |
| 495 |