Check-in [83c876b447]
Not logged in
Overview

SHA1 Hash:83c876b44708a2a5c7380645814ea218cbbaf4ab
Date: 2007-09-21 21:53:28
User: anonymous
Comment:Win32 port: compiles, all tests pass but many functions fail due to path separators. Incomplete. Path fixes to come next
Timelines: ancestors | descendants | both | trunk
Other Links: files | ZIP archive | manifest

Tags And Properties
Changes
[hide diffs]

Modified Makefile from [80acf0670d] to [32e9920702].

@@ -24,22 +24,25 @@
 #    the finished binary for fossil.  The BCC compiler above is used
 #    for building intermediate code-generator tools.
 #
 #TCC = gcc -O6
 #TCC = gcc -g -O0 -Wall -fprofile-arcs -ftest-coverage
-TCC = gcc -g -Os -Wall
+#TCC = gcc -g -Os -Wall
+TCC = gcc -g -Os -Wall -DFOSSIL_I18N=0
 
 #### Extra arguments for linking the finished binary.  Fossil needs
 #    to link against the Z-Lib compression library.  There are no
 #    other dependencies.  We sometimes add the -static option here
 #    so that we can build a static executable that will run in a
 #    chroot jail.
 #
-LIB = -lz
+#LIB = -lz
+LIB = -lz -lwsock32
+
 
 #### Tcl shell for use in running the fossil testsuite.
 #
 TCLSH = tclsh
 
 # You should not need to change anything below this line
 ###############################################################################
 include $(SRCDIR)/main.mk

Modified src/cgi.c from [f25a72aeb6] to [1e442c1fca].

@@ -26,20 +26,26 @@
 ** dispensing QUERY_STRING parameters and cookies, the "mprintf()"
 ** formatting function and its cousins, and routines to encode and
 ** decode strings in HTML or HTTP.
 */
 #include "config.h"
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <time.h>
-#include <sys/times.h>
-#include <sys/time.h>
-#include <sys/wait.h>
+#ifdef __MINGW32__
+#  include <windows.h>           /* for Sleep once server works again */
+#  include <winsock.h>           /* socket operations */
+#  define sleep Sleep            /* windows does not have sleep, but Sleep */
+#else
+#  include <sys/socket.h>
+#  include <netinet/in.h>
+#  include <arpa/inet.h>
+#  include <sys/times.h>
+#  include <sys/time.h>
+#  include <sys/wait.h>
+#  include <sys/select.h>
+#endif
+#include <time.h>
 #include <stdio.h>
 #include <stdlib.h>
-#include <sys/select.h>
 #include <unistd.h>
 #include "cgi.h"
 
 #if INTERFACE
 /*
@@ -1076,10 +1082,14 @@
 ** As new connections arrive, fork a child and let child return
 ** out of this procedure call.  The child will handle the request.
 ** The parent never returns from this procedure.
 */
 void cgi_http_server(int iPort){
+#ifdef __MINGW32__
+  fprintf(stderr,"server not yet available in windows version of fossil\n");
+  exit(1);
+#else
   int listener;                /* The server socket */
   int connection;              /* A socket for each individual connection */
   fd_set readfds;              /* Set of file descriptors for select() */
   size_t lenaddr;              /* Length of the inaddr structure */
   int child;                   /* PID of the child process */
@@ -1142,10 +1152,11 @@
       nchildren--;
     }
   }
   /* NOT REACHED */
   exit(1);
+#endif
 }
 
 /*
 ** Name of days and months.
 */

Modified src/db.c from [16bbdf5494] to [327a476fd7].

@@ -33,14 +33,16 @@
 **    (3)  A local checkout database named "FOSSIL" and located at the
 **         root of the local copy of the source tree.
 **
 */
 #include "config.h"
+#ifndef __MINGW32__
+#  include <pwd.h>
+#endif
 #include <sqlite3.h>
 #include <sys/types.h>
 #include <sys/stat.h>
-#include <pwd.h>
 #include <unistd.h>
 #include "db.h"
 
 #if INTERFACE
 /*

Modified src/file.c from [43aa6bdf65] to [b0274645f0].

@@ -105,11 +105,15 @@
   if( rc==2 ){
     if( !forceFlag ) return 1;
     unlink(zName);
   }
   if( rc!=1 ){
+#ifdef __MINGW32__
+    return mkdir(zName);
+#else
     return mkdir(zName, 0755);
+#endif
   }
   return 0;
 }
 
 /*

Modified src/http.c from [43986095c4] to [02b60e1f62].

@@ -23,16 +23,21 @@
 **
 ** This file contains code that implements the client-side HTTP protocol
 */
 #include "config.h"
 #include "http.h"
+#ifdef __MINGW32__
+#  include <windows.h>
+#  include <winsock.h>
+#else
+#  include <arpa/inet.h>
+#  include <sys/socket.h>
+#  include <netdb.h>
+#  include <netinet/in.h>
+#endif
 #include <assert.h>
-#include <arpa/inet.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netdb.h>
-#include <netinet/in.h>
+#include <sys/types.h>
 #include <signal.h>
 
 /*
 ** Persistent information about the HTTP connection.
 */
@@ -77,11 +82,13 @@
   }
   if( connect(s,(struct sockaddr*)&addr,sizeof(addr))<0 ){
     fossil_panic("cannot connect to host %s:%d", g.urlName, g.urlPort);
   }
   pSocket = fdopen(s,"r+");
+#ifndef __MINGW32__
   signal(SIGPIPE, SIG_IGN);
+#endif
   return 0;
 }
 
 /*
 ** Make a single attempt to talk to the server.  Return TRUE on success

Modified src/login.c from [4e89d2580b] to [d1ac22275c].

@@ -44,10 +44,14 @@
 ** logs and downloading diffs of very version of the archive that
 ** has ever existed, and things like that.
 */
 #include "config.h"
 #include "login.h"
+#ifdef __MINGW32__
+#  include <windows.h>           /* for Sleep */
+#  define sleep Sleep            /* windows does not have sleep, but Sleep */
+#endif
 #include <time.h>
 
 /*
 ** Return the name of the login cookie
 */

Modified src/user.c from [7f6b214713] to [2a5d91addf].

@@ -44,10 +44,50 @@
     }
     if( z[i]<' ' ) z[i] = ' ';
   }
   blob_append(pBlob, z, -1);
 }
+
+#ifdef __MINGW32__
+/*
+** getpass for Windows
+*/
+static char *getpass(const char *prompt){
+  static char pwd[64];
+  size_t i;
+
+  fputs(prompt,stderr);
+  fflush(stderr);
+  for(i=0; i<sizeof(pwd)-1; ++i){
+    pwd[i] = _getch();
+    if(pwd[i]=='\r' || pwd[i]=='\n'){
+      break;
+    }
+    /* BS or DEL */
+    else if(i>0 && (pwd[i]==8 || pwd[i]==127)){
+      i -= 2;
+      continue;
+    }
+    /* CTRL-C */
+    else if(pwd[i]==3) {
+      i=0;
+      break;
+    }
+    /* ESC */
+    else if(pwd[i]==27){
+      i=0;
+      break;
+    }
+    else{
+      fputc('*',stderr);
+    }
+  }
+  pwd[i]='\0';
+  fputs("\n", stderr);
+  return pwd;
+}
+#endif
 
 /*
 ** Do a single prompt for a passphrase.  Store the results in the blob.
 */
 static void prompt_for_passphrase(const char *zPrompt, Blob *pPassphrase){