Differences From Artifact [90c404e7e7]:
- File
src/main.c
— part of check-in
[274d8a1dcd]
at
2012-09-11 18:49:29
on branch trunk
— enable unicode commandline for MinGW/MinGW-w64 as well
remove unused MINGW_BROKEN_MAINARGS
(user: jan.nijtmans size: 60176)
To Artifact [6b7631b23d]:
- File
src/main.c
— part of check-in
[b402bec882]
at
2012-09-12 08:10:09
on branch restore-win95
— Restore fossil to be compilable for Win95
Replace "-DUNICODE -D_UNICODE" with "-DSQLITE_OS_WINNT=0" in win/Makefile.mingw if you want this.
(user: jan.nijtmans size: 60065)
| ︙ | ︙ | |||
468 469 470 471 472 473 474 | 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 | | | | < < < < | 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 |
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
TCHAR buf[MAX_PATH];
#endif
g.argc = argc;
g.argv = argv;
#ifdef _WIN32
parse_windows_command_line(&g.argc, &g.argv);
GetModuleFileName(NULL, buf, MAX_PATH);
g.argv[0] = fossil_mbcs_to_utf8(buf);
for(i=1; i<g.argc; i++) g.argv[i] = fossil_mbcs_to_utf8(g.argv[i]);
#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 "--" */
|
| ︙ | ︙ | |||
528 529 530 531 532 533 534 |
}
}
if((n>1) && ('\r'==z[n-2])){
if(n==2) continue /*empty line*/;
z[n-2] = 0;
}
if (!foundBom) {
| | | 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 |
}
}
if((n>1) && ('\r'==z[n-2])){
if(n==2) continue /*empty line*/;
z[n-2] = 0;
}
if (!foundBom) {
z = fossil_console_to_utf8(z);
}
newArgv[j++] = z;
if( z[0]=='-' ){
for(k=1; z[k] && !fossil_isspace(z[k]); k++){}
if( z[k] ){
z[k] = 0;
k++;
|
| ︙ | ︙ | |||
833 834 835 836 837 838 839 |
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 = mprintf("\"%s\"", zOrigCmd);
| | | | | | 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 |
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 = mprintf("\"%s\"", zOrigCmd);
TCHAR *zMbcs = fossil_utf8_to_mbcs(zNewCmd);
if( g.fSystemTrace ) {
char *zOut = mprintf("SYSTEM: %s\n", zNewCmd);
fossil_puts(zOut, 1);
fossil_free(zOut);
}
rc = _tsystem(zMbcs);
fossil_mbcs_free(zMbcs);
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;
|
| ︙ | ︙ |