Fossil SCM

Restore fossil to be compilable for Win95 <p>Replace "-DUNICODE -D_UNICODE" with "-DSQLITE_OS_WINNT=0" in win/Makefile.mingw if you want this.

jan.nijtmans 2012-09-12 08:10 UTC trunk
Commit b402bec8826607299c8d346fe4995c12824164ed
+1 -1
--- src/checkin.c
+++ src/checkin.c
@@ -507,11 +507,11 @@
507507
blob_read_from_file(&text, zFile);
508508
}else{
509509
char zIn[300];
510510
blob_reset(&text);
511511
while( fgets(zIn, sizeof(zIn), stdin)!=0 ){
512
- char *zUtf8 = fossil_mbcs_to_utf8(zIn);
512
+ char *zUtf8 = fossil_console_to_utf8(zIn);
513513
if( zUtf8[0]=='.' && (zUtf8[1]==0 || zUtf8[1]=='\r' || zUtf8[1]=='\n') ){
514514
fossil_mbcs_free(zUtf8);
515515
break;
516516
}
517517
blob_append(&text, zIn, -1);
518518
--- src/checkin.c
+++ src/checkin.c
@@ -507,11 +507,11 @@
507 blob_read_from_file(&text, zFile);
508 }else{
509 char zIn[300];
510 blob_reset(&text);
511 while( fgets(zIn, sizeof(zIn), stdin)!=0 ){
512 char *zUtf8 = fossil_mbcs_to_utf8(zIn);
513 if( zUtf8[0]=='.' && (zUtf8[1]==0 || zUtf8[1]=='\r' || zUtf8[1]=='\n') ){
514 fossil_mbcs_free(zUtf8);
515 break;
516 }
517 blob_append(&text, zIn, -1);
518
--- src/checkin.c
+++ src/checkin.c
@@ -507,11 +507,11 @@
507 blob_read_from_file(&text, zFile);
508 }else{
509 char zIn[300];
510 blob_reset(&text);
511 while( fgets(zIn, sizeof(zIn), stdin)!=0 ){
512 char *zUtf8 = fossil_console_to_utf8(zIn);
513 if( zUtf8[0]=='.' && (zUtf8[1]==0 || zUtf8[1]=='\r' || zUtf8[1]=='\n') ){
514 fossil_mbcs_free(zUtf8);
515 break;
516 }
517 blob_append(&text, zIn, -1);
518
+62 -65
--- src/file.c
+++ src/file.c
@@ -34,10 +34,11 @@
3434
** On Windows, include the Platform SDK header file.
3535
*/
3636
#ifdef _WIN32
3737
# include <direct.h>
3838
# include <windows.h>
39
+# include <tchar.h>
3940
#endif
4041
4142
/*
4243
** The file status information from the most recent stat() call.
4344
**
@@ -69,12 +70,12 @@
6970
}else{
7071
return stat(zFilename, buf);
7172
}
7273
#else
7374
int rc = 0;
74
- wchar_t *zMbcs = fossil_utf8_to_unicode(zFilename);
75
- rc = _wstati64(zMbcs, buf);
75
+ TCHAR *zMbcs = fossil_utf8_to_mbcs(zFilename);
76
+ rc = _tstati64(zMbcs, buf);
7677
fossil_mbcs_free(zMbcs);
7778
return rc;
7879
#endif
7980
}
8081
@@ -300,12 +301,12 @@
300301
/*
301302
** Wrapper around the access() system call.
302303
*/
303304
int file_access(const char *zFilename, int flags){
304305
#ifdef _WIN32
305
- wchar_t *zMbcs = fossil_utf8_to_unicode(zFilename);
306
- int rc = _waccess(zMbcs, flags);
306
+ TCHAR *zMbcs = fossil_utf8_to_mbcs(zFilename);
307
+ int rc = _taccess(zMbcs, flags);
307308
fossil_mbcs_free(zMbcs);
308309
#else
309310
int rc = access(zFilename, flags);
310311
#endif
311312
return rc;
@@ -395,12 +396,12 @@
395396
/*
396397
** Delete a file.
397398
*/
398399
void file_delete(const char *zFilename){
399400
#ifdef _WIN32
400
- wchar_t *z = fossil_utf8_to_unicode(zFilename);
401
- _wunlink(z);
401
+ TCHAR *z = fossil_utf8_to_mbcs(zFilename);
402
+ _tunlink(z);
402403
fossil_mbcs_free(z);
403404
#else
404405
unlink(zFilename);
405406
#endif
406407
}
@@ -419,12 +420,12 @@
419420
file_delete(zName);
420421
}
421422
if( rc!=1 ){
422423
#if defined(_WIN32)
423424
int rc;
424
- wchar_t *zMbcs = fossil_utf8_to_unicode(zName);
425
- rc = _wmkdir(zMbcs);
425
+ TCHAR *zMbcs = fossil_utf8_to_mbcs(zName);
426
+ rc = _tmkdir(zMbcs);
426427
fossil_mbcs_free(zMbcs);
427428
return rc;
428429
#else
429430
return mkdir(zName, 0755);
430431
#endif
@@ -579,15 +580,15 @@
579580
void file_getcwd(char *zBuf, int nBuf){
580581
#ifdef _WIN32
581582
char *zPwdUtf8;
582583
int nPwd;
583584
int i;
584
- wchar_t zPwd[2000];
585
- if( _wgetcwd(zPwd, sizeof(zPwd)/sizeof(zPwd[0])-1)==0 ){
585
+ TCHAR zPwd[2000];
586
+ if( _tgetcwd(zPwd, sizeof(zPwd)/sizeof(zPwd[0])-1)==0 ){
586587
fossil_fatal("cannot find the current working directory.");
587588
}
588
- zPwdUtf8 = fossil_unicode_to_utf8(zPwd);
589
+ zPwdUtf8 = fossil_mbcs_to_utf8(zPwd);
589590
nPwd = strlen(zPwdUtf8);
590591
if( nPwd > nBuf-1 ){
591592
fossil_fatal("pwd too big: max %d\n", nBuf-1);
592593
}
593594
for(i=0; zPwdUtf8[i]; i++) if( zPwdUtf8[i]=='\\' ) zPwdUtf8[i] = '/';
@@ -937,14 +938,14 @@
937938
unsigned int i, j;
938939
const char *zDir = ".";
939940
int cnt = 0;
940941
941942
#if defined(_WIN32)
942
- wchar_t zTmpPath[MAX_PATH];
943
+ TCHAR zTmpPath[MAX_PATH];
943944
944
- if( GetTempPathW(MAX_PATH, zTmpPath) ){
945
- azDirs[0] = fossil_unicode_to_utf8(zTmpPath);
945
+ if( GetTempPath(MAX_PATH, zTmpPath) ){
946
+ azDirs[0] = fossil_mbcs_to_utf8(zTmpPath);
946947
}
947948
948949
azDirs[1] = fossil_getenv("TEMP");
949950
azDirs[2] = fossil_getenv("TMP");
950951
#endif
@@ -1008,11 +1009,11 @@
10081009
/*
10091010
** Portable unicode implementation of opendir()
10101011
*/
10111012
#if INTERFACE
10121013
1013
-#if defined(_WIN32)
1014
+#if defined(_WIN32) && defined(UNICODE)
10141015
# include <dirent.h>
10151016
# define FOSSIL_DIR _WDIR
10161017
# define fossil_dirent _wdirent
10171018
# define fossil_opendir _wopendir
10181019
# define fossil_readdir _wreaddir
@@ -1035,84 +1036,80 @@
10351036
** Since everything is always UTF8 on unix, these routines are no-ops
10361037
** there.
10371038
*/
10381039
10391040
/*
1040
-** Translate MBCS to UTF8. Return a pointer to the translated text.
1041
-** Call fossil_mbcs_free() to deallocate any memory used to store the
1042
-** returned pointer when done.
1041
+** Translate unicode/mbcs to UTF8. Return a pointer to the translated
1042
+** text. Call fossil_mbcs_free() to deallocate any memory used to store
1043
+** the returned pointer when done.
1044
+*/
1045
+char *fossil_mbcs_to_utf8(const void *zMbcs){
1046
+#ifdef _WIN32
1047
+#ifdef UNICODE
1048
+ int nByte = WideCharToMultiByte(CP_UTF8, 0, zMbcs, -1, 0, 0, 0, 0);
1049
+ char *zUtf = sqlite3_malloc( nByte );
1050
+ if( zUtf==0 ){
1051
+ return 0;
1052
+ }
1053
+ WideCharToMultiByte(CP_UTF8, 0, zMbcs, -1, zUtf, nByte, 0, 0);
1054
+ return zUtf;
1055
+#else
1056
+ extern char *sqlite3_win32_mbcs_to_utf8(const char*);
1057
+ return sqlite3_win32_mbcs_to_utf8(zMbcs);
1058
+#endif
1059
+#else
1060
+ return (char*)zMbcs; /* No-op on unix */
1061
+#endif
1062
+}
1063
+
1064
+/*
1065
+** Translate mbcs to UTF8. Return a pointer to the translated text.
1066
+** Call fossil_mbcs_free() to deallocate any memory used to store
1067
+** the returned pointer when done.
10431068
*/
1044
-char *fossil_mbcs_to_utf8(const char *zMbcs){
1069
+char *fossil_console_to_utf8(const void *zMbcs){
10451070
#ifdef _WIN32
10461071
extern char *sqlite3_win32_mbcs_to_utf8(const char*);
10471072
return sqlite3_win32_mbcs_to_utf8(zMbcs);
10481073
#else
10491074
return (char*)zMbcs; /* No-op on unix */
10501075
#endif
10511076
}
10521077
10531078
/*
1054
-** Translate Unicode to UTF8. Return a pointer to the translated text.
1055
-** Call fossil_mbcs_free() to deallocate any memory used to store the
1056
-** returned pointer when done.
1057
-*/
1058
-char *fossil_unicode_to_utf8(const void *zUnicode){
1059
-#ifdef _WIN32
1060
- int nByte = WideCharToMultiByte(CP_UTF8, 0, zUnicode, -1, 0, 0, 0, 0);
1061
- char *zUtf = sqlite3_malloc( nByte );
1062
- if( zUtf==0 ){
1063
- return 0;
1064
- }
1065
- WideCharToMultiByte(CP_UTF8, 0, zUnicode, -1, zUtf, nByte, 0, 0);
1066
- return zUtf;
1067
-#else
1068
- return (char *)zUnicode; /* No-op on unix */
1069
-#endif
1070
-}
1071
-
1072
-/*
1073
-** Translate UTF8 to MBCS for use in system calls. Return a pointer to the
1074
-** translated text.. Call fossil_mbcs_free() to deallocate any memory
1075
-** used to store the returned pointer when done.
1076
-*/
1077
-char *fossil_utf8_to_mbcs(const char *zUtf8){
1078
-#ifdef _WIN32
1079
- extern char *sqlite3_win32_utf8_to_mbcs(const char*);
1080
- return sqlite3_win32_utf8_to_mbcs(zUtf8);
1081
-#else
1082
- return (char*)zUtf8; /* No-op on unix */
1083
-#endif
1084
-}
1085
-
1086
-/*
1087
-** Translate UTF8 to unicode for use in system calls. Return a pointer to the
1088
-** translated text.. Call fossil_mbcs_free() to deallocate any memory
1089
-** used to store the returned pointer when done.
1090
-*/
1091
-void *fossil_utf8_to_unicode(const char *zUtf8){
1092
-#ifdef _WIN32
1079
+** Translate UTF8 to unicode/mbcs for use in system calls. Return a
1080
+** pointer to the translated text.. Call fossil_mbcs_free() to
1081
+** deallocate any memory used to store the returned pointer when done.
1082
+*/
1083
+void *fossil_utf8_to_mbcs(const char *zUtf8){
1084
+#ifdef _WIN32
1085
+#ifdef UNICODE
10931086
int nByte = MultiByteToWideChar(CP_UTF8, 0, zUtf8, -1, 0, 0);
10941087
wchar_t *zUnicode = sqlite3_malloc( nByte * 2 );
10951088
if( zUnicode==0 ){
10961089
return 0;
10971090
}
10981091
MultiByteToWideChar(CP_UTF8, 0, zUtf8, -1, zUnicode, nByte);
10991092
return zUnicode;
11001093
#else
1101
- return (void *)zUtf8; /* No-op on unix */
1094
+ extern char *sqlite3_win32_utf8_to_mbcs(const char*);
1095
+ return sqlite3_win32_utf8_to_mbcs(zUtf8);
1096
+#endif
1097
+#else
1098
+ return (char*)zUtf8; /* No-op on unix */
11021099
#endif
11031100
}
11041101
11051102
/*
11061103
** Return the value of an environment variable as UTF8.
11071104
*/
11081105
char *fossil_getenv(const char *zName){
11091106
#ifdef _WIN32
1110
- wchar_t *uName = fossil_utf8_to_unicode(zName);
1111
- void *zValue = _wgetenv(uName);
1107
+ TCHAR *uName = fossil_utf8_to_mbcs(zName);
1108
+ void *zValue = _tgetenv(uName);
11121109
fossil_mbcs_free(uName);
1113
- if( zValue ) zValue = fossil_unicode_to_utf8(zValue);
1110
+ if( zValue ) zValue = fossil_mbcs_to_utf8(zValue);
11141111
#else
11151112
char *zValue = getenv(zName);
11161113
#endif
11171114
return zValue;
11181115
}
@@ -1197,15 +1194,15 @@
11971194
/*
11981195
** Like fopen() but always takes a UTF8 argument.
11991196
*/
12001197
FILE *fossil_fopen(const char *zName, const char *zMode){
12011198
#ifdef _WIN32
1202
- wchar_t *uMode = fossil_utf8_to_unicode(zMode);
1203
- wchar_t *uName = fossil_utf8_to_unicode(zName);
1204
- FILE *f = _wfopen(uName, uMode);
1199
+ TCHAR *uMode = fossil_utf8_to_mbcs(zMode);
1200
+ TCHAR *uName = fossil_utf8_to_mbcs(zName);
1201
+ FILE *f = _tfopen(uName, uMode);
12051202
fossil_mbcs_free(uName);
12061203
fossil_mbcs_free(uMode);
12071204
#else
12081205
FILE *f = fopen(zName, zMode);
12091206
#endif
12101207
return f;
12111208
}
12121209
--- src/file.c
+++ src/file.c
@@ -34,10 +34,11 @@
34 ** On Windows, include the Platform SDK header file.
35 */
36 #ifdef _WIN32
37 # include <direct.h>
38 # include <windows.h>
 
39 #endif
40
41 /*
42 ** The file status information from the most recent stat() call.
43 **
@@ -69,12 +70,12 @@
69 }else{
70 return stat(zFilename, buf);
71 }
72 #else
73 int rc = 0;
74 wchar_t *zMbcs = fossil_utf8_to_unicode(zFilename);
75 rc = _wstati64(zMbcs, buf);
76 fossil_mbcs_free(zMbcs);
77 return rc;
78 #endif
79 }
80
@@ -300,12 +301,12 @@
300 /*
301 ** Wrapper around the access() system call.
302 */
303 int file_access(const char *zFilename, int flags){
304 #ifdef _WIN32
305 wchar_t *zMbcs = fossil_utf8_to_unicode(zFilename);
306 int rc = _waccess(zMbcs, flags);
307 fossil_mbcs_free(zMbcs);
308 #else
309 int rc = access(zFilename, flags);
310 #endif
311 return rc;
@@ -395,12 +396,12 @@
395 /*
396 ** Delete a file.
397 */
398 void file_delete(const char *zFilename){
399 #ifdef _WIN32
400 wchar_t *z = fossil_utf8_to_unicode(zFilename);
401 _wunlink(z);
402 fossil_mbcs_free(z);
403 #else
404 unlink(zFilename);
405 #endif
406 }
@@ -419,12 +420,12 @@
419 file_delete(zName);
420 }
421 if( rc!=1 ){
422 #if defined(_WIN32)
423 int rc;
424 wchar_t *zMbcs = fossil_utf8_to_unicode(zName);
425 rc = _wmkdir(zMbcs);
426 fossil_mbcs_free(zMbcs);
427 return rc;
428 #else
429 return mkdir(zName, 0755);
430 #endif
@@ -579,15 +580,15 @@
579 void file_getcwd(char *zBuf, int nBuf){
580 #ifdef _WIN32
581 char *zPwdUtf8;
582 int nPwd;
583 int i;
584 wchar_t zPwd[2000];
585 if( _wgetcwd(zPwd, sizeof(zPwd)/sizeof(zPwd[0])-1)==0 ){
586 fossil_fatal("cannot find the current working directory.");
587 }
588 zPwdUtf8 = fossil_unicode_to_utf8(zPwd);
589 nPwd = strlen(zPwdUtf8);
590 if( nPwd > nBuf-1 ){
591 fossil_fatal("pwd too big: max %d\n", nBuf-1);
592 }
593 for(i=0; zPwdUtf8[i]; i++) if( zPwdUtf8[i]=='\\' ) zPwdUtf8[i] = '/';
@@ -937,14 +938,14 @@
937 unsigned int i, j;
938 const char *zDir = ".";
939 int cnt = 0;
940
941 #if defined(_WIN32)
942 wchar_t zTmpPath[MAX_PATH];
943
944 if( GetTempPathW(MAX_PATH, zTmpPath) ){
945 azDirs[0] = fossil_unicode_to_utf8(zTmpPath);
946 }
947
948 azDirs[1] = fossil_getenv("TEMP");
949 azDirs[2] = fossil_getenv("TMP");
950 #endif
@@ -1008,11 +1009,11 @@
1008 /*
1009 ** Portable unicode implementation of opendir()
1010 */
1011 #if INTERFACE
1012
1013 #if defined(_WIN32)
1014 # include <dirent.h>
1015 # define FOSSIL_DIR _WDIR
1016 # define fossil_dirent _wdirent
1017 # define fossil_opendir _wopendir
1018 # define fossil_readdir _wreaddir
@@ -1035,84 +1036,80 @@
1035 ** Since everything is always UTF8 on unix, these routines are no-ops
1036 ** there.
1037 */
1038
1039 /*
1040 ** Translate MBCS to UTF8. Return a pointer to the translated text.
1041 ** Call fossil_mbcs_free() to deallocate any memory used to store the
1042 ** returned pointer when done.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1043 */
1044 char *fossil_mbcs_to_utf8(const char *zMbcs){
1045 #ifdef _WIN32
1046 extern char *sqlite3_win32_mbcs_to_utf8(const char*);
1047 return sqlite3_win32_mbcs_to_utf8(zMbcs);
1048 #else
1049 return (char*)zMbcs; /* No-op on unix */
1050 #endif
1051 }
1052
1053 /*
1054 ** Translate Unicode to UTF8. Return a pointer to the translated text.
1055 ** Call fossil_mbcs_free() to deallocate any memory used to store the
1056 ** returned pointer when done.
1057 */
1058 char *fossil_unicode_to_utf8(const void *zUnicode){
1059 #ifdef _WIN32
1060 int nByte = WideCharToMultiByte(CP_UTF8, 0, zUnicode, -1, 0, 0, 0, 0);
1061 char *zUtf = sqlite3_malloc( nByte );
1062 if( zUtf==0 ){
1063 return 0;
1064 }
1065 WideCharToMultiByte(CP_UTF8, 0, zUnicode, -1, zUtf, nByte, 0, 0);
1066 return zUtf;
1067 #else
1068 return (char *)zUnicode; /* No-op on unix */
1069 #endif
1070 }
1071
1072 /*
1073 ** Translate UTF8 to MBCS for use in system calls. Return a pointer to the
1074 ** translated text.. Call fossil_mbcs_free() to deallocate any memory
1075 ** used to store the returned pointer when done.
1076 */
1077 char *fossil_utf8_to_mbcs(const char *zUtf8){
1078 #ifdef _WIN32
1079 extern char *sqlite3_win32_utf8_to_mbcs(const char*);
1080 return sqlite3_win32_utf8_to_mbcs(zUtf8);
1081 #else
1082 return (char*)zUtf8; /* No-op on unix */
1083 #endif
1084 }
1085
1086 /*
1087 ** Translate UTF8 to unicode for use in system calls. Return a pointer to the
1088 ** translated text.. Call fossil_mbcs_free() to deallocate any memory
1089 ** used to store the returned pointer when done.
1090 */
1091 void *fossil_utf8_to_unicode(const char *zUtf8){
1092 #ifdef _WIN32
1093 int nByte = MultiByteToWideChar(CP_UTF8, 0, zUtf8, -1, 0, 0);
1094 wchar_t *zUnicode = sqlite3_malloc( nByte * 2 );
1095 if( zUnicode==0 ){
1096 return 0;
1097 }
1098 MultiByteToWideChar(CP_UTF8, 0, zUtf8, -1, zUnicode, nByte);
1099 return zUnicode;
1100 #else
1101 return (void *)zUtf8; /* No-op on unix */
 
 
 
 
1102 #endif
1103 }
1104
1105 /*
1106 ** Return the value of an environment variable as UTF8.
1107 */
1108 char *fossil_getenv(const char *zName){
1109 #ifdef _WIN32
1110 wchar_t *uName = fossil_utf8_to_unicode(zName);
1111 void *zValue = _wgetenv(uName);
1112 fossil_mbcs_free(uName);
1113 if( zValue ) zValue = fossil_unicode_to_utf8(zValue);
1114 #else
1115 char *zValue = getenv(zName);
1116 #endif
1117 return zValue;
1118 }
@@ -1197,15 +1194,15 @@
1197 /*
1198 ** Like fopen() but always takes a UTF8 argument.
1199 */
1200 FILE *fossil_fopen(const char *zName, const char *zMode){
1201 #ifdef _WIN32
1202 wchar_t *uMode = fossil_utf8_to_unicode(zMode);
1203 wchar_t *uName = fossil_utf8_to_unicode(zName);
1204 FILE *f = _wfopen(uName, uMode);
1205 fossil_mbcs_free(uName);
1206 fossil_mbcs_free(uMode);
1207 #else
1208 FILE *f = fopen(zName, zMode);
1209 #endif
1210 return f;
1211 }
1212
--- src/file.c
+++ src/file.c
@@ -34,10 +34,11 @@
34 ** On Windows, include the Platform SDK header file.
35 */
36 #ifdef _WIN32
37 # include <direct.h>
38 # include <windows.h>
39 # include <tchar.h>
40 #endif
41
42 /*
43 ** The file status information from the most recent stat() call.
44 **
@@ -69,12 +70,12 @@
70 }else{
71 return stat(zFilename, buf);
72 }
73 #else
74 int rc = 0;
75 TCHAR *zMbcs = fossil_utf8_to_mbcs(zFilename);
76 rc = _tstati64(zMbcs, buf);
77 fossil_mbcs_free(zMbcs);
78 return rc;
79 #endif
80 }
81
@@ -300,12 +301,12 @@
301 /*
302 ** Wrapper around the access() system call.
303 */
304 int file_access(const char *zFilename, int flags){
305 #ifdef _WIN32
306 TCHAR *zMbcs = fossil_utf8_to_mbcs(zFilename);
307 int rc = _taccess(zMbcs, flags);
308 fossil_mbcs_free(zMbcs);
309 #else
310 int rc = access(zFilename, flags);
311 #endif
312 return rc;
@@ -395,12 +396,12 @@
396 /*
397 ** Delete a file.
398 */
399 void file_delete(const char *zFilename){
400 #ifdef _WIN32
401 TCHAR *z = fossil_utf8_to_mbcs(zFilename);
402 _tunlink(z);
403 fossil_mbcs_free(z);
404 #else
405 unlink(zFilename);
406 #endif
407 }
@@ -419,12 +420,12 @@
420 file_delete(zName);
421 }
422 if( rc!=1 ){
423 #if defined(_WIN32)
424 int rc;
425 TCHAR *zMbcs = fossil_utf8_to_mbcs(zName);
426 rc = _tmkdir(zMbcs);
427 fossil_mbcs_free(zMbcs);
428 return rc;
429 #else
430 return mkdir(zName, 0755);
431 #endif
@@ -579,15 +580,15 @@
580 void file_getcwd(char *zBuf, int nBuf){
581 #ifdef _WIN32
582 char *zPwdUtf8;
583 int nPwd;
584 int i;
585 TCHAR zPwd[2000];
586 if( _tgetcwd(zPwd, sizeof(zPwd)/sizeof(zPwd[0])-1)==0 ){
587 fossil_fatal("cannot find the current working directory.");
588 }
589 zPwdUtf8 = fossil_mbcs_to_utf8(zPwd);
590 nPwd = strlen(zPwdUtf8);
591 if( nPwd > nBuf-1 ){
592 fossil_fatal("pwd too big: max %d\n", nBuf-1);
593 }
594 for(i=0; zPwdUtf8[i]; i++) if( zPwdUtf8[i]=='\\' ) zPwdUtf8[i] = '/';
@@ -937,14 +938,14 @@
938 unsigned int i, j;
939 const char *zDir = ".";
940 int cnt = 0;
941
942 #if defined(_WIN32)
943 TCHAR zTmpPath[MAX_PATH];
944
945 if( GetTempPath(MAX_PATH, zTmpPath) ){
946 azDirs[0] = fossil_mbcs_to_utf8(zTmpPath);
947 }
948
949 azDirs[1] = fossil_getenv("TEMP");
950 azDirs[2] = fossil_getenv("TMP");
951 #endif
@@ -1008,11 +1009,11 @@
1009 /*
1010 ** Portable unicode implementation of opendir()
1011 */
1012 #if INTERFACE
1013
1014 #if defined(_WIN32) && defined(UNICODE)
1015 # include <dirent.h>
1016 # define FOSSIL_DIR _WDIR
1017 # define fossil_dirent _wdirent
1018 # define fossil_opendir _wopendir
1019 # define fossil_readdir _wreaddir
@@ -1035,84 +1036,80 @@
1036 ** Since everything is always UTF8 on unix, these routines are no-ops
1037 ** there.
1038 */
1039
1040 /*
1041 ** Translate unicode/mbcs to UTF8. Return a pointer to the translated
1042 ** text. Call fossil_mbcs_free() to deallocate any memory used to store
1043 ** the returned pointer when done.
1044 */
1045 char *fossil_mbcs_to_utf8(const void *zMbcs){
1046 #ifdef _WIN32
1047 #ifdef UNICODE
1048 int nByte = WideCharToMultiByte(CP_UTF8, 0, zMbcs, -1, 0, 0, 0, 0);
1049 char *zUtf = sqlite3_malloc( nByte );
1050 if( zUtf==0 ){
1051 return 0;
1052 }
1053 WideCharToMultiByte(CP_UTF8, 0, zMbcs, -1, zUtf, nByte, 0, 0);
1054 return zUtf;
1055 #else
1056 extern char *sqlite3_win32_mbcs_to_utf8(const char*);
1057 return sqlite3_win32_mbcs_to_utf8(zMbcs);
1058 #endif
1059 #else
1060 return (char*)zMbcs; /* No-op on unix */
1061 #endif
1062 }
1063
1064 /*
1065 ** Translate mbcs to UTF8. Return a pointer to the translated text.
1066 ** Call fossil_mbcs_free() to deallocate any memory used to store
1067 ** the returned pointer when done.
1068 */
1069 char *fossil_console_to_utf8(const void *zMbcs){
1070 #ifdef _WIN32
1071 extern char *sqlite3_win32_mbcs_to_utf8(const char*);
1072 return sqlite3_win32_mbcs_to_utf8(zMbcs);
1073 #else
1074 return (char*)zMbcs; /* No-op on unix */
1075 #endif
1076 }
1077
1078 /*
1079 ** Translate UTF8 to unicode/mbcs for use in system calls. Return a
1080 ** pointer to the translated text.. Call fossil_mbcs_free() to
1081 ** deallocate any memory used to store the returned pointer when done.
1082 */
1083 void *fossil_utf8_to_mbcs(const char *zUtf8){
1084 #ifdef _WIN32
1085 #ifdef UNICODE
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1086 int nByte = MultiByteToWideChar(CP_UTF8, 0, zUtf8, -1, 0, 0);
1087 wchar_t *zUnicode = sqlite3_malloc( nByte * 2 );
1088 if( zUnicode==0 ){
1089 return 0;
1090 }
1091 MultiByteToWideChar(CP_UTF8, 0, zUtf8, -1, zUnicode, nByte);
1092 return zUnicode;
1093 #else
1094 extern char *sqlite3_win32_utf8_to_mbcs(const char*);
1095 return sqlite3_win32_utf8_to_mbcs(zUtf8);
1096 #endif
1097 #else
1098 return (char*)zUtf8; /* No-op on unix */
1099 #endif
1100 }
1101
1102 /*
1103 ** Return the value of an environment variable as UTF8.
1104 */
1105 char *fossil_getenv(const char *zName){
1106 #ifdef _WIN32
1107 TCHAR *uName = fossil_utf8_to_mbcs(zName);
1108 void *zValue = _tgetenv(uName);
1109 fossil_mbcs_free(uName);
1110 if( zValue ) zValue = fossil_mbcs_to_utf8(zValue);
1111 #else
1112 char *zValue = getenv(zName);
1113 #endif
1114 return zValue;
1115 }
@@ -1197,15 +1194,15 @@
1194 /*
1195 ** Like fopen() but always takes a UTF8 argument.
1196 */
1197 FILE *fossil_fopen(const char *zName, const char *zMode){
1198 #ifdef _WIN32
1199 TCHAR *uMode = fossil_utf8_to_mbcs(zMode);
1200 TCHAR *uName = fossil_utf8_to_mbcs(zName);
1201 FILE *f = _tfopen(uName, uMode);
1202 fossil_mbcs_free(uName);
1203 fossil_mbcs_free(uMode);
1204 #else
1205 FILE *f = fopen(zName, zMode);
1206 #endif
1207 return f;
1208 }
1209
+8 -12
--- src/main.c
+++ src/main.c
@@ -470,24 +470,20 @@
470470
char **newArgv; /* New expanded g.argv under construction */
471471
char const * zFileName; /* input file name */
472472
FILE * zInFile; /* input FILE */
473473
int foundBom = -1; /* -1= not searched yet, 0 = no; 1=yes */
474474
#ifdef _WIN32
475
- wchar_t buf[MAX_PATH];
475
+ TCHAR buf[MAX_PATH];
476476
#endif
477477
478478
g.argc = argc;
479479
g.argv = argv;
480480
#ifdef _WIN32
481481
parse_windows_command_line(&g.argc, &g.argv);
482
- GetModuleFileNameW(NULL, buf, MAX_PATH);
483
- g.argv[0] = fossil_unicode_to_utf8(buf);
484
-#ifdef UNICODE
485
- for(i=1; i<g.argc; i++) g.argv[i] = fossil_unicode_to_utf8(g.argv[i]);
486
-#else
482
+ GetModuleFileName(NULL, buf, MAX_PATH);
483
+ g.argv[0] = fossil_mbcs_to_utf8(buf);
487484
for(i=1; i<g.argc; i++) g.argv[i] = fossil_mbcs_to_utf8(g.argv[i]);
488
-#endif
489485
#endif
490486
for(i=1; i<g.argc-1; i++){
491487
z = g.argv[i];
492488
if( z[0]!='-' ) continue;
493489
z++;
@@ -530,11 +526,11 @@
530526
if((n>1) && ('\r'==z[n-2])){
531527
if(n==2) continue /*empty line*/;
532528
z[n-2] = 0;
533529
}
534530
if (!foundBom) {
535
- z = fossil_mbcs_to_utf8(z);
531
+ z = fossil_console_to_utf8(z);
536532
}
537533
newArgv[j++] = z;
538534
if( z[0]=='-' ){
539535
for(k=1; z[k] && !fossil_isspace(z[k]); k++){}
540536
if( z[k] ){
@@ -835,19 +831,19 @@
835831
#if defined(_WIN32)
836832
/* On windows, we have to put double-quotes around the entire command.
837833
** Who knows why - this is just the way windows works.
838834
*/
839835
char *zNewCmd = mprintf("\"%s\"", zOrigCmd);
840
- wchar_t *zUnicode = fossil_utf8_to_unicode(zNewCmd);
836
+ TCHAR *zMbcs = fossil_utf8_to_mbcs(zNewCmd);
841837
if( g.fSystemTrace ) {
842838
char *zOut = mprintf("SYSTEM: %s\n", zNewCmd);
843839
fossil_puts(zOut, 1);
844840
fossil_free(zOut);
845841
}
846
- rc = _wsystem(zUnicode);
847
- fossil_mbcs_free(zUnicode);
848
- free(zNewCmd);
842
+ rc = _tsystem(zMbcs);
843
+ fossil_mbcs_free(zMbcs);
844
+ fossil_free(zNewCmd);
849845
#else
850846
/* On unix, evaluate the command directly.
851847
*/
852848
if( g.fSystemTrace ) fprintf(stderr, "SYSTEM: %s\n", zOrigCmd);
853849
rc = system(zOrigCmd);
854850
--- src/main.c
+++ src/main.c
@@ -470,24 +470,20 @@
470 char **newArgv; /* New expanded g.argv under construction */
471 char const * zFileName; /* input file name */
472 FILE * zInFile; /* input FILE */
473 int foundBom = -1; /* -1= not searched yet, 0 = no; 1=yes */
474 #ifdef _WIN32
475 wchar_t buf[MAX_PATH];
476 #endif
477
478 g.argc = argc;
479 g.argv = argv;
480 #ifdef _WIN32
481 parse_windows_command_line(&g.argc, &g.argv);
482 GetModuleFileNameW(NULL, buf, MAX_PATH);
483 g.argv[0] = fossil_unicode_to_utf8(buf);
484 #ifdef UNICODE
485 for(i=1; i<g.argc; i++) g.argv[i] = fossil_unicode_to_utf8(g.argv[i]);
486 #else
487 for(i=1; i<g.argc; i++) g.argv[i] = fossil_mbcs_to_utf8(g.argv[i]);
488 #endif
489 #endif
490 for(i=1; i<g.argc-1; i++){
491 z = g.argv[i];
492 if( z[0]!='-' ) continue;
493 z++;
@@ -530,11 +526,11 @@
530 if((n>1) && ('\r'==z[n-2])){
531 if(n==2) continue /*empty line*/;
532 z[n-2] = 0;
533 }
534 if (!foundBom) {
535 z = fossil_mbcs_to_utf8(z);
536 }
537 newArgv[j++] = z;
538 if( z[0]=='-' ){
539 for(k=1; z[k] && !fossil_isspace(z[k]); k++){}
540 if( z[k] ){
@@ -835,19 +831,19 @@
835 #if defined(_WIN32)
836 /* On windows, we have to put double-quotes around the entire command.
837 ** Who knows why - this is just the way windows works.
838 */
839 char *zNewCmd = mprintf("\"%s\"", zOrigCmd);
840 wchar_t *zUnicode = fossil_utf8_to_unicode(zNewCmd);
841 if( g.fSystemTrace ) {
842 char *zOut = mprintf("SYSTEM: %s\n", zNewCmd);
843 fossil_puts(zOut, 1);
844 fossil_free(zOut);
845 }
846 rc = _wsystem(zUnicode);
847 fossil_mbcs_free(zUnicode);
848 free(zNewCmd);
849 #else
850 /* On unix, evaluate the command directly.
851 */
852 if( g.fSystemTrace ) fprintf(stderr, "SYSTEM: %s\n", zOrigCmd);
853 rc = system(zOrigCmd);
854
--- src/main.c
+++ src/main.c
@@ -470,24 +470,20 @@
470 char **newArgv; /* New expanded g.argv under construction */
471 char const * zFileName; /* input file name */
472 FILE * zInFile; /* input FILE */
473 int foundBom = -1; /* -1= not searched yet, 0 = no; 1=yes */
474 #ifdef _WIN32
475 TCHAR buf[MAX_PATH];
476 #endif
477
478 g.argc = argc;
479 g.argv = argv;
480 #ifdef _WIN32
481 parse_windows_command_line(&g.argc, &g.argv);
482 GetModuleFileName(NULL, buf, MAX_PATH);
483 g.argv[0] = fossil_mbcs_to_utf8(buf);
 
 
 
484 for(i=1; i<g.argc; i++) g.argv[i] = fossil_mbcs_to_utf8(g.argv[i]);
 
485 #endif
486 for(i=1; i<g.argc-1; i++){
487 z = g.argv[i];
488 if( z[0]!='-' ) continue;
489 z++;
@@ -530,11 +526,11 @@
526 if((n>1) && ('\r'==z[n-2])){
527 if(n==2) continue /*empty line*/;
528 z[n-2] = 0;
529 }
530 if (!foundBom) {
531 z = fossil_console_to_utf8(z);
532 }
533 newArgv[j++] = z;
534 if( z[0]=='-' ){
535 for(k=1; z[k] && !fossil_isspace(z[k]); k++){}
536 if( z[k] ){
@@ -835,19 +831,19 @@
831 #if defined(_WIN32)
832 /* On windows, we have to put double-quotes around the entire command.
833 ** Who knows why - this is just the way windows works.
834 */
835 char *zNewCmd = mprintf("\"%s\"", zOrigCmd);
836 TCHAR *zMbcs = fossil_utf8_to_mbcs(zNewCmd);
837 if( g.fSystemTrace ) {
838 char *zOut = mprintf("SYSTEM: %s\n", zNewCmd);
839 fossil_puts(zOut, 1);
840 fossil_free(zOut);
841 }
842 rc = _tsystem(zMbcs);
843 fossil_mbcs_free(zMbcs);
844 fossil_free(zNewCmd);
845 #else
846 /* On unix, evaluate the command directly.
847 */
848 if( g.fSystemTrace ) fprintf(stderr, "SYSTEM: %s\n", zOrigCmd);
849 rc = system(zOrigCmd);
850
+4 -4
--- src/popen.c
+++ src/popen.c
@@ -65,17 +65,17 @@
6565
** and stderr channels for that process to use.
6666
**
6767
** Return the number of errors.
6868
*/
6969
static int win32_create_child_process(
70
- wchar_t *zCmd, /* The command that the child process will run */
70
+ TCHAR *zCmd, /* The command that the child process will run */
7171
HANDLE hIn, /* Standard input */
7272
HANDLE hOut, /* Standard output */
7373
HANDLE hErr, /* Standard error */
7474
DWORD *pChildPid /* OUT: Child process handle */
7575
){
76
- STARTUPINFOW si;
76
+ STARTUPINFO si;
7777
PROCESS_INFORMATION pi;
7878
BOOL rc;
7979
8080
memset(&si, 0, sizeof(si));
8181
si.cb = sizeof(si);
@@ -84,11 +84,11 @@
8484
si.hStdInput = hIn;
8585
SetHandleInformation(hOut, HANDLE_FLAG_INHERIT, TRUE);
8686
si.hStdOutput = hOut;
8787
SetHandleInformation(hErr, HANDLE_FLAG_INHERIT, TRUE);
8888
si.hStdError = hErr;
89
- rc = CreateProcessW(
89
+ rc = CreateProcess(
9090
NULL, /* Application Name */
9191
zCmd, /* Command-line */
9292
NULL, /* Process attributes */
9393
NULL, /* Thread attributes */
9494
TRUE, /* Inherit Handles */
@@ -139,11 +139,11 @@
139139
if( !CreatePipe(&hStdinRd, &hStdinWr, &saAttr, 4096) ){
140140
win32_fatal_error("cannot create pipe for stdin");
141141
}
142142
SetHandleInformation( hStdinWr, HANDLE_FLAG_INHERIT, FALSE);
143143
144
- win32_create_child_process(fossil_utf8_to_unicode(zCmd),
144
+ win32_create_child_process(fossil_utf8_to_mbcs(zCmd),
145145
hStdinRd, hStdoutWr, hStderr,&childPid);
146146
*pChildPid = childPid;
147147
*pfdIn = _open_osfhandle(PTR_TO_INT(hStdoutRd), 0);
148148
fd = _open_osfhandle(PTR_TO_INT(hStdinWr), 0);
149149
*ppOut = _fdopen(fd, "w");
150150
--- src/popen.c
+++ src/popen.c
@@ -65,17 +65,17 @@
65 ** and stderr channels for that process to use.
66 **
67 ** Return the number of errors.
68 */
69 static int win32_create_child_process(
70 wchar_t *zCmd, /* The command that the child process will run */
71 HANDLE hIn, /* Standard input */
72 HANDLE hOut, /* Standard output */
73 HANDLE hErr, /* Standard error */
74 DWORD *pChildPid /* OUT: Child process handle */
75 ){
76 STARTUPINFOW si;
77 PROCESS_INFORMATION pi;
78 BOOL rc;
79
80 memset(&si, 0, sizeof(si));
81 si.cb = sizeof(si);
@@ -84,11 +84,11 @@
84 si.hStdInput = hIn;
85 SetHandleInformation(hOut, HANDLE_FLAG_INHERIT, TRUE);
86 si.hStdOutput = hOut;
87 SetHandleInformation(hErr, HANDLE_FLAG_INHERIT, TRUE);
88 si.hStdError = hErr;
89 rc = CreateProcessW(
90 NULL, /* Application Name */
91 zCmd, /* Command-line */
92 NULL, /* Process attributes */
93 NULL, /* Thread attributes */
94 TRUE, /* Inherit Handles */
@@ -139,11 +139,11 @@
139 if( !CreatePipe(&hStdinRd, &hStdinWr, &saAttr, 4096) ){
140 win32_fatal_error("cannot create pipe for stdin");
141 }
142 SetHandleInformation( hStdinWr, HANDLE_FLAG_INHERIT, FALSE);
143
144 win32_create_child_process(fossil_utf8_to_unicode(zCmd),
145 hStdinRd, hStdoutWr, hStderr,&childPid);
146 *pChildPid = childPid;
147 *pfdIn = _open_osfhandle(PTR_TO_INT(hStdoutRd), 0);
148 fd = _open_osfhandle(PTR_TO_INT(hStdinWr), 0);
149 *ppOut = _fdopen(fd, "w");
150
--- src/popen.c
+++ src/popen.c
@@ -65,17 +65,17 @@
65 ** and stderr channels for that process to use.
66 **
67 ** Return the number of errors.
68 */
69 static int win32_create_child_process(
70 TCHAR *zCmd, /* The command that the child process will run */
71 HANDLE hIn, /* Standard input */
72 HANDLE hOut, /* Standard output */
73 HANDLE hErr, /* Standard error */
74 DWORD *pChildPid /* OUT: Child process handle */
75 ){
76 STARTUPINFO si;
77 PROCESS_INFORMATION pi;
78 BOOL rc;
79
80 memset(&si, 0, sizeof(si));
81 si.cb = sizeof(si);
@@ -84,11 +84,11 @@
84 si.hStdInput = hIn;
85 SetHandleInformation(hOut, HANDLE_FLAG_INHERIT, TRUE);
86 si.hStdOutput = hOut;
87 SetHandleInformation(hErr, HANDLE_FLAG_INHERIT, TRUE);
88 si.hStdError = hErr;
89 rc = CreateProcess(
90 NULL, /* Application Name */
91 zCmd, /* Command-line */
92 NULL, /* Process attributes */
93 NULL, /* Thread attributes */
94 TRUE, /* Inherit Handles */
@@ -139,11 +139,11 @@
139 if( !CreatePipe(&hStdinRd, &hStdinWr, &saAttr, 4096) ){
140 win32_fatal_error("cannot create pipe for stdin");
141 }
142 SetHandleInformation( hStdinWr, HANDLE_FLAG_INHERIT, FALSE);
143
144 win32_create_child_process(fossil_utf8_to_mbcs(zCmd),
145 hStdinRd, hStdoutWr, hStderr,&childPid);
146 *pChildPid = childPid;
147 *pfdIn = _open_osfhandle(PTR_TO_INT(hStdoutRd), 0);
148 fd = _open_osfhandle(PTR_TO_INT(hStdinWr), 0);
149 *ppOut = _fdopen(fd, "w");
150
+3 -3
--- src/rebuild.c
+++ src/rebuild.c
@@ -608,11 +608,11 @@
608608
if( activateWal ){
609609
db_multi_exec("PRAGMA journal_mode=WAL;");
610610
}
611611
}
612612
if( showStats ){
613
- static struct { int idx; const char *zLabel; } aStat[] = {
613
+ static const struct { int idx; const char *zLabel; } aStat[] = {
614614
{ CFTYPE_ANY, "Artifacts:" },
615615
{ CFTYPE_MANIFEST, "Manifests:" },
616616
{ CFTYPE_CLUSTER, "Clusters:" },
617617
{ CFTYPE_CONTROL, "Tags:" },
618618
{ CFTYPE_WIKI, "Wikis:" },
@@ -824,21 +824,21 @@
824824
Blob aContent; /* content of the just read artifact */
825825
static int nFileRead = 0;
826826
void *zUnicodePath;
827827
char *zUtf8Name;
828828
829
- zUnicodePath = fossil_utf8_to_unicode(zPath);
829
+ zUnicodePath = fossil_utf8_to_mbcs(zPath);
830830
d = fossil_opendir(zUnicodePath);
831831
if( d ){
832832
while( (pEntry=fossil_readdir(d))!=0 ){
833833
Blob path;
834834
char *zSubpath;
835835
836836
if( pEntry->d_name[0]=='.' ){
837837
continue;
838838
}
839
- zUtf8Name = fossil_unicode_to_utf8(pEntry->d_name);
839
+ zUtf8Name = fossil_mbcs_to_utf8(pEntry->d_name);
840840
zSubpath = mprintf("%s/%s", zPath, zUtf8Name);
841841
fossil_mbcs_free(zUtf8Name);
842842
if( file_isdir(zSubpath)==1 ){
843843
recon_read_dir(zSubpath);
844844
}
845845
--- src/rebuild.c
+++ src/rebuild.c
@@ -608,11 +608,11 @@
608 if( activateWal ){
609 db_multi_exec("PRAGMA journal_mode=WAL;");
610 }
611 }
612 if( showStats ){
613 static struct { int idx; const char *zLabel; } aStat[] = {
614 { CFTYPE_ANY, "Artifacts:" },
615 { CFTYPE_MANIFEST, "Manifests:" },
616 { CFTYPE_CLUSTER, "Clusters:" },
617 { CFTYPE_CONTROL, "Tags:" },
618 { CFTYPE_WIKI, "Wikis:" },
@@ -824,21 +824,21 @@
824 Blob aContent; /* content of the just read artifact */
825 static int nFileRead = 0;
826 void *zUnicodePath;
827 char *zUtf8Name;
828
829 zUnicodePath = fossil_utf8_to_unicode(zPath);
830 d = fossil_opendir(zUnicodePath);
831 if( d ){
832 while( (pEntry=fossil_readdir(d))!=0 ){
833 Blob path;
834 char *zSubpath;
835
836 if( pEntry->d_name[0]=='.' ){
837 continue;
838 }
839 zUtf8Name = fossil_unicode_to_utf8(pEntry->d_name);
840 zSubpath = mprintf("%s/%s", zPath, zUtf8Name);
841 fossil_mbcs_free(zUtf8Name);
842 if( file_isdir(zSubpath)==1 ){
843 recon_read_dir(zSubpath);
844 }
845
--- src/rebuild.c
+++ src/rebuild.c
@@ -608,11 +608,11 @@
608 if( activateWal ){
609 db_multi_exec("PRAGMA journal_mode=WAL;");
610 }
611 }
612 if( showStats ){
613 static const struct { int idx; const char *zLabel; } aStat[] = {
614 { CFTYPE_ANY, "Artifacts:" },
615 { CFTYPE_MANIFEST, "Manifests:" },
616 { CFTYPE_CLUSTER, "Clusters:" },
617 { CFTYPE_CONTROL, "Tags:" },
618 { CFTYPE_WIKI, "Wikis:" },
@@ -824,21 +824,21 @@
824 Blob aContent; /* content of the just read artifact */
825 static int nFileRead = 0;
826 void *zUnicodePath;
827 char *zUtf8Name;
828
829 zUnicodePath = fossil_utf8_to_mbcs(zPath);
830 d = fossil_opendir(zUnicodePath);
831 if( d ){
832 while( (pEntry=fossil_readdir(d))!=0 ){
833 Blob path;
834 char *zSubpath;
835
836 if( pEntry->d_name[0]=='.' ){
837 continue;
838 }
839 zUtf8Name = fossil_mbcs_to_utf8(pEntry->d_name);
840 zSubpath = mprintf("%s/%s", zPath, zUtf8Name);
841 fossil_mbcs_free(zUtf8Name);
842 if( file_isdir(zSubpath)==1 ){
843 recon_read_dir(zSubpath);
844 }
845
+2 -2
--- src/vfile.c
+++ src/vfile.c
@@ -402,11 +402,11 @@
402402
);
403403
}
404404
depth++;
405405
406406
zDir = blob_str(pPath);
407
- zMbcs = fossil_utf8_to_unicode(zDir);
407
+ zMbcs = fossil_utf8_to_mbcs(zDir);
408408
d = fossil_opendir(zMbcs);
409409
if( d ){
410410
while( (pEntry=fossil_readdir(d))!=0 ){
411411
char *zPath;
412412
char *zUtf8;
@@ -413,11 +413,11 @@
413413
if( pEntry->d_name[0]=='.' ){
414414
if( !allFlag ) continue;
415415
if( pEntry->d_name[1]==0 ) continue;
416416
if( pEntry->d_name[1]=='.' && pEntry->d_name[2]==0 ) continue;
417417
}
418
- zUtf8 = fossil_unicode_to_utf8(pEntry->d_name);
418
+ zUtf8 = fossil_mbcs_to_utf8(pEntry->d_name);
419419
blob_appendf(pPath, "/%s", zUtf8);
420420
fossil_mbcs_free(zUtf8);
421421
zPath = blob_str(pPath);
422422
if( glob_match(pIgnore, &zPath[nPrefix+1]) ){
423423
/* do nothing */
424424
--- src/vfile.c
+++ src/vfile.c
@@ -402,11 +402,11 @@
402 );
403 }
404 depth++;
405
406 zDir = blob_str(pPath);
407 zMbcs = fossil_utf8_to_unicode(zDir);
408 d = fossil_opendir(zMbcs);
409 if( d ){
410 while( (pEntry=fossil_readdir(d))!=0 ){
411 char *zPath;
412 char *zUtf8;
@@ -413,11 +413,11 @@
413 if( pEntry->d_name[0]=='.' ){
414 if( !allFlag ) continue;
415 if( pEntry->d_name[1]==0 ) continue;
416 if( pEntry->d_name[1]=='.' && pEntry->d_name[2]==0 ) continue;
417 }
418 zUtf8 = fossil_unicode_to_utf8(pEntry->d_name);
419 blob_appendf(pPath, "/%s", zUtf8);
420 fossil_mbcs_free(zUtf8);
421 zPath = blob_str(pPath);
422 if( glob_match(pIgnore, &zPath[nPrefix+1]) ){
423 /* do nothing */
424
--- src/vfile.c
+++ src/vfile.c
@@ -402,11 +402,11 @@
402 );
403 }
404 depth++;
405
406 zDir = blob_str(pPath);
407 zMbcs = fossil_utf8_to_mbcs(zDir);
408 d = fossil_opendir(zMbcs);
409 if( d ){
410 while( (pEntry=fossil_readdir(d))!=0 ){
411 char *zPath;
412 char *zUtf8;
@@ -413,11 +413,11 @@
413 if( pEntry->d_name[0]=='.' ){
414 if( !allFlag ) continue;
415 if( pEntry->d_name[1]==0 ) continue;
416 if( pEntry->d_name[1]=='.' && pEntry->d_name[2]==0 ) continue;
417 }
418 zUtf8 = fossil_mbcs_to_utf8(pEntry->d_name);
419 blob_appendf(pPath, "/%s", zUtf8);
420 fossil_mbcs_free(zUtf8);
421 zPath = blob_str(pPath);
422 if( glob_match(pIgnore, &zPath[nPrefix+1]) ){
423 /* do nothing */
424
+16 -21
--- src/winhttp.c
+++ src/winhttp.c
@@ -19,11 +19,11 @@
1919
** for windows. It also implements a Windows Service which allows the HTTP
2020
** server to be run without any user logged on.
2121
*/
2222
#include "config.h"
2323
#ifdef _WIN32
24
-/* This code is for win32 only */
24
+/* This code is for win32/unicode only */
2525
#include <windows.h>
2626
#include "winhttp.h"
2727
2828
/*
2929
** The HttpRequest structure holds information about each incoming
@@ -129,15 +129,10 @@
129129
file_delete(zRequestFName);
130130
file_delete(zReplyFName);
131131
free(p);
132132
}
133133
134
-#if !defined(UNICODE)
135
-# define fossil_unicode_to_utf8 fossil_mbcs_to_utf8
136
-# define fossil_utf8_to_unicode fossil_utf8_to_mbcs
137
-#endif
138
-
139134
/*
140135
** Start a listening socket and process incoming HTTP requests on
141136
** that socket.
142137
*/
143138
void win32_http_server(
@@ -199,11 +194,11 @@
199194
}
200195
}
201196
if( !GetTempPath(MAX_PATH, zTmpPath) ){
202197
fossil_fatal("unable to get path to the temporary directory.");
203198
}
204
- zTempPrefix = mprintf("%sfossil_server_P%d_", fossil_unicode_to_utf8(zTmpPath), iPort);
199
+ zTempPrefix = mprintf("%sfossil_server_P%d_", fossil_mbcs_to_utf8(zTmpPath), iPort);
205200
fossil_print("Listening for HTTP requests on TCP port %d\n", iPort);
206201
if( zBrowser ){
207202
zBrowser = mprintf(zBrowser, iPort);
208203
fossil_print("Launch webbrowser: %s\n", zBrowser);
209204
fossil_system(zBrowser);
@@ -303,11 +298,11 @@
303298
0,
304299
NULL
305300
);
306301
}
307302
if( nMsg ){
308
- zMsg = fossil_unicode_to_utf8(tmp);
303
+ zMsg = fossil_mbcs_to_utf8(tmp);
309304
}else{
310305
fossil_fatal("unable to get system error message.");
311306
}
312307
if( tmp ){
313308
LocalFree((HLOCAL) tmp);
@@ -630,22 +625,22 @@
630625
/* Create the service. */
631626
hScm = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);
632627
if( !hScm ) fossil_fatal(zErrFmt, zSvcName, win32_get_last_errmsg());
633628
hSvc = CreateService(
634629
hScm, /* Handle to the SCM */
635
- fossil_utf8_to_unicode(zSvcName), /* Name of the service */
636
- fossil_utf8_to_unicode(zDisplay), /* Display name */
630
+ fossil_utf8_to_mbcs(zSvcName), /* Name of the service */
631
+ fossil_utf8_to_mbcs(zDisplay), /* Display name */
637632
SERVICE_ALL_ACCESS, /* Desired access */
638633
SERVICE_WIN32_OWN_PROCESS, /* Service type */
639634
dwStartType, /* Start type */
640635
SERVICE_ERROR_NORMAL, /* Error control */
641
- fossil_utf8_to_unicode(blob_str(&binPath)), /* Binary path */
636
+ fossil_utf8_to_mbcs(blob_str(&binPath)), /* Binary path */
642637
NULL, /* Load ordering group */
643638
NULL, /* Tag value */
644639
NULL, /* Service dependencies */
645
- fossil_utf8_to_unicode(zUsername), /* Service account */
646
- fossil_utf8_to_unicode(zPassword) /* Account password */
640
+ fossil_utf8_to_mbcs(zUsername), /* Service account */
641
+ fossil_utf8_to_mbcs(zPassword) /* Account password */
647642
);
648643
if( !hSvc ) fossil_fatal(zErrFmt, zSvcName, win32_get_last_errmsg());
649644
/* Set the service description. */
650645
ChangeServiceConfig2(hSvc, SERVICE_CONFIG_DESCRIPTION, &svcDescr);
651646
fossil_print("Service '%s' successfully created.\n", zSvcName);
@@ -664,11 +659,11 @@
664659
}else if( g.argc>4 ){
665660
fossil_fatal("to much arguments for delete method.");
666661
}
667662
hScm = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);
668663
if( !hScm ) fossil_fatal(zErrFmt, zSvcName, win32_get_last_errmsg());
669
- hSvc = OpenService(hScm, fossil_utf8_to_unicode(zSvcName), SERVICE_ALL_ACCESS);
664
+ hSvc = OpenService(hScm, fossil_utf8_to_mbcs(zSvcName), SERVICE_ALL_ACCESS);
670665
if( !hSvc ) fossil_fatal(zErrFmt, zSvcName, win32_get_last_errmsg());
671666
QueryServiceStatus(hSvc, &sstat);
672667
if( sstat.dwCurrentState!=SERVICE_STOPPED ){
673668
fossil_print("Stopping service '%s'", zSvcName);
674669
if( sstat.dwCurrentState!=SERVICE_STOP_PENDING ){
@@ -732,11 +727,11 @@
732727
}else if( g.argc>4 ){
733728
fossil_fatal("to much arguments for show method.");
734729
}
735730
hScm = OpenSCManager(NULL, NULL, GENERIC_READ);
736731
if( !hScm ) fossil_fatal(zErrFmt, zSvcName, win32_get_last_errmsg());
737
- hSvc = OpenService(hScm, fossil_utf8_to_unicode(zSvcName), GENERIC_READ);
732
+ hSvc = OpenService(hScm, fossil_utf8_to_mbcs(zSvcName), GENERIC_READ);
738733
if( !hSvc ) fossil_fatal(zErrFmt, zSvcName, win32_get_last_errmsg());
739734
/* Get the service configuration */
740735
bStatus = QueryServiceConfig(hSvc, NULL, 0, &nRequired);
741736
if( !bStatus && GetLastError()!=ERROR_INSUFFICIENT_BUFFER ){
742737
fossil_fatal(zErrFmt, zSvcName, win32_get_last_errmsg());
@@ -784,19 +779,19 @@
784779
case SERVICE_PAUSED: zSvcState = zSvcStates[6]; break;
785780
}
786781
/* Print service information to terminal */
787782
fossil_print("Service name .......: %s\n", zSvcName);
788783
fossil_print("Display name .......: %s\n",
789
- fossil_unicode_to_utf8(pSvcConfig->lpDisplayName));
784
+ fossil_mbcs_to_utf8(pSvcConfig->lpDisplayName));
790785
fossil_print("Service description : %s\n",
791
- fossil_unicode_to_utf8(pSvcDescr->lpDescription));
786
+ fossil_mbcs_to_utf8(pSvcDescr->lpDescription));
792787
fossil_print("Service type .......: %s.\n", zSvcType);
793788
fossil_print("Service start type .: %s.\n", zSvcStartType);
794789
fossil_print("Binary path name ...: %s\n",
795
- fossil_unicode_to_utf8(pSvcConfig->lpBinaryPathName));
790
+ fossil_mbcs_to_utf8(pSvcConfig->lpBinaryPathName));
796791
fossil_print("Service username ...: %s\n",
797
- fossil_unicode_to_utf8(pSvcConfig->lpServiceStartName));
792
+ fossil_mbcs_to_utf8(pSvcConfig->lpServiceStartName));
798793
fossil_print("Current state ......: %s.\n", zSvcState);
799794
/* Cleanup */
800795
fossil_free(pSvcConfig);
801796
fossil_free(pSvcDescr);
802797
CloseServiceHandle(hSvc);
@@ -814,11 +809,11 @@
814809
}else if( g.argc>4 ){
815810
fossil_fatal("to much arguments for start method.");
816811
}
817812
hScm = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);
818813
if( !hScm ) fossil_fatal(zErrFmt, zSvcName, win32_get_last_errmsg());
819
- hSvc = OpenService(hScm, fossil_utf8_to_unicode(zSvcName), SERVICE_ALL_ACCESS);
814
+ hSvc = OpenService(hScm, fossil_utf8_to_mbcs(zSvcName), SERVICE_ALL_ACCESS);
820815
if( !hSvc ) fossil_fatal(zErrFmt, zSvcName, win32_get_last_errmsg());
821816
QueryServiceStatus(hSvc, &sstat);
822817
if( sstat.dwCurrentState!=SERVICE_RUNNING ){
823818
fossil_print("Starting service '%s'", zSvcName);
824819
if( sstat.dwCurrentState!=SERVICE_START_PENDING ){
@@ -850,11 +845,11 @@
850845
}else if( g.argc>4 ){
851846
fossil_fatal("to much arguments for stop method.");
852847
}
853848
hScm = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);
854849
if( !hScm ) fossil_fatal(zErrFmt, zSvcName, win32_get_last_errmsg());
855
- hSvc = OpenService(hScm, fossil_utf8_to_unicode(zSvcName), SERVICE_ALL_ACCESS);
850
+ hSvc = OpenService(hScm, fossil_utf8_to_mbcs(zSvcName), SERVICE_ALL_ACCESS);
856851
if( !hSvc ) fossil_fatal(zErrFmt, zSvcName, win32_get_last_errmsg());
857852
QueryServiceStatus(hSvc, &sstat);
858853
if( sstat.dwCurrentState!=SERVICE_STOPPED ){
859854
fossil_print("Stopping service '%s'", zSvcName);
860855
if( sstat.dwCurrentState!=SERVICE_STOP_PENDING ){
861856
--- src/winhttp.c
+++ src/winhttp.c
@@ -19,11 +19,11 @@
19 ** for windows. It also implements a Windows Service which allows the HTTP
20 ** server to be run without any user logged on.
21 */
22 #include "config.h"
23 #ifdef _WIN32
24 /* This code is for win32 only */
25 #include <windows.h>
26 #include "winhttp.h"
27
28 /*
29 ** The HttpRequest structure holds information about each incoming
@@ -129,15 +129,10 @@
129 file_delete(zRequestFName);
130 file_delete(zReplyFName);
131 free(p);
132 }
133
134 #if !defined(UNICODE)
135 # define fossil_unicode_to_utf8 fossil_mbcs_to_utf8
136 # define fossil_utf8_to_unicode fossil_utf8_to_mbcs
137 #endif
138
139 /*
140 ** Start a listening socket and process incoming HTTP requests on
141 ** that socket.
142 */
143 void win32_http_server(
@@ -199,11 +194,11 @@
199 }
200 }
201 if( !GetTempPath(MAX_PATH, zTmpPath) ){
202 fossil_fatal("unable to get path to the temporary directory.");
203 }
204 zTempPrefix = mprintf("%sfossil_server_P%d_", fossil_unicode_to_utf8(zTmpPath), iPort);
205 fossil_print("Listening for HTTP requests on TCP port %d\n", iPort);
206 if( zBrowser ){
207 zBrowser = mprintf(zBrowser, iPort);
208 fossil_print("Launch webbrowser: %s\n", zBrowser);
209 fossil_system(zBrowser);
@@ -303,11 +298,11 @@
303 0,
304 NULL
305 );
306 }
307 if( nMsg ){
308 zMsg = fossil_unicode_to_utf8(tmp);
309 }else{
310 fossil_fatal("unable to get system error message.");
311 }
312 if( tmp ){
313 LocalFree((HLOCAL) tmp);
@@ -630,22 +625,22 @@
630 /* Create the service. */
631 hScm = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);
632 if( !hScm ) fossil_fatal(zErrFmt, zSvcName, win32_get_last_errmsg());
633 hSvc = CreateService(
634 hScm, /* Handle to the SCM */
635 fossil_utf8_to_unicode(zSvcName), /* Name of the service */
636 fossil_utf8_to_unicode(zDisplay), /* Display name */
637 SERVICE_ALL_ACCESS, /* Desired access */
638 SERVICE_WIN32_OWN_PROCESS, /* Service type */
639 dwStartType, /* Start type */
640 SERVICE_ERROR_NORMAL, /* Error control */
641 fossil_utf8_to_unicode(blob_str(&binPath)), /* Binary path */
642 NULL, /* Load ordering group */
643 NULL, /* Tag value */
644 NULL, /* Service dependencies */
645 fossil_utf8_to_unicode(zUsername), /* Service account */
646 fossil_utf8_to_unicode(zPassword) /* Account password */
647 );
648 if( !hSvc ) fossil_fatal(zErrFmt, zSvcName, win32_get_last_errmsg());
649 /* Set the service description. */
650 ChangeServiceConfig2(hSvc, SERVICE_CONFIG_DESCRIPTION, &svcDescr);
651 fossil_print("Service '%s' successfully created.\n", zSvcName);
@@ -664,11 +659,11 @@
664 }else if( g.argc>4 ){
665 fossil_fatal("to much arguments for delete method.");
666 }
667 hScm = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);
668 if( !hScm ) fossil_fatal(zErrFmt, zSvcName, win32_get_last_errmsg());
669 hSvc = OpenService(hScm, fossil_utf8_to_unicode(zSvcName), SERVICE_ALL_ACCESS);
670 if( !hSvc ) fossil_fatal(zErrFmt, zSvcName, win32_get_last_errmsg());
671 QueryServiceStatus(hSvc, &sstat);
672 if( sstat.dwCurrentState!=SERVICE_STOPPED ){
673 fossil_print("Stopping service '%s'", zSvcName);
674 if( sstat.dwCurrentState!=SERVICE_STOP_PENDING ){
@@ -732,11 +727,11 @@
732 }else if( g.argc>4 ){
733 fossil_fatal("to much arguments for show method.");
734 }
735 hScm = OpenSCManager(NULL, NULL, GENERIC_READ);
736 if( !hScm ) fossil_fatal(zErrFmt, zSvcName, win32_get_last_errmsg());
737 hSvc = OpenService(hScm, fossil_utf8_to_unicode(zSvcName), GENERIC_READ);
738 if( !hSvc ) fossil_fatal(zErrFmt, zSvcName, win32_get_last_errmsg());
739 /* Get the service configuration */
740 bStatus = QueryServiceConfig(hSvc, NULL, 0, &nRequired);
741 if( !bStatus && GetLastError()!=ERROR_INSUFFICIENT_BUFFER ){
742 fossil_fatal(zErrFmt, zSvcName, win32_get_last_errmsg());
@@ -784,19 +779,19 @@
784 case SERVICE_PAUSED: zSvcState = zSvcStates[6]; break;
785 }
786 /* Print service information to terminal */
787 fossil_print("Service name .......: %s\n", zSvcName);
788 fossil_print("Display name .......: %s\n",
789 fossil_unicode_to_utf8(pSvcConfig->lpDisplayName));
790 fossil_print("Service description : %s\n",
791 fossil_unicode_to_utf8(pSvcDescr->lpDescription));
792 fossil_print("Service type .......: %s.\n", zSvcType);
793 fossil_print("Service start type .: %s.\n", zSvcStartType);
794 fossil_print("Binary path name ...: %s\n",
795 fossil_unicode_to_utf8(pSvcConfig->lpBinaryPathName));
796 fossil_print("Service username ...: %s\n",
797 fossil_unicode_to_utf8(pSvcConfig->lpServiceStartName));
798 fossil_print("Current state ......: %s.\n", zSvcState);
799 /* Cleanup */
800 fossil_free(pSvcConfig);
801 fossil_free(pSvcDescr);
802 CloseServiceHandle(hSvc);
@@ -814,11 +809,11 @@
814 }else if( g.argc>4 ){
815 fossil_fatal("to much arguments for start method.");
816 }
817 hScm = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);
818 if( !hScm ) fossil_fatal(zErrFmt, zSvcName, win32_get_last_errmsg());
819 hSvc = OpenService(hScm, fossil_utf8_to_unicode(zSvcName), SERVICE_ALL_ACCESS);
820 if( !hSvc ) fossil_fatal(zErrFmt, zSvcName, win32_get_last_errmsg());
821 QueryServiceStatus(hSvc, &sstat);
822 if( sstat.dwCurrentState!=SERVICE_RUNNING ){
823 fossil_print("Starting service '%s'", zSvcName);
824 if( sstat.dwCurrentState!=SERVICE_START_PENDING ){
@@ -850,11 +845,11 @@
850 }else if( g.argc>4 ){
851 fossil_fatal("to much arguments for stop method.");
852 }
853 hScm = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);
854 if( !hScm ) fossil_fatal(zErrFmt, zSvcName, win32_get_last_errmsg());
855 hSvc = OpenService(hScm, fossil_utf8_to_unicode(zSvcName), SERVICE_ALL_ACCESS);
856 if( !hSvc ) fossil_fatal(zErrFmt, zSvcName, win32_get_last_errmsg());
857 QueryServiceStatus(hSvc, &sstat);
858 if( sstat.dwCurrentState!=SERVICE_STOPPED ){
859 fossil_print("Stopping service '%s'", zSvcName);
860 if( sstat.dwCurrentState!=SERVICE_STOP_PENDING ){
861
--- src/winhttp.c
+++ src/winhttp.c
@@ -19,11 +19,11 @@
19 ** for windows. It also implements a Windows Service which allows the HTTP
20 ** server to be run without any user logged on.
21 */
22 #include "config.h"
23 #ifdef _WIN32
24 /* This code is for win32/unicode only */
25 #include <windows.h>
26 #include "winhttp.h"
27
28 /*
29 ** The HttpRequest structure holds information about each incoming
@@ -129,15 +129,10 @@
129 file_delete(zRequestFName);
130 file_delete(zReplyFName);
131 free(p);
132 }
133
 
 
 
 
 
134 /*
135 ** Start a listening socket and process incoming HTTP requests on
136 ** that socket.
137 */
138 void win32_http_server(
@@ -199,11 +194,11 @@
194 }
195 }
196 if( !GetTempPath(MAX_PATH, zTmpPath) ){
197 fossil_fatal("unable to get path to the temporary directory.");
198 }
199 zTempPrefix = mprintf("%sfossil_server_P%d_", fossil_mbcs_to_utf8(zTmpPath), iPort);
200 fossil_print("Listening for HTTP requests on TCP port %d\n", iPort);
201 if( zBrowser ){
202 zBrowser = mprintf(zBrowser, iPort);
203 fossil_print("Launch webbrowser: %s\n", zBrowser);
204 fossil_system(zBrowser);
@@ -303,11 +298,11 @@
298 0,
299 NULL
300 );
301 }
302 if( nMsg ){
303 zMsg = fossil_mbcs_to_utf8(tmp);
304 }else{
305 fossil_fatal("unable to get system error message.");
306 }
307 if( tmp ){
308 LocalFree((HLOCAL) tmp);
@@ -630,22 +625,22 @@
625 /* Create the service. */
626 hScm = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);
627 if( !hScm ) fossil_fatal(zErrFmt, zSvcName, win32_get_last_errmsg());
628 hSvc = CreateService(
629 hScm, /* Handle to the SCM */
630 fossil_utf8_to_mbcs(zSvcName), /* Name of the service */
631 fossil_utf8_to_mbcs(zDisplay), /* Display name */
632 SERVICE_ALL_ACCESS, /* Desired access */
633 SERVICE_WIN32_OWN_PROCESS, /* Service type */
634 dwStartType, /* Start type */
635 SERVICE_ERROR_NORMAL, /* Error control */
636 fossil_utf8_to_mbcs(blob_str(&binPath)), /* Binary path */
637 NULL, /* Load ordering group */
638 NULL, /* Tag value */
639 NULL, /* Service dependencies */
640 fossil_utf8_to_mbcs(zUsername), /* Service account */
641 fossil_utf8_to_mbcs(zPassword) /* Account password */
642 );
643 if( !hSvc ) fossil_fatal(zErrFmt, zSvcName, win32_get_last_errmsg());
644 /* Set the service description. */
645 ChangeServiceConfig2(hSvc, SERVICE_CONFIG_DESCRIPTION, &svcDescr);
646 fossil_print("Service '%s' successfully created.\n", zSvcName);
@@ -664,11 +659,11 @@
659 }else if( g.argc>4 ){
660 fossil_fatal("to much arguments for delete method.");
661 }
662 hScm = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);
663 if( !hScm ) fossil_fatal(zErrFmt, zSvcName, win32_get_last_errmsg());
664 hSvc = OpenService(hScm, fossil_utf8_to_mbcs(zSvcName), SERVICE_ALL_ACCESS);
665 if( !hSvc ) fossil_fatal(zErrFmt, zSvcName, win32_get_last_errmsg());
666 QueryServiceStatus(hSvc, &sstat);
667 if( sstat.dwCurrentState!=SERVICE_STOPPED ){
668 fossil_print("Stopping service '%s'", zSvcName);
669 if( sstat.dwCurrentState!=SERVICE_STOP_PENDING ){
@@ -732,11 +727,11 @@
727 }else if( g.argc>4 ){
728 fossil_fatal("to much arguments for show method.");
729 }
730 hScm = OpenSCManager(NULL, NULL, GENERIC_READ);
731 if( !hScm ) fossil_fatal(zErrFmt, zSvcName, win32_get_last_errmsg());
732 hSvc = OpenService(hScm, fossil_utf8_to_mbcs(zSvcName), GENERIC_READ);
733 if( !hSvc ) fossil_fatal(zErrFmt, zSvcName, win32_get_last_errmsg());
734 /* Get the service configuration */
735 bStatus = QueryServiceConfig(hSvc, NULL, 0, &nRequired);
736 if( !bStatus && GetLastError()!=ERROR_INSUFFICIENT_BUFFER ){
737 fossil_fatal(zErrFmt, zSvcName, win32_get_last_errmsg());
@@ -784,19 +779,19 @@
779 case SERVICE_PAUSED: zSvcState = zSvcStates[6]; break;
780 }
781 /* Print service information to terminal */
782 fossil_print("Service name .......: %s\n", zSvcName);
783 fossil_print("Display name .......: %s\n",
784 fossil_mbcs_to_utf8(pSvcConfig->lpDisplayName));
785 fossil_print("Service description : %s\n",
786 fossil_mbcs_to_utf8(pSvcDescr->lpDescription));
787 fossil_print("Service type .......: %s.\n", zSvcType);
788 fossil_print("Service start type .: %s.\n", zSvcStartType);
789 fossil_print("Binary path name ...: %s\n",
790 fossil_mbcs_to_utf8(pSvcConfig->lpBinaryPathName));
791 fossil_print("Service username ...: %s\n",
792 fossil_mbcs_to_utf8(pSvcConfig->lpServiceStartName));
793 fossil_print("Current state ......: %s.\n", zSvcState);
794 /* Cleanup */
795 fossil_free(pSvcConfig);
796 fossil_free(pSvcDescr);
797 CloseServiceHandle(hSvc);
@@ -814,11 +809,11 @@
809 }else if( g.argc>4 ){
810 fossil_fatal("to much arguments for start method.");
811 }
812 hScm = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);
813 if( !hScm ) fossil_fatal(zErrFmt, zSvcName, win32_get_last_errmsg());
814 hSvc = OpenService(hScm, fossil_utf8_to_mbcs(zSvcName), SERVICE_ALL_ACCESS);
815 if( !hSvc ) fossil_fatal(zErrFmt, zSvcName, win32_get_last_errmsg());
816 QueryServiceStatus(hSvc, &sstat);
817 if( sstat.dwCurrentState!=SERVICE_RUNNING ){
818 fossil_print("Starting service '%s'", zSvcName);
819 if( sstat.dwCurrentState!=SERVICE_START_PENDING ){
@@ -850,11 +845,11 @@
845 }else if( g.argc>4 ){
846 fossil_fatal("to much arguments for stop method.");
847 }
848 hScm = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);
849 if( !hScm ) fossil_fatal(zErrFmt, zSvcName, win32_get_last_errmsg());
850 hSvc = OpenService(hScm, fossil_utf8_to_mbcs(zSvcName), SERVICE_ALL_ACCESS);
851 if( !hSvc ) fossil_fatal(zErrFmt, zSvcName, win32_get_last_errmsg());
852 QueryServiceStatus(hSvc, &sstat);
853 if( sstat.dwCurrentState!=SERVICE_STOPPED ){
854 fossil_print("Stopping service '%s'", zSvcName);
855 if( sstat.dwCurrentState!=SERVICE_STOP_PENDING ){
856

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button