| ︙ | | |
195
196
197
198
199
200
201
202
203
204
205
206
207
208
|
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
|
+
+
+
|
const char *azAuxName[MX_AUX]; /* Name of each aux() or option() value */
char *azAuxParam[MX_AUX]; /* Param of each aux() or option() value */
const char *azAuxVal[MX_AUX]; /* Value of each aux() or option() value */
const char **azAuxOpt[MX_AUX]; /* Options of each option() value */
int anAuxCols[MX_AUX]; /* Number of columns for option() values */
int allowSymlinks; /* Cached "allow-symlinks" option */
#ifdef _WIN32
int isNT;
#endif
#ifdef FOSSIL_ENABLE_JSON
struct FossilJsonBits {
int isJsonMode; /* True if running in JSON mode, else
false. This changes how errors are
reported. In JSON mode we try to
always output JSON-form error
|
| ︙ | | |
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
|
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
|
-
+
-
+
-
-
-
-
|
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 */
int foundBom = -1; /* -1= not searched yet, 0 = no; 1=yes */
#ifdef _WIN32
wchar_t buf[MAX_PATH];
TCHAR 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);
GetModuleFileName(NULL, buf, MAX_PATH);
g.argv[0] = fossil_unicode_to_utf8(buf);
#ifdef UNICODE
for(i=1; i<g.argc; i++) g.argv[i] = fossil_unicode_to_utf8(g.argv[i]);
#else
for(i=1; i<g.argc; i++) g.argv[i] = fossil_mbcs_to_utf8(g.argv[i]);
#endif
#endif
for(i=1; i<g.argc-1; i++){
z = g.argv[i];
if( z[0]!='-' ) continue;
z++;
if( z[0]=='-' ) z++;
if( z[0]==0 ) return; /* Stop searching at "--" */
|
| ︙ | | |
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
|
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
|
+
+
+
+
+
+
+
+
|
** This procedure runs first.
*/
int main(int argc, char **argv)
{
const char *zCmdName = "unknown";
int idx;
int rc;
#ifdef _WIN32
OSVERSIONINFOA sInfo;
#endif
sqlite3_config(SQLITE_CONFIG_LOG, fossil_sqlite_log, 0);
memset(&g, 0, sizeof(g));
#ifdef _WIN32
sInfo.dwOSVersionInfoSize = sizeof(sInfo);
GetVersionExA(&sInfo);
g.isNT = sInfo.dwPlatformId==VER_PLATFORM_WIN32_NT;
#endif
g.now = time(0);
#ifdef FOSSIL_ENABLE_JSON
#if defined(NDEBUG)
g.json.errorDetailParanoia = 2 /* FIXME: make configurable
One problem we have here is that this
code is needed before the db is opened,
so we can't sql for it.*/;
|
| ︙ | | |
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
|
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
|
+
+
+
+
-
-
+
+
+
+
+
-
+
-
+
|
*/
int fossil_system(const char *zOrigCmd){
int rc;
#if defined(_WIN32)
/* On windows, we have to put double-quotes around the entire command.
** Who knows why - this is just the way windows works.
*/
char *zNewCmd;
TCHAR *zUnicode;
if (g.isNT) {
char *zNewCmd = mprintf("\"%s\"", zOrigCmd);
wchar_t *zUnicode = fossil_utf8_to_unicode(zNewCmd);
zNewCmd = mprintf("\"%s\"", zOrigCmd);
} else {
zNewCmd = mprintf("%s", zOrigCmd);
}
zUnicode = fossil_utf8_to_unicode(zNewCmd);
if( g.fSystemTrace ) {
char *zOut = mprintf("SYSTEM: %s\n", zNewCmd);
fossil_puts(zOut, 1);
fossil_free(zOut);
}
rc = _wsystem(zUnicode);
rc = _tsystem(zUnicode);
fossil_mbcs_free(zUnicode);
free(zNewCmd);
fossil_free(zNewCmd);
#else
/* On unix, evaluate the command directly.
*/
if( g.fSystemTrace ) fprintf(stderr, "SYSTEM: %s\n", zOrigCmd);
rc = system(zOrigCmd);
#endif
return rc;
|
| ︙ | | |