Fossil

Check-in [fca9c526]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment: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]
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: fca9c526379c87f1d2de607df34b1b961f1d4c16
User & Date: drh 2012-11-02 21:45:45
References
2012-11-18
22:33 Ticket [10aee063] Fossil didn't support for UTF8 to storage filenames. status still Open with 3 other changes artifact: 00132fc6 user: jan.nijtmans
Context
2012-11-02
21:53
Be aware of the filename case sensitivity of the underlying filesystem in the "fossil clean" command. Ticket [03fec0ab6021c77]. check-in: 640a4f49 user: drh tags: trunk
21:45
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] check-in: fca9c526 user: drh tags: trunk
21:38
Add the -g option to builds using the Mingw makefile. check-in: 004a31a6 user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/main.c.

339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
...
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
...
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
#endif
  free(g.zErrMsg);
  if(g.db){
    db_close(0);
  }
}

#if defined(_WIN32)
/*
** Parse the command-line arguments passed to windows.  We do this
** ourselves to work around bugs in the command-line parsing of MinGW.
** It is possible (in theory) to only use this routine when compiling
** with MinGW and to use built-in command-line parsing for MSVC and
** MinGW-64.  However, the code is here, it is efficient, and works, and
** by using it in all cases we do a better job of testing it.  If you suspect
................................................................................
    *arg = '\0';
    argSpace = arg + 1;
  }
  argv[argc] = NULL;
  *argcPtr = argc;
  *((WCHAR ***)argvPtr) = argv;
}
#endif /* defined(_WIN32) */


/*
** Convert all arguments from mbcs (or unicode) to UTF-8. Then
** search g.argv for arguments "--args FILENAME". If found, then
** (1) remove the two arguments from g.argv
** (2) Read the file FILENAME
................................................................................
  unsigned int nLine;       /* Number of lines in the file*/
  unsigned int i, j, k;     /* Loop counters */
  int n;                    /* Number of bytes in one line */
  char *z;                  /* General use string pointer */
  char **newArgv;           /* New expanded g.argv under construction */
  char const * zFileName;   /* input file name */
  FILE * zInFile;           /* input FILE */
#ifdef _WIN32
  WCHAR buf[MAX_PATH];
#endif

  g.argc = argc;
  g.argv = argv;
#ifdef _WIN32
  parse_windows_command_line(&g.argc, &g.argv);
  GetModuleFileNameW(NULL, buf, MAX_PATH);
  g.nameOfExe = fossil_unicode_to_utf8(buf);
  for(i=0; i<g.argc; i++) g.argv[i] = fossil_unicode_to_utf8(g.argv[i]);
#else
  g.nameOfExe = g.argv[0];
#endif







|







 







|







 







|





|







339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
...
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
...
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
#endif
  free(g.zErrMsg);
  if(g.db){
    db_close(0);
  }
}

#if defined(_WIN32) && !defined(__MINGW32__)
/*
** Parse the command-line arguments passed to windows.  We do this
** ourselves to work around bugs in the command-line parsing of MinGW.
** It is possible (in theory) to only use this routine when compiling
** with MinGW and to use built-in command-line parsing for MSVC and
** MinGW-64.  However, the code is here, it is efficient, and works, and
** by using it in all cases we do a better job of testing it.  If you suspect
................................................................................
    *arg = '\0';
    argSpace = arg + 1;
  }
  argv[argc] = NULL;
  *argcPtr = argc;
  *((WCHAR ***)argvPtr) = argv;
}
#endif /* defined(_WIN32) && !defined(__MINGW32__) */


/*
** Convert all arguments from mbcs (or unicode) to UTF-8. Then
** search g.argv for arguments "--args FILENAME". If found, then
** (1) remove the two arguments from g.argv
** (2) Read the file FILENAME
................................................................................
  unsigned int nLine;       /* Number of lines in the file*/
  unsigned int i, j, k;     /* Loop counters */
  int n;                    /* Number of bytes in one line */
  char *z;                  /* General use string pointer */
  char **newArgv;           /* New expanded g.argv under construction */
  char const * zFileName;   /* input file name */
  FILE * zInFile;           /* input FILE */
#if defined(_WIN32) && !defined(__MINGW32__)
  WCHAR buf[MAX_PATH];
#endif

  g.argc = argc;
  g.argv = argv;
#if defined(_WIN32) && !defined(__MINGW32__)
  parse_windows_command_line(&g.argc, &g.argv);
  GetModuleFileNameW(NULL, buf, MAX_PATH);
  g.nameOfExe = fossil_unicode_to_utf8(buf);
  for(i=0; i<g.argc; i++) g.argv[i] = fossil_unicode_to_utf8(g.argv[i]);
#else
  g.nameOfExe = g.argv[0];
#endif