Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Restore fossil to be compilable for Win95
Replace "-DUNICODE -D_UNICODE" with "-DSQLITE_OS_WINNT=0" in win/Makefile.mingw if you want this. |
|---|---|
| Timelines: | family | ancestors | descendants | both | restore-win95 |
| Files: | files | file ages | folders |
| SHA1: |
b402bec8826607299c8d346fe4995c12 |
| User & Date: | jan.nijtmans 2012-09-12 08:10:09.751 |
Context
|
2012-09-12
| ||
| 11:04 | fix crash in Win95 build when running on WinNT+ check-in: d339a7b2e3 user: jan.nijtmans tags: restore-win95 | |
| 08:10 |
Restore fossil to be compilable for Win95
Replace "-DUNICODE -D_UNICODE" with "-DSQLITE_OS_WINNT=0" in win/Makefile.mingw if you want this. check-in: b402bec882 user: jan.nijtmans tags: restore-win95 | |
|
2012-09-11
| ||
| 18:49 |
enable unicode commandline for MinGW/MinGW-w64 as well
remove unused MINGW_BROKEN_MAINARGS check-in: 274d8a1dcd user: jan.nijtmans tags: trunk | |
Changes
Changes to src/checkin.c.
| ︙ | ︙ | |||
505 506 507 508 509 510 511 |
}
blob_reset(&text);
blob_read_from_file(&text, zFile);
}else{
char zIn[300];
blob_reset(&text);
while( fgets(zIn, sizeof(zIn), stdin)!=0 ){
| | | 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 |
}
blob_reset(&text);
blob_read_from_file(&text, zFile);
}else{
char zIn[300];
blob_reset(&text);
while( fgets(zIn, sizeof(zIn), stdin)!=0 ){
char *zUtf8 = fossil_console_to_utf8(zIn);
if( zUtf8[0]=='.' && (zUtf8[1]==0 || zUtf8[1]=='\r' || zUtf8[1]=='\n') ){
fossil_mbcs_free(zUtf8);
break;
}
blob_append(&text, zIn, -1);
fossil_mbcs_free(zUtf8);
}
|
| ︙ | ︙ |
Changes to src/file.c.
| ︙ | ︙ | |||
32 33 34 35 36 37 38 39 40 41 42 43 44 45 | /* ** On Windows, include the Platform SDK header file. */ #ifdef _WIN32 # include <direct.h> # include <windows.h> #endif /* ** The file status information from the most recent stat() call. ** ** Use _stati64 rather than stat on windows, in order to handle files ** larger than 2GB. | > | 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | /* ** On Windows, include the Platform SDK header file. */ #ifdef _WIN32 # include <direct.h> # include <windows.h> # include <tchar.h> #endif /* ** The file status information from the most recent stat() call. ** ** Use _stati64 rather than stat on windows, in order to handle files ** larger than 2GB. |
| ︙ | ︙ | |||
67 68 69 70 71 72 73 |
if( isWd && g.allowSymlinks ){
return lstat(zFilename, buf);
}else{
return stat(zFilename, buf);
}
#else
int rc = 0;
| | | | 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
if( isWd && g.allowSymlinks ){
return lstat(zFilename, buf);
}else{
return stat(zFilename, buf);
}
#else
int rc = 0;
TCHAR *zMbcs = fossil_utf8_to_mbcs(zFilename);
rc = _tstati64(zMbcs, buf);
fossil_mbcs_free(zMbcs);
return rc;
#endif
}
/*
** Fill in the fileStat variable for the file named zFilename.
|
| ︙ | ︙ | |||
298 299 300 301 302 303 304 |
/*
** Wrapper around the access() system call.
*/
int file_access(const char *zFilename, int flags){
#ifdef _WIN32
| | | | 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 |
/*
** Wrapper around the access() system call.
*/
int file_access(const char *zFilename, int flags){
#ifdef _WIN32
TCHAR *zMbcs = fossil_utf8_to_mbcs(zFilename);
int rc = _taccess(zMbcs, flags);
fossil_mbcs_free(zMbcs);
#else
int rc = access(zFilename, flags);
#endif
return rc;
}
|
| ︙ | ︙ | |||
393 394 395 396 397 398 399 |
}
/*
** Delete a file.
*/
void file_delete(const char *zFilename){
#ifdef _WIN32
| | | | 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 |
}
/*
** Delete a file.
*/
void file_delete(const char *zFilename){
#ifdef _WIN32
TCHAR *z = fossil_utf8_to_mbcs(zFilename);
_tunlink(z);
fossil_mbcs_free(z);
#else
unlink(zFilename);
#endif
}
/*
|
| ︙ | ︙ | |||
417 418 419 420 421 422 423 |
if( rc==2 ){
if( !forceFlag ) return 1;
file_delete(zName);
}
if( rc!=1 ){
#if defined(_WIN32)
int rc;
| | | | 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 |
if( rc==2 ){
if( !forceFlag ) return 1;
file_delete(zName);
}
if( rc!=1 ){
#if defined(_WIN32)
int rc;
TCHAR *zMbcs = fossil_utf8_to_mbcs(zName);
rc = _tmkdir(zMbcs);
fossil_mbcs_free(zMbcs);
return rc;
#else
return mkdir(zName, 0755);
#endif
}
return 0;
|
| ︙ | ︙ | |||
577 578 579 580 581 582 583 |
** unix.
*/
void file_getcwd(char *zBuf, int nBuf){
#ifdef _WIN32
char *zPwdUtf8;
int nPwd;
int i;
| | | | | 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 |
** unix.
*/
void file_getcwd(char *zBuf, int nBuf){
#ifdef _WIN32
char *zPwdUtf8;
int nPwd;
int i;
TCHAR zPwd[2000];
if( _tgetcwd(zPwd, sizeof(zPwd)/sizeof(zPwd[0])-1)==0 ){
fossil_fatal("cannot find the current working directory.");
}
zPwdUtf8 = fossil_mbcs_to_utf8(zPwd);
nPwd = strlen(zPwdUtf8);
if( nPwd > nBuf-1 ){
fossil_fatal("pwd too big: max %d\n", nBuf-1);
}
for(i=0; zPwdUtf8[i]; i++) if( zPwdUtf8[i]=='\\' ) zPwdUtf8[i] = '/';
memcpy(zBuf, zPwdUtf8, nPwd+1);
fossil_mbcs_free(zPwdUtf8);
|
| ︙ | ︙ | |||
935 936 937 938 939 940 941 |
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"0123456789";
unsigned int i, j;
const char *zDir = ".";
int cnt = 0;
#if defined(_WIN32)
| | | | | 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 |
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"0123456789";
unsigned int i, j;
const char *zDir = ".";
int cnt = 0;
#if defined(_WIN32)
TCHAR zTmpPath[MAX_PATH];
if( GetTempPath(MAX_PATH, zTmpPath) ){
azDirs[0] = fossil_mbcs_to_utf8(zTmpPath);
}
azDirs[1] = fossil_getenv("TEMP");
azDirs[2] = fossil_getenv("TMP");
#endif
|
| ︙ | ︙ | |||
1006 1007 1008 1009 1010 1011 1012 | } /* ** Portable unicode implementation of opendir() */ #if INTERFACE | | | 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 | } /* ** Portable unicode implementation of opendir() */ #if INTERFACE #if defined(_WIN32) && defined(UNICODE) # include <dirent.h> # define FOSSIL_DIR _WDIR # define fossil_dirent _wdirent # define fossil_opendir _wopendir # define fossil_readdir _wreaddir # define fossil_closedir _wclosedir #else |
| ︙ | ︙ | |||
1033 1034 1035 1036 1037 1038 1039 | /************************************************************************** ** The following routines translate between MBCS and UTF8 on windows. ** Since everything is always UTF8 on unix, these routines are no-ops ** there. */ /* | | | | | > > > > > > > > > > > > > > > > > > > > > > > > < < < < < < < < < < < < < < < < < < < | | | | < < < < < < < < < < < < < | > > > > | | | | | 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 |
/**************************************************************************
** The following routines translate between MBCS and UTF8 on windows.
** Since everything is always UTF8 on unix, these routines are no-ops
** there.
*/
/*
** Translate unicode/mbcs to UTF8. Return a pointer to the translated
** text. Call fossil_mbcs_free() to deallocate any memory used to store
** the returned pointer when done.
*/
char *fossil_mbcs_to_utf8(const void *zMbcs){
#ifdef _WIN32
#ifdef UNICODE
int nByte = WideCharToMultiByte(CP_UTF8, 0, zMbcs, -1, 0, 0, 0, 0);
char *zUtf = sqlite3_malloc( nByte );
if( zUtf==0 ){
return 0;
}
WideCharToMultiByte(CP_UTF8, 0, zMbcs, -1, zUtf, nByte, 0, 0);
return zUtf;
#else
extern char *sqlite3_win32_mbcs_to_utf8(const char*);
return sqlite3_win32_mbcs_to_utf8(zMbcs);
#endif
#else
return (char*)zMbcs; /* No-op on unix */
#endif
}
/*
** Translate mbcs to UTF8. Return a pointer to the translated text.
** Call fossil_mbcs_free() to deallocate any memory used to store
** the returned pointer when done.
*/
char *fossil_console_to_utf8(const void *zMbcs){
#ifdef _WIN32
extern char *sqlite3_win32_mbcs_to_utf8(const char*);
return sqlite3_win32_mbcs_to_utf8(zMbcs);
#else
return (char*)zMbcs; /* No-op on unix */
#endif
}
/*
** Translate UTF8 to unicode/mbcs for use in system calls. Return a
** pointer to the translated text.. Call fossil_mbcs_free() to
** deallocate any memory used to store the returned pointer when done.
*/
void *fossil_utf8_to_mbcs(const char *zUtf8){
#ifdef _WIN32
#ifdef UNICODE
int nByte = MultiByteToWideChar(CP_UTF8, 0, zUtf8, -1, 0, 0);
wchar_t *zUnicode = sqlite3_malloc( nByte * 2 );
if( zUnicode==0 ){
return 0;
}
MultiByteToWideChar(CP_UTF8, 0, zUtf8, -1, zUnicode, nByte);
return zUnicode;
#else
extern char *sqlite3_win32_utf8_to_mbcs(const char*);
return sqlite3_win32_utf8_to_mbcs(zUtf8);
#endif
#else
return (char*)zUtf8; /* No-op on unix */
#endif
}
/*
** Return the value of an environment variable as UTF8.
*/
char *fossil_getenv(const char *zName){
#ifdef _WIN32
TCHAR *uName = fossil_utf8_to_mbcs(zName);
void *zValue = _tgetenv(uName);
fossil_mbcs_free(uName);
if( zValue ) zValue = fossil_mbcs_to_utf8(zValue);
#else
char *zValue = getenv(zName);
#endif
return zValue;
}
/*
|
| ︙ | ︙ | |||
1195 1196 1197 1198 1199 1200 1201 |
}
/*
** Like fopen() but always takes a UTF8 argument.
*/
FILE *fossil_fopen(const char *zName, const char *zMode){
#ifdef _WIN32
| | | | | 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 |
}
/*
** Like fopen() but always takes a UTF8 argument.
*/
FILE *fossil_fopen(const char *zName, const char *zMode){
#ifdef _WIN32
TCHAR *uMode = fossil_utf8_to_mbcs(zMode);
TCHAR *uName = fossil_utf8_to_mbcs(zName);
FILE *f = _tfopen(uName, uMode);
fossil_mbcs_free(uName);
fossil_mbcs_free(uMode);
#else
FILE *f = fopen(zName, zMode);
#endif
return f;
}
|
Changes to src/main.c.
| ︙ | ︙ | |||
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;
|
| ︙ | ︙ |
Changes to src/popen.c.
| ︙ | ︙ | |||
63 64 65 66 67 68 69 | /* ** On windows, create a child process and specify the stdin, stdout, ** and stderr channels for that process to use. ** ** Return the number of errors. */ static int win32_create_child_process( | | | | | 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
/*
** On windows, create a child process and specify the stdin, stdout,
** and stderr channels for that process to use.
**
** Return the number of errors.
*/
static int win32_create_child_process(
TCHAR *zCmd, /* The command that the child process will run */
HANDLE hIn, /* Standard input */
HANDLE hOut, /* Standard output */
HANDLE hErr, /* Standard error */
DWORD *pChildPid /* OUT: Child process handle */
){
STARTUPINFO si;
PROCESS_INFORMATION pi;
BOOL rc;
memset(&si, 0, sizeof(si));
si.cb = sizeof(si);
si.dwFlags = STARTF_USESTDHANDLES;
SetHandleInformation(hIn, HANDLE_FLAG_INHERIT, TRUE);
si.hStdInput = hIn;
SetHandleInformation(hOut, HANDLE_FLAG_INHERIT, TRUE);
si.hStdOutput = hOut;
SetHandleInformation(hErr, HANDLE_FLAG_INHERIT, TRUE);
si.hStdError = hErr;
rc = CreateProcess(
NULL, /* Application Name */
zCmd, /* Command-line */
NULL, /* Process attributes */
NULL, /* Thread attributes */
TRUE, /* Inherit Handles */
0, /* Create flags */
NULL, /* Environment */
|
| ︙ | ︙ | |||
137 138 139 140 141 142 143 |
SetHandleInformation( hStdoutRd, HANDLE_FLAG_INHERIT, FALSE);
if( !CreatePipe(&hStdinRd, &hStdinWr, &saAttr, 4096) ){
win32_fatal_error("cannot create pipe for stdin");
}
SetHandleInformation( hStdinWr, HANDLE_FLAG_INHERIT, FALSE);
| | | 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 |
SetHandleInformation( hStdoutRd, HANDLE_FLAG_INHERIT, FALSE);
if( !CreatePipe(&hStdinRd, &hStdinWr, &saAttr, 4096) ){
win32_fatal_error("cannot create pipe for stdin");
}
SetHandleInformation( hStdinWr, HANDLE_FLAG_INHERIT, FALSE);
win32_create_child_process(fossil_utf8_to_mbcs(zCmd),
hStdinRd, hStdoutWr, hStderr,&childPid);
*pChildPid = childPid;
*pfdIn = _open_osfhandle(PTR_TO_INT(hStdoutRd), 0);
fd = _open_osfhandle(PTR_TO_INT(hStdinWr), 0);
*ppOut = _fdopen(fd, "w");
CloseHandle(hStdinRd);
CloseHandle(hStdoutWr);
|
| ︙ | ︙ |
Changes to src/rebuild.c.
| ︙ | ︙ | |||
606 607 608 609 610 611 612 |
fossil_print("done\n");
}
if( activateWal ){
db_multi_exec("PRAGMA journal_mode=WAL;");
}
}
if( showStats ){
| | | 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 |
fossil_print("done\n");
}
if( activateWal ){
db_multi_exec("PRAGMA journal_mode=WAL;");
}
}
if( showStats ){
static const struct { int idx; const char *zLabel; } aStat[] = {
{ CFTYPE_ANY, "Artifacts:" },
{ CFTYPE_MANIFEST, "Manifests:" },
{ CFTYPE_CLUSTER, "Clusters:" },
{ CFTYPE_CONTROL, "Tags:" },
{ CFTYPE_WIKI, "Wikis:" },
{ CFTYPE_TICKET, "Tickets:" },
{ CFTYPE_ATTACHMENT,"Attachments:" },
|
| ︙ | ︙ | |||
822 823 824 825 826 827 828 | FOSSIL_DIR *d; struct fossil_dirent *pEntry; Blob aContent; /* content of the just read artifact */ static int nFileRead = 0; void *zUnicodePath; char *zUtf8Name; | | | | 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 |
FOSSIL_DIR *d;
struct fossil_dirent *pEntry;
Blob aContent; /* content of the just read artifact */
static int nFileRead = 0;
void *zUnicodePath;
char *zUtf8Name;
zUnicodePath = fossil_utf8_to_mbcs(zPath);
d = fossil_opendir(zUnicodePath);
if( d ){
while( (pEntry=fossil_readdir(d))!=0 ){
Blob path;
char *zSubpath;
if( pEntry->d_name[0]=='.' ){
continue;
}
zUtf8Name = fossil_mbcs_to_utf8(pEntry->d_name);
zSubpath = mprintf("%s/%s", zPath, zUtf8Name);
fossil_mbcs_free(zUtf8Name);
if( file_isdir(zSubpath)==1 ){
recon_read_dir(zSubpath);
}
blob_init(&path, 0, 0);
blob_appendf(&path, "%s", zSubpath);
|
| ︙ | ︙ |
Changes to src/vfile.c.
| ︙ | ︙ | |||
400 401 402 403 404 405 406 |
"INSERT OR IGNORE INTO sfile(x) SELECT :file"
" WHERE NOT EXISTS(SELECT 1 FROM vfile WHERE pathname=:file)"
);
}
depth++;
zDir = blob_str(pPath);
| | | | 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 |
"INSERT OR IGNORE INTO sfile(x) SELECT :file"
" WHERE NOT EXISTS(SELECT 1 FROM vfile WHERE pathname=:file)"
);
}
depth++;
zDir = blob_str(pPath);
zMbcs = fossil_utf8_to_mbcs(zDir);
d = fossil_opendir(zMbcs);
if( d ){
while( (pEntry=fossil_readdir(d))!=0 ){
char *zPath;
char *zUtf8;
if( pEntry->d_name[0]=='.' ){
if( !allFlag ) continue;
if( pEntry->d_name[1]==0 ) continue;
if( pEntry->d_name[1]=='.' && pEntry->d_name[2]==0 ) continue;
}
zUtf8 = fossil_mbcs_to_utf8(pEntry->d_name);
blob_appendf(pPath, "/%s", zUtf8);
fossil_mbcs_free(zUtf8);
zPath = blob_str(pPath);
if( glob_match(pIgnore, &zPath[nPrefix+1]) ){
/* do nothing */
}else if( file_wd_isdir(zPath)==1 ){
if( !vfile_top_of_checkout(zPath) ){
|
| ︙ | ︙ |
Changes to src/winhttp.c.
| ︙ | ︙ | |||
17 18 19 20 21 22 23 | ** ** This file implements a very simple (and low-performance) HTTP server ** for windows. It also implements a Windows Service which allows the HTTP ** server to be run without any user logged on. */ #include "config.h" #ifdef _WIN32 | | | 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | ** ** This file implements a very simple (and low-performance) HTTP server ** for windows. It also implements a Windows Service which allows the HTTP ** server to be run without any user logged on. */ #include "config.h" #ifdef _WIN32 /* This code is for win32/unicode only */ #include <windows.h> #include "winhttp.h" /* ** The HttpRequest structure holds information about each incoming ** HTTP request. */ |
| ︙ | ︙ | |||
127 128 129 130 131 132 133 | if( in ) fclose(in); closesocket(p->s); file_delete(zRequestFName); file_delete(zReplyFName); free(p); } | < < < < < | 127 128 129 130 131 132 133 134 135 136 137 138 139 140 | if( in ) fclose(in); closesocket(p->s); file_delete(zRequestFName); file_delete(zReplyFName); free(p); } /* ** Start a listening socket and process incoming HTTP requests on ** that socket. */ void win32_http_server( int mnPort, int mxPort, /* Range of allowed TCP port numbers */ const char *zBrowser, /* Command to launch browser. (Or NULL) */ |
| ︙ | ︙ | |||
197 198 199 200 201 202 203 |
fossil_fatal("unable to open listening socket on any"
" port in the range %d..%d", mnPort, mxPort);
}
}
if( !GetTempPath(MAX_PATH, zTmpPath) ){
fossil_fatal("unable to get path to the temporary directory.");
}
| | | 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 |
fossil_fatal("unable to open listening socket on any"
" port in the range %d..%d", mnPort, mxPort);
}
}
if( !GetTempPath(MAX_PATH, zTmpPath) ){
fossil_fatal("unable to get path to the temporary directory.");
}
zTempPrefix = mprintf("%sfossil_server_P%d_", fossil_mbcs_to_utf8(zTmpPath), iPort);
fossil_print("Listening for HTTP requests on TCP port %d\n", iPort);
if( zBrowser ){
zBrowser = mprintf(zBrowser, iPort);
fossil_print("Launch webbrowser: %s\n", zBrowser);
fossil_system(zBrowser);
}
fossil_print("Type Ctrl-C to stop the HTTP server\n");
|
| ︙ | ︙ | |||
301 302 303 304 305 306 307 |
0,
(LPTSTR) &tmp,
0,
NULL
);
}
if( nMsg ){
| | | 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 |
0,
(LPTSTR) &tmp,
0,
NULL
);
}
if( nMsg ){
zMsg = fossil_mbcs_to_utf8(tmp);
}else{
fossil_fatal("unable to get system error message.");
}
if( tmp ){
LocalFree((HLOCAL) tmp);
}
return zMsg;
|
| ︙ | ︙ | |||
628 629 630 631 632 633 634 |
if( zLocalAuth ) blob_append(&binPath, " --localauth", -1);
blob_appendf(&binPath, " \"%s\"", g.zRepositoryName);
/* Create the service. */
hScm = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);
if( !hScm ) fossil_fatal(zErrFmt, zSvcName, win32_get_last_errmsg());
hSvc = CreateService(
hScm, /* Handle to the SCM */
| | | | | | | 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 |
if( zLocalAuth ) blob_append(&binPath, " --localauth", -1);
blob_appendf(&binPath, " \"%s\"", g.zRepositoryName);
/* Create the service. */
hScm = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);
if( !hScm ) fossil_fatal(zErrFmt, zSvcName, win32_get_last_errmsg());
hSvc = CreateService(
hScm, /* Handle to the SCM */
fossil_utf8_to_mbcs(zSvcName), /* Name of the service */
fossil_utf8_to_mbcs(zDisplay), /* Display name */
SERVICE_ALL_ACCESS, /* Desired access */
SERVICE_WIN32_OWN_PROCESS, /* Service type */
dwStartType, /* Start type */
SERVICE_ERROR_NORMAL, /* Error control */
fossil_utf8_to_mbcs(blob_str(&binPath)), /* Binary path */
NULL, /* Load ordering group */
NULL, /* Tag value */
NULL, /* Service dependencies */
fossil_utf8_to_mbcs(zUsername), /* Service account */
fossil_utf8_to_mbcs(zPassword) /* Account password */
);
if( !hSvc ) fossil_fatal(zErrFmt, zSvcName, win32_get_last_errmsg());
/* Set the service description. */
ChangeServiceConfig2(hSvc, SERVICE_CONFIG_DESCRIPTION, &svcDescr);
fossil_print("Service '%s' successfully created.\n", zSvcName);
CloseServiceHandle(hSvc);
CloseServiceHandle(hScm);
|
| ︙ | ︙ | |||
662 663 664 665 666 667 668 |
if( g.argc==4 ){
zSvcName = g.argv[3];
}else if( g.argc>4 ){
fossil_fatal("to much arguments for delete method.");
}
hScm = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);
if( !hScm ) fossil_fatal(zErrFmt, zSvcName, win32_get_last_errmsg());
| | | 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 |
if( g.argc==4 ){
zSvcName = g.argv[3];
}else if( g.argc>4 ){
fossil_fatal("to much arguments for delete method.");
}
hScm = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);
if( !hScm ) fossil_fatal(zErrFmt, zSvcName, win32_get_last_errmsg());
hSvc = OpenService(hScm, fossil_utf8_to_mbcs(zSvcName), SERVICE_ALL_ACCESS);
if( !hSvc ) fossil_fatal(zErrFmt, zSvcName, win32_get_last_errmsg());
QueryServiceStatus(hSvc, &sstat);
if( sstat.dwCurrentState!=SERVICE_STOPPED ){
fossil_print("Stopping service '%s'", zSvcName);
if( sstat.dwCurrentState!=SERVICE_STOP_PENDING ){
if( !ControlService(hSvc, SERVICE_CONTROL_STOP, &sstat) ){
fossil_fatal(zErrFmt, zSvcName, win32_get_last_errmsg());
|
| ︙ | ︙ | |||
730 731 732 733 734 735 736 |
if( g.argc==4 ){
zSvcName = g.argv[3];
}else if( g.argc>4 ){
fossil_fatal("to much arguments for show method.");
}
hScm = OpenSCManager(NULL, NULL, GENERIC_READ);
if( !hScm ) fossil_fatal(zErrFmt, zSvcName, win32_get_last_errmsg());
| | | 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 |
if( g.argc==4 ){
zSvcName = g.argv[3];
}else if( g.argc>4 ){
fossil_fatal("to much arguments for show method.");
}
hScm = OpenSCManager(NULL, NULL, GENERIC_READ);
if( !hScm ) fossil_fatal(zErrFmt, zSvcName, win32_get_last_errmsg());
hSvc = OpenService(hScm, fossil_utf8_to_mbcs(zSvcName), GENERIC_READ);
if( !hSvc ) fossil_fatal(zErrFmt, zSvcName, win32_get_last_errmsg());
/* Get the service configuration */
bStatus = QueryServiceConfig(hSvc, NULL, 0, &nRequired);
if( !bStatus && GetLastError()!=ERROR_INSUFFICIENT_BUFFER ){
fossil_fatal(zErrFmt, zSvcName, win32_get_last_errmsg());
}
pSvcConfig = fossil_malloc(nRequired);
|
| ︙ | ︙ | |||
782 783 784 785 786 787 788 |
case SERVICE_CONTINUE_PENDING: zSvcState = zSvcStates[4]; break;
case SERVICE_PAUSE_PENDING: zSvcState = zSvcStates[5]; break;
case SERVICE_PAUSED: zSvcState = zSvcStates[6]; break;
}
/* Print service information to terminal */
fossil_print("Service name .......: %s\n", zSvcName);
fossil_print("Display name .......: %s\n",
| | | | | | 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 |
case SERVICE_CONTINUE_PENDING: zSvcState = zSvcStates[4]; break;
case SERVICE_PAUSE_PENDING: zSvcState = zSvcStates[5]; break;
case SERVICE_PAUSED: zSvcState = zSvcStates[6]; break;
}
/* Print service information to terminal */
fossil_print("Service name .......: %s\n", zSvcName);
fossil_print("Display name .......: %s\n",
fossil_mbcs_to_utf8(pSvcConfig->lpDisplayName));
fossil_print("Service description : %s\n",
fossil_mbcs_to_utf8(pSvcDescr->lpDescription));
fossil_print("Service type .......: %s.\n", zSvcType);
fossil_print("Service start type .: %s.\n", zSvcStartType);
fossil_print("Binary path name ...: %s\n",
fossil_mbcs_to_utf8(pSvcConfig->lpBinaryPathName));
fossil_print("Service username ...: %s\n",
fossil_mbcs_to_utf8(pSvcConfig->lpServiceStartName));
fossil_print("Current state ......: %s.\n", zSvcState);
/* Cleanup */
fossil_free(pSvcConfig);
fossil_free(pSvcDescr);
CloseServiceHandle(hSvc);
CloseServiceHandle(hScm);
}else
|
| ︙ | ︙ | |||
812 813 814 815 816 817 818 |
if( g.argc==4 ){
zSvcName = g.argv[3];
}else if( g.argc>4 ){
fossil_fatal("to much arguments for start method.");
}
hScm = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);
if( !hScm ) fossil_fatal(zErrFmt, zSvcName, win32_get_last_errmsg());
| | | 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 |
if( g.argc==4 ){
zSvcName = g.argv[3];
}else if( g.argc>4 ){
fossil_fatal("to much arguments for start method.");
}
hScm = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);
if( !hScm ) fossil_fatal(zErrFmt, zSvcName, win32_get_last_errmsg());
hSvc = OpenService(hScm, fossil_utf8_to_mbcs(zSvcName), SERVICE_ALL_ACCESS);
if( !hSvc ) fossil_fatal(zErrFmt, zSvcName, win32_get_last_errmsg());
QueryServiceStatus(hSvc, &sstat);
if( sstat.dwCurrentState!=SERVICE_RUNNING ){
fossil_print("Starting service '%s'", zSvcName);
if( sstat.dwCurrentState!=SERVICE_START_PENDING ){
if( !StartService(hSvc, 0, NULL) ){
fossil_fatal(zErrFmt, zSvcName, win32_get_last_errmsg());
|
| ︙ | ︙ | |||
848 849 850 851 852 853 854 |
if( g.argc==4 ){
zSvcName = g.argv[3];
}else if( g.argc>4 ){
fossil_fatal("to much arguments for stop method.");
}
hScm = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);
if( !hScm ) fossil_fatal(zErrFmt, zSvcName, win32_get_last_errmsg());
| | | 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 |
if( g.argc==4 ){
zSvcName = g.argv[3];
}else if( g.argc>4 ){
fossil_fatal("to much arguments for stop method.");
}
hScm = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);
if( !hScm ) fossil_fatal(zErrFmt, zSvcName, win32_get_last_errmsg());
hSvc = OpenService(hScm, fossil_utf8_to_mbcs(zSvcName), SERVICE_ALL_ACCESS);
if( !hSvc ) fossil_fatal(zErrFmt, zSvcName, win32_get_last_errmsg());
QueryServiceStatus(hSvc, &sstat);
if( sstat.dwCurrentState!=SERVICE_STOPPED ){
fossil_print("Stopping service '%s'", zSvcName);
if( sstat.dwCurrentState!=SERVICE_STOP_PENDING ){
if( !ControlService(hSvc, SERVICE_CONTROL_STOP, &sstat) ){
fossil_fatal(zErrFmt, zSvcName, win32_get_last_errmsg());
|
| ︙ | ︙ |