339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
|
#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
|
|
|
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
|
#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
|
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
|
*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
|
|
|
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
|
*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
|
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
|
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
|
|
|
|
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
|
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)
WCHAR buf[MAX_PATH];
#endif
g.argc = argc;
g.argv = argv;
#if defined(_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
|