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]

drh 2012-11-02 21:45 trunk
Commit fca9c526379c87f1d2de607df34b1b961f1d4c16
1 file changed +4 -4
+4 -4
--- src/main.c
+++ src/main.c
@@ -341,11 +341,11 @@
341341
if(g.db){
342342
db_close(0);
343343
}
344344
}
345345
346
-#if defined(_WIN32)
346
+#if defined(_WIN32) && !defined(__MINGW32__)
347347
/*
348348
** Parse the command-line arguments passed to windows. We do this
349349
** ourselves to work around bugs in the command-line parsing of MinGW.
350350
** It is possible (in theory) to only use this routine when compiling
351351
** with MinGW and to use built-in command-line parsing for MSVC and
@@ -454,11 +454,11 @@
454454
}
455455
argv[argc] = NULL;
456456
*argcPtr = argc;
457457
*((WCHAR ***)argvPtr) = argv;
458458
}
459
-#endif /* defined(_WIN32) */
459
+#endif /* defined(_WIN32) && !defined(__MINGW32__) */
460460
461461
462462
/*
463463
** Convert all arguments from mbcs (or unicode) to UTF-8. Then
464464
** search g.argv for arguments "--args FILENAME". If found, then
@@ -478,17 +478,17 @@
478478
int n; /* Number of bytes in one line */
479479
char *z; /* General use string pointer */
480480
char **newArgv; /* New expanded g.argv under construction */
481481
char const * zFileName; /* input file name */
482482
FILE * zInFile; /* input FILE */
483
-#ifdef _WIN32
483
+#if defined(_WIN32) && !defined(__MINGW32__)
484484
WCHAR buf[MAX_PATH];
485485
#endif
486486
487487
g.argc = argc;
488488
g.argv = argv;
489
-#ifdef _WIN32
489
+#if defined(_WIN32) && !defined(__MINGW32__)
490490
parse_windows_command_line(&g.argc, &g.argv);
491491
GetModuleFileNameW(NULL, buf, MAX_PATH);
492492
g.nameOfExe = fossil_unicode_to_utf8(buf);
493493
for(i=0; i<g.argc; i++) g.argv[i] = fossil_unicode_to_utf8(g.argv[i]);
494494
#else
495495
--- 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

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button