Overview
SHA1 Hash: | c7278fd013abfe2490ed36ad257e716c9daebf2b |
---|---|
Date: | 2007-09-22 06:47:11 |
User: | jnc |
Comment: | Win32 port now functional except network operations. This commit was done on windows :-). See win32.txt for status of all commands. No networking commands are functional yet. All path operations are now functioning. |
Timelines: | ancestors | descendants | both | trunk |
Other Links: | files | ZIP archive | manifest |
Tags And Properties
- branch=trunk inherited from [a28c83647d]
- sym-trunk inherited from [a28c83647d]
Changes
[hide diffs]Modified src/add.c from [771768ca0d] to [7e200015f8].
@@ -50,11 +50,11 @@ char *zName; char *zPath; Blob pathname; int isDir; - zName = mprintf("%s", g.argv[i]); + zName = mprintf("%/", g.argv[i]); isDir = file_isdir(zName); if( isDir==1 ) continue; if( isDir==0 ){ fossil_fatal("not found: %s", zName); } @@ -100,11 +100,11 @@ for(i=2; i<g.argc; i++){ char *zName; char *zPath; Blob pathname; - zName = mprintf("%s", g.argv[i]); + zName = mprintf("%/", g.argv[i]); file_tree_name(zName, &pathname); zPath = blob_str(&pathname); if( !db_exists( "SELECT 1 FROM vfile WHERE pathname=%Q AND NOT deleted", zPath) ){ fossil_fatal("not in the repository: %s", zName);
Modified src/blob.c from [f2c016552c] to [70f1a3c914].
@@ -571,13 +571,24 @@ } nName = file_simplify_name(zName, nName); for(i=1; i<nName; i++){ if( zName[i]=='/' ){ zName[i] = 0; - if( file_mkdir(zName, 1) ){ - fossil_panic("unable to create directory %s", zName); +#ifdef __MINGW32__ + /* + ** On Windows, local path looks like: C:/develop/project/file.txt + ** The if stops us from trying to create a directory of a drive letter + ** C: in this example. + */ + if( !(i==2 && zName[1]==':') ){ +#endif + if( file_mkdir(zName, 1) ){ + fossil_panic("unable to create directory %s", zName); + } +#ifdef __MINGW32__ } +#endif zName[i] = '/'; } } out = fopen(zName, "wb"); if( out==0 ){
Modified src/db.c from [327a476fd7] to [b9655281e8].
@@ -490,15 +490,31 @@ ** Open the user database in "~/.fossil". Create the database anew if ** it does not already exist. */ void db_open_config(void){ char *zDbName; - const char *zHome = getenv("HOME"); + const char *zHome; +#ifdef __MINGW32__ + zHome = getenv("LOCALAPPDATA"); + if( zHome==0 ){ + zHome = getenv("APPDATA"); + if( zHome==0 ){ + zHome = getenv("HOMEPATH"); + } + } +#else + zHome = getenv("HOME"); +#endif if( zHome==0 ){ db_err("cannot local home directory"); } +#ifdef __MINGW32__ + /* . filenames give some window systems problems and many apps problems */ + zDbName = mprintf("%s/_fossil", zHome); +#else zDbName = mprintf("%s/.fossil", zHome); +#endif if( g.configOpen ) return; if( file_size(zDbName)<1024*3 ){ db_init_database(zDbName, zConfigSchema, (char*)0); } db_open_or_attach(zDbName, "configdb"); @@ -536,15 +552,19 @@ ** it is attached to the open database connection too. */ int db_open_local(void){ int n; char zPwd[2000]; + char *zPwdConv; if( g.localOpen) return 1; if( getcwd(zPwd, sizeof(zPwd)-20)==0 ){ db_err("pwd too big: max %d", sizeof(zPwd)-20); } n = strlen(zPwd); + zPwdConv = mprintf("%/", zPwd); + strncpy(zPwd, zPwdConv, 2000-20); + free(zPwdConv); while( n>0 ){ if( access(zPwd, W_OK) ) break; strcpy(&zPwd[n], "/_FOSSIL_"); if( isValidLocalDb(zPwd) ){ /* Found a valid _FOSSIL_ file */
Modified src/file.c from [b0274645f0] to [0453cec099].
@@ -192,11 +192,11 @@ if( getcwd(zPwd, sizeof(zPwd)-20)==0 ){ fprintf(stderr, "pwd too big: max %d\n", sizeof(zPwd)-20); exit(1); } blob_zero(pOut); - blob_appendf(pOut, "%s/%s", zPwd, zOrigName); + blob_appendf(pOut, "%//%/", zPwd, zOrigName); } blob_resize(pOut, file_simplify_name(blob_buffer(pOut), blob_size(pOut))); } /*
Modified src/http.c from [02b60e1f62] to [02357907c7].
@@ -41,10 +41,28 @@ /* ** Persistent information about the HTTP connection. */ static FILE *pSocket = 0; /* The socket on which we talk to the server */ +#ifdef __MINGW32__ +static WSADATA ws_info; +#endif + +static void ws_init(){ +#ifdef __MINGW32__ + if (WSAStartup(MAKEWORD(1,1), &ws_info) != 0){ + fossil_panic("can't initialize winsock"); + } +#endif +} + +static void ws_cleanup(){ +#ifdef __MINGW32__ + WSACleanup(); +#endif +} + /* ** Open a socket connection to the server. Return 0 on success and ** non-zero if an error occurs. */ static int http_open_socket(void){ @@ -51,10 +69,12 @@ static struct sockaddr_in addr; /* The server address */ static int addrIsInit = 0; /* True once addr is initialized */ int s; if( !addrIsInit ){ + ws_init(); + addr.sin_family = AF_INET; addr.sin_port = htons(g.urlPort); *(int*)&addr.sin_addr = inet_addr(g.urlName); if( -1 == *(int*)&addr.sin_addr ){ #ifndef FOSSIL_STATIC_LINK @@ -269,7 +289,8 @@ */ void http_close(void){ if( pSocket ){ fclose(pSocket); pSocket = 0; + ws_cleanup(); } }
Modified src/printf.c from [48f1118d8e] to [63619c9ec6].
@@ -49,10 +49,11 @@ #define etPOINTER 15 /* The %p conversion */ #define etHTMLIZE 16 /* Make text safe for HTML */ #define etHTTPIZE 17 /* Make text safe for HTTP. "/" encoded as %2f */ #define etURLIZE 18 /* Make text safe for HTTP. "/" not encoded */ #define etFOSSILIZE 19 /* The fossil header encoding format. */ +#define etPATH 20 /* Path type */ /* ** An "etByte" is an 8-bit unsigned value. */ @@ -109,10 +110,11 @@ { 'G', 0, 1, etGENERIC, 14, 0 }, { 'i', 10, 1, etRADIX, 0, 0 }, { 'n', 0, 0, etSIZE, 0, 0 }, { '%', 0, 0, etPERCENT, 0, 0 }, { 'p', 16, 0, etPOINTER, 0, 1 }, + { '/', 0, 0, etPATH, 0, 0 }, }; #define etNINFO (sizeof(fmtinfo)/sizeof(fmtinfo[0])) /* ** "*val" is a double such that 0.1 <= *val < 10.0 @@ -541,10 +543,26 @@ }else{ length =1; } bufpt = buf; break; + case etPATH: { + int i; + char *e = va_arg(ap,char*); + if( e==0 ){e="";} + length = strlen(e); + zExtra = bufpt = malloc(length+1); + for( i=0; i<length; i++ ){ + if( e[i]=='\\' ){ + bufpt[i]='/'; + }else{ + bufpt[i]=e[i]; + } + } + bufpt[length]='\0'; + break; + } case etSTRING: case etDYNSTRING: bufpt = va_arg(ap,char*); if( bufpt==0 ){ bufpt = "";
Modified win32.txt from [efd9bcfec9] to [a31e062bd3].
@@ -11,5 +11,89 @@ Download/compile/install zlib (configure --prefix=/mingw) Download/compile/install tclsh (configure --prefix=/) (for tests) All commands were issued in the MSYS shell, not a cmd.exe + + +Outstanding Issues: +---------------------------------------------------------------------- + +* server is totally non-functional - #if/#end'd out of the code +* all path operations are defunct +* remote network operations are reporting: can't resolve host name: xyz + + Winsock must be initialized before using: + + WSADATA info; + if (WSAStartup(MAKEWORD(1,1), &info) != 0){ + fossil_panic("can't initialize winsock"); + } + + + +Commands status: +---------------------------------------------------------------------- + +add OK +cgi Not tested +changes OK +checkout BAD #1 +clean OK +clone Local Only #2 +close OK +commit OK (not tested with gpg signing yet) +config OK +deconstruct OK +del OK +descendents OK +diff OK +extra OK +help OK +http Not Tested +info OK +leaves OK +ls OK +merge OK +new OK +open OK +pull BAD #2 +push BAD #2 +rebuild OK (didn't have a corrupt file to try on though) +redo BAD #3 +rm OK +server BAD #2,#4 +status OK +sync BAD #2 +timeline OK +tkdiff OK +undo OK +update OK +user capabilities OK +user default OK +user list OK +user new OK +user password OK + +#1 Have a repo where I removed a file. I did a fossil checkout 123abc, + which is the last version that had the file. The file does not + appear. fossil checkout --force 123abc does things, but still the + file does not appear. + + Make a new dir, fossil open ../repo.fsl && fossil checkout 123abc and + the file appears. + + Is that normal operation? + +#2 No socket operations are functioning yet + +#3 In test1/ I edited a file, test2/ I updated, type file.txt changes + were there. I then did fossil undo file.txt. The changes were gone + and fossil status said I had edited file.txt. A fossil redo did not + print anything to the screen and the changes for file.txt are not + in the file. fossil status still reports that the file was edited. + There was no commit/update or any other command inbetween these + actions. + +#4 There were various difficulties in this function beyond simple socket + problems. The major one being fork. This will probably be the last + command to be functional in fossil on windows.