Index: src/add.c ================================================================== --- src/add.c +++ src/add.c @@ -53,11 +53,11 @@ fossil_warning("cannot add %s", zPath); }else{ if( !file_is_simple_pathname(zPath) ){ fossil_fatal("filename contains illegal characters: %s", zPath); } -#ifdef __MINGW32__ +#if defined(_WIN32) if( db_exists("SELECT 1 FROM vfile" " WHERE pathname=%Q COLLATE nocase", zPath) ){ db_multi_exec("UPDATE vfile SET deleted=0" " WHERE pathname=%Q COLLATE nocase", zPath); } @@ -152,11 +152,11 @@ db_begin_transaction(); if( !file_tree_name(g.zRepositoryName, &repo, 0) ){ blob_zero(&repo); } db_multi_exec("CREATE TEMP TABLE sfile(x TEXT PRIMARY KEY)"); -#ifdef __MINGW32__ +#if defined(_WIN32) db_multi_exec( "CREATE INDEX IF NOT EXISTS vfile_pathname " " ON vfile(pathname COLLATE nocase)" ); #endif Index: src/blob.c ================================================================== --- src/blob.c +++ src/blob.c @@ -660,11 +660,11 @@ } nName = file_simplify_name(zName, nName); for(i=1; i<nName; i++){ if( zName[i]=='/' ){ zName[i] = 0; -#ifdef __MINGW32__ +#if defined(_WIN32) /* ** 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. */ @@ -672,11 +672,11 @@ #endif if( file_mkdir(zName, 1) ){ fossil_fatal_recursive("unable to create directory %s", zName); return 0; } -#ifdef __MINGW32__ +#if defined(_WIN32) } #endif zName[i] = '/'; } } @@ -856,11 +856,11 @@ blob_reset(&b3); } printf("ok\n"); } -#ifdef __MINGW32__ +#if defined(_WIN32) /* ** Convert every \n character in the given blob into \r\n. */ void blob_add_cr(Blob *p){ char *z = p->aData; Index: src/cgi.c ================================================================== --- src/cgi.c +++ src/cgi.c @@ -20,15 +20,16 @@ ** 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" -#ifdef __MINGW32__ +#ifdef _WIN32 # include <windows.h> /* for Sleep once server works again */ -# include <winsock2.h> /* socket operations */ -# define sleep Sleep /* windows does not have sleep, but Sleep */ -# include <ws2tcpip.h> +# if defined(__MINGW32__) +# define sleep Sleep /* windows does not have sleep, but Sleep */ +# include <ws2tcpip.h> +# endif #else # include <sys/socket.h> # include <netinet/in.h> # include <arpa/inet.h> # include <sys/times.h> @@ -1039,11 +1040,11 @@ ** ** Return 0 to each child as it runs. If unable to establish a ** listening socket, return non-zero. */ int cgi_http_server(int mnPort, int mxPort, char *zBrowser, int flags){ -#ifdef __MINGW32__ +#if defined(_WIN32) /* Use win32_http_server() instead */ fossil_exit(1); #else int listener = -1; /* The server socket */ int connection; /* A socket for each individual connection */ Index: src/checkin.c ================================================================== --- src/checkin.c +++ src/checkin.c @@ -401,19 +401,19 @@ } if( zEditor==0 ){ zEditor = getenv("EDITOR"); } if( zEditor==0 ){ -#ifdef __MINGW32__ +#if defined(_WIN32) zEditor = "notepad"; #else zEditor = "ed"; #endif } zFile = db_text(0, "SELECT '%qci-comment-' || hex(randomblob(6)) || '.txt'", g.zLocalRoot); -#ifdef __MINGW32__ +#if defined(_WIN32) blob_add_cr(&text); #endif blob_write_to_file(&text, zFile); zCmd = mprintf("%s \"%s\"", zEditor, zFile); printf("%s\n", zCmd); @@ -775,11 +775,11 @@ const char *zOrig = db_column_text(&q, 2); int frid = db_column_int(&q, 3); int isexe = db_column_int(&q, 4); const char *zPerm; blob_append(&filename, zName, -1); -#ifndef __MINGW32__ +#if !defined(_WIN32) /* For unix, extract the "executable" permission bit directly from ** the filesystem. On windows, the "executable" bit is retained ** unchanged from the original. */ isexe = file_isexe(blob_str(&filename)); #endif Index: src/config.h ================================================================== --- src/config.h +++ src/config.h @@ -26,12 +26,17 @@ #include <stdlib.h> #include <ctype.h> #include <string.h> #include <stdarg.h> #include <assert.h> -#ifdef __MINGW32__ -# include <windows.h> +#if defined( __MINGW32__) || defined(__DMC__) || defined(_MSC_VER) +# if defined(__DMC__) || defined(_MSC_VER) + typedef int socklen_t; +# endif +# ifndef _WIN32 +# define _WIN32 +# endif #else # include <sys/types.h> # include <signal.h> # include <pwd.h> #endif Index: src/db.c ================================================================== --- src/db.c +++ src/db.c @@ -27,10 +27,13 @@ ** (3) A local checkout database named "_FOSSIL_" or ".fos" ** and located at the root of the local copy of the source tree. ** */ #include "config.h" +#if ! defined(_WIN32) +# include <pwd.h> +#endif #include <sqlite3.h> #include <sys/types.h> #include <sys/stat.h> #include <unistd.h> #include "db.h" @@ -534,11 +537,11 @@ } db_finalize(&s); return z; } -#ifdef __MINGW32__ +#if defined(_WIN32) extern char *sqlite3_win32_mbcs_to_utf8(const char*); #endif /* ** Initialize a new database file with the given schema. If anything @@ -552,11 +555,11 @@ sqlite3 *db; int rc; const char *zSql; va_list ap; -#ifdef __MINGW32__ +#if defined(_WIN32) zFileName = sqlite3_win32_mbcs_to_utf8(zFileName); #endif rc = sqlite3_open(zFileName, &db); if( rc!=SQLITE_OK ){ db_err(sqlite3_errmsg(db)); @@ -587,11 +590,11 @@ int rc; const char *zVfs; sqlite3 *db; zVfs = getenv("FOSSIL_VFS"); -#ifdef __MINGW32__ +#if defined(_WIN32) zDbName = sqlite3_win32_mbcs_to_utf8(zDbName); #endif rc = sqlite3_open_v2( zDbName, &db, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, @@ -615,11 +618,11 @@ if( !g.db ){ g.db = openDatabase(zDbName); g.zRepoDb = "main"; db_connection_init(); }else{ -#ifdef __MINGW32__ +#if defined(_WIN32) zDbName = sqlite3_win32_mbcs_to_utf8(zDbName); #endif db_multi_exec("ATTACH DATABASE %Q AS %s", zDbName, zLabel); g.zRepoDb = mprintf("%s", zLabel); } @@ -639,11 +642,11 @@ */ void db_open_config(int useAttach){ char *zDbName; const char *zHome; if( g.configOpen ) return; -#ifdef __MINGW32__ +#if defined(_WIN32) zHome = getenv("LOCALAPPDATA"); if( zHome==0 ){ zHome = getenv("APPDATA"); if( zHome==0 ){ zHome = getenv("HOMEPATH"); @@ -667,11 +670,11 @@ if( access(zHome, W_OK) ){ fossil_fatal("home directory %s must be writeable", zHome); } #endif g.zHome = mprintf("%/", zHome); -#ifdef __MINGW32__ +#if defined(_WIN32) /* . filenames give some window systems problems and many apps problems */ zDbName = mprintf("%//_fossil", zHome); #else zDbName = mprintf("%s/.fossil", zHome); #endif @@ -944,11 +947,11 @@ zUser = db_get("default-user", 0); if( zUser==0 ){ zUser = zDefaultUser; } if( zUser==0 ){ -#ifdef __MINGW32__ +#if defined(_WIN32) zUser = getenv("USERNAME"); #else zUser = getenv("USER"); #endif } Index: src/diffcmd.c ================================================================== --- src/diffcmd.c +++ src/diffcmd.c @@ -45,11 +45,11 @@ /* ** This function implements a cross-platform "system()" interface. */ int portable_system(const char *zOrigCmd){ int rc; -#ifdef __MINGW32__ +#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); rc = system(zNewCmd); Index: src/file.c ================================================================== --- src/file.c +++ src/file.c @@ -83,11 +83,14 @@ ** Return TRUE if the named file is an executable. Return false ** for directories, devices, fifos, symlinks, etc. */ int file_isexe(const char *zFilename){ if( getStat(zFilename) || !S_ISREG(fileStat.st_mode) ) return 0; -#ifdef __MINGW32__ +#if defined(_WIN32) +# if defined(__DMC__) || defined(_MSC_VER) +# define S_IXUSR _S_IEXEC +# endif return ((S_IXUSR)&fileStat.st_mode)!=0; #else return ((S_IXUSR|S_IXGRP|S_IXOTH)&fileStat.st_mode)!=0; #endif } @@ -145,11 +148,11 @@ /* ** Set or clear the execute bit on a file. */ void file_setexe(const char *zFilename, int onoff){ -#ifndef __MINGW32__ +#if !defined(_WIN32) struct stat buf; if( stat(zFilename, &buf)!=0 ) return; if( onoff ){ if( (buf.st_mode & 0111)!=0111 ){ chmod(zFilename, buf.st_mode | 0111); @@ -157,11 +160,11 @@ }else{ if( (buf.st_mode & 0111)!=0 ){ chmod(zFilename, buf.st_mode & ~0111); } } -#endif /* __MINGW32__ */ +#endif /* _WIN32 */ } /* ** Create the directory named in the argument, if it does not already ** exist. If forceFlag is 1, delete any prior non-directory object @@ -174,11 +177,11 @@ if( rc==2 ){ if( !forceFlag ) return 1; unlink(zName); } if( rc!=1 ){ -#ifdef __MINGW32__ +#if defined(_WIN32) return mkdir(zName); #else return mkdir(zName, 0755); #endif } @@ -231,11 +234,11 @@ ** Changes are made in-place. Return the new name length. */ int file_simplify_name(char *z, int n){ int i, j; if( n<0 ) n = strlen(z); -#ifdef __MINGW32__ +#if defined(_WIN32) for(i=0; i<n; i++){ if( z[i]=='\\' ) z[i] = '/'; } #endif while( n>1 && z[n-1]=='/' ){ n--; } @@ -266,11 +269,11 @@ ** Remove all /./ path elements. ** Convert /A/../ to just / */ void file_canonical_name(const char *zOrigName, Blob *pOut){ if( zOrigName[0]=='/' -#ifdef __MINGW32__ +#if defined(_WIN32) || zOrigName[0]=='\\' || (strlen(zOrigName)>3 && zOrigName[1]==':' && (zOrigName[2]=='\\' || zOrigName[2]=='/')) #endif ){ @@ -311,11 +314,11 @@ ** contain no "/./" or "/../" terms. */ int file_is_canonical(const char *z){ int i; if( z[0]!='/' -#ifdef __MINGW32__ +#if defined(_WIN32) && (z[0]==0 || z[1]!=':' || z[2]!='/') #endif ) return 0; for(i=0; z[i]; i++){ Index: src/http_socket.c ================================================================== --- src/http_socket.c +++ src/http_socket.c @@ -26,13 +26,16 @@ ** are handled different on Unix and windows. */ #include "config.h" #include "http_socket.h" -#ifdef __MINGW32__ -# include <windows.h> -# include <winsock2.h> +#if defined(_WIN32) +# include <windows.h> /* for Sleep once server works again */ +# define sleep Sleep /* windows does not have sleep, but Sleep */ +# if defined(__MINGW32__) +# include <ws2tcpip.h> +# endif #else # include <arpa/inet.h> # include <sys/socket.h> # include <netdb.h> # include <netinet/in.h> @@ -45,11 +48,11 @@ ** There can only be a single socket connection open at a time. ** State information about that socket is stored in the following ** local variables: */ static int socketIsInit = 0; /* True after global initialization */ -#ifdef __MINGW32__ +#if defined(_WIN32) static WSADATA socketInfo; /* Windows socket initialize data */ #endif static int iSocket = -1; /* The socket on which we talk to the server */ static char *socketErrMsg = 0; /* Text of most recent socket error */ @@ -84,11 +87,11 @@ ** Call this routine once before any other use of the socket interface. ** This routine does initial configuration of the socket module. */ void socket_global_init(void){ if( socketIsInit==0 ){ -#ifdef __MINGW32__ +#if defined(_WIN32) if( WSAStartup(MAKEWORD(2,0), &socketInfo)!=0 ){ fossil_panic("can't initialize winsock"); } #endif socketIsInit = 1; @@ -99,11 +102,11 @@ ** Call this routine to shutdown the socket module prior to program ** exit. */ void socket_global_shutdown(void){ if( socketIsInit ){ -#ifdef __MINGW32__ +#if defined(_WIN32) WSACleanup(); #endif socket_clear_errmsg(); socketIsInit = 0; } @@ -113,11 +116,11 @@ ** Close the currently open socket. If no socket is open, this routine ** is a no-op. */ void socket_close(void){ if( iSocket>=0 ){ -#ifdef __MINGW32__ +#if defined(_WIN32) closesocket(iSocket); #else close(iSocket); #endif iSocket = -1; @@ -171,11 +174,11 @@ if( connect(iSocket,(struct sockaddr*)&addr,sizeof(addr))<0 ){ socket_set_errmsg("cannot connect to host %s:%d", g.urlName, g.urlPort); socket_close(); return 1; } -#ifndef __MINGW32__ +#if !defined(_WIN32) signal(SIGPIPE, SIG_IGN); #endif return 0; } Index: src/http_ssl.c ================================================================== --- src/http_ssl.c +++ src/http_ssl.c @@ -128,11 +128,11 @@ ** Return the number of errors. */ int ssl_open(void){ X509 *cert; int hasSavedCertificate = 0; - +char *connStr ; ssl_global_init(); /* Get certificate for current server from global config and * (if we have it in config) add it to certificate store. */ @@ -150,11 +150,11 @@ ssl_set_errmsg("SSL: cannot open SSL (%s)", ERR_reason_error_string(ERR_get_error())); return 1; } - char *connStr = mprintf("%s:%d", g.urlName, g.urlPort); + connStr = mprintf("%s:%d", g.urlName, g.urlPort); BIO_set_conn_hostname(iBio, connStr); free(connStr); if( BIO_do_connect(iBio)<=0 ){ ssl_set_errmsg("SSL: cannot connect to host %s:%d (%s)", @@ -178,29 +178,29 @@ return 1; } if( SSL_get_verify_result(ssl) != X509_V_OK ){ char *desc, *prompt; + char *warning = ""; + Blob ans; BIO *mem; mem = BIO_new(BIO_s_mem()); X509_NAME_print_ex(mem, X509_get_subject_name(cert), 2, XN_FLAG_MULTILINE); BIO_puts(mem, "\n\nIssued By:\n\n"); X509_NAME_print_ex(mem, X509_get_issuer_name(cert), 2, XN_FLAG_MULTILINE); BIO_write(mem, "", 1); // null-terminate mem buffer BIO_get_mem_data(mem, &desc); - char *warning = ""; if( hasSavedCertificate ){ warning = "WARNING: Certificate doesn't match the " "saved certificate for this host!"; } prompt = mprintf("\nUnknown SSL certificate:\n\n%s\n\n%s\n" "Accept certificate [a=always/y/N]? ", desc, warning); BIO_free(mem); - Blob ans; prompt_user(prompt, &ans); free(prompt); if( blob_str(&ans)[0]!='y' && blob_str(&ans)[0]!='a' ) { X509_free(cert); ssl_set_errmsg("SSL certificate declined"); Index: src/info.c ================================================================== --- src/info.c +++ src/info.c @@ -142,11 +142,11 @@ /* 012345678901234 */ db_record_repository_filename(0); printf("project-name: %s\n", db_get("project-name", "<unnamed>")); printf("repository: %s\n", db_lget("repository", "")); printf("local-root: %s\n", g.zLocalRoot); -#ifdef __MINGW32__ +#if defined(_WIN32) if( g.zHome ){ printf("user-home: %s\n", g.zHome); } #endif printf("project-code: %s\n", db_get("project-code", "")); Index: src/login.c ================================================================== --- src/login.c +++ src/login.c @@ -37,13 +37,15 @@ ** 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__ +#if defined(_WIN32) # include <windows.h> /* for Sleep */ -# define sleep Sleep /* windows does not have sleep, but Sleep */ +# if defined(_MINGW32__) || defined(_MSC_VER) +# define sleep Sleep /* windows does not have sleep, but Sleep */ +# endif #endif #include <time.h> /* ** Return the name of the login cookie Index: src/main.c ================================================================== --- src/main.c +++ src/main.c @@ -632,11 +632,11 @@ ** ** Assume the user-id and group-id of the repository, or if zRepo ** is a directory, of that directory. */ static char *enter_chroot_jail(char *zRepo){ -#if !defined(__MINGW32__) +#if !defined(_WIN32) if( getuid()==0 ){ int i; struct stat sStat; Blob dir; char *zDir; @@ -810,11 +810,11 @@ }else{ zFile = g.argv[1]; } g.httpOut = stdout; g.httpIn = stdin; -#ifdef __MINGW32__ +#if defined(_WIN32) /* Set binary mode on windows to avoid undesired translations ** between \n and \r\n. */ setmode(_fileno(g.httpOut), _O_BINARY); setmode(_fileno(g.httpIn), _O_BINARY); #endif @@ -953,11 +953,11 @@ g.fullHttpReply = 1; cgi_handle_http_request(0); process_one_web_page(0); } -#ifndef __MINGW32__ +#if !defined(_WIN32) #if !defined(__DARWIN__) && !defined(__APPLE__) /* ** Search for an executable on the PATH environment variable. ** Return true (1) if found and false (0) if not found. */ @@ -1009,11 +1009,11 @@ char *zBrowserCmd = 0; /* Command to launch the web browser */ int isUiCmd; /* True if command is "ui", not "server' */ const char *zNotFound; /* The --notfound option or NULL */ int flags = 0; /* Server flags */ -#ifdef __MINGW32__ +#if defined(_WIN32) const char *zStopperFile; /* Name of file used to terminate server */ zStopperFile = find_option("stopper", 0, 1); #endif g.thTrace = find_option("th-trace", 0, 0)!=0; @@ -1030,11 +1030,11 @@ iPort = mxPort = atoi(zPort); }else{ iPort = db_get_int("http-port", 8080); mxPort = iPort+100; } -#ifndef __MINGW32__ +#if !defined(_WIN32) /* Unix implementation */ if( isUiCmd ){ #if !defined(__DARWIN__) && !defined(__APPLE__) zBrowser = db_get("web-browser", 0); if( zBrowser==0 ){ Index: src/makeheaders.c ================================================================== --- src/makeheaders.c +++ src/makeheaders.c @@ -13,14 +13,17 @@ #include <stdlib.h> #include <ctype.h> #include <memory.h> #include <sys/stat.h> #include <assert.h> -#ifndef WIN32 -# include <unistd.h> -#else +#if defined( __MINGW32__) || defined(__DMC__) || defined(_MSC_VER) +# ifndef WIN32 +# define WIN32 +# endif # include <string.h> +#else +# include <unistd.h> #endif /* ** Macros for debugging. */ Index: src/makemake.tcl ================================================================== --- src/makemake.tcl +++ src/makemake.tcl @@ -81,11 +81,11 @@ } # Name of the final application # set name fossil - +if { 0 == $argc } { puts {# DO NOT EDIT # # This file is automatically generated. Instead of editing this # file, edit "makemake.tcl" then run "tclsh makemake.tcl >main.mk" # to regenerate this file. @@ -205,5 +205,237 @@ puts "\$(OBJDIR)/th.o:\t\$(SRCDIR)/th.c" puts "\t\$(XTCC) -I\$(SRCDIR) -c \$(SRCDIR)/th.c -o \$(OBJDIR)/th.o\n" puts "\$(OBJDIR)/th_lang.o:\t\$(SRCDIR)/th_lang.c" puts "\t\$(XTCC) -I\$(SRCDIR) -c \$(SRCDIR)/th_lang.c -o \$(OBJDIR)/th_lang.o\n" +exit +} +if { "dmc" == [lindex $argv 0] } { + +puts {# DO NOT EDIT +# +# This file is automatically generated. Instead of editing this +# file, edit "makemake.tcl" then run +# "tclsh src/makemake.tcl dmc > win/Makefile.dmc" +# to regenerate this file. +B = .. +SRCDIR = $B\src +OBJDIR = . +O = .obj +E = .exe + + +# Maybe DMDIR, SSL or INCL needs adjustment +DMDIR = c:\DM +INCL = -I. -I$(SRCDIR) -I$B\win\include -I$(DMDIR)\extra\include + +#SSL = -DFOSSIL_ENABLE_SSL=1 +SSL = + +DMCDEF = -Dstrncasecmp=memicmp -Dstrcasecmp=stricmp +I18N = -DFOSSIL_I18N=0 + +CFLAGS = -o +BCC = $(DMDIR)\bin\dmc $(CFLAGS) +TCC = $(DMDIR)\bin\dmc $(CFLAGS) $(DMCDEF) $(I18N) $(SSL) $(INCL) +LIBS = $(DMDIR)\extra\lib\ zlib wsock32 +} +puts -nonewline "SRC = " +foreach s [lsort $src] { + puts -nonewline "${s}_.c " +} +puts "\n" +puts -nonewline "OBJ = " +foreach s [lsort $src] { + puts -nonewline "\$(OBJDIR)\\$s\$O " +} +puts "\$(OBJDIR)\\sqlite3\$O \$(OBJDIR)\\th\$O \$(OBJDIR)\\th_lang\$O " +puts { + +APPNAME = $(OBJDIR)\fossil$(E) + +all: $(APPNAME) + +$(APPNAME) : translate$E mkindex$E headers $(OBJ) $(OBJDIR)\link + cd $(OBJDIR) + $(DMDIR)\bin\link @link + +$(OBJDIR)\link:} +puts -nonewline "\t+echo " +foreach s [lsort $src] { + puts -nonewline "$s " +} +puts "sqlite3 th th_lang > \$@" +puts "\t+echo fossil >> \$@" +puts "\t+echo fossil >> \$@" +puts "\t+echo \$(LIBS) >> \$@\n\n" + +puts { +translate$E: $(SRCDIR)\translate.c + $(BCC) -o$@ $** + +makeheaders$E: $(SRCDIR)\makeheaders.c + $(BCC) -o$@ $** + +mkindex$E: $(SRCDIR)\mkindex.c + $(BCC) -o$@ $** + +version$E: $B\win\version.c + $(BCC) -o$@ $** + +$(OBJDIR)\sqlite3$O : $(SRCDIR)\sqlite3.c + $(TCC) -o$@ -c -DSQLITE_OMIT_LOAD_EXTENSION=1 -DSQLITE_THREADSAFE=0 -DSQLITE_DEFAULT_FILE_FORMAT=4 -Dlocaltime=fossil_localtime -DSQLITE_ENABLE_LOCKING_STYLE=0 $** + +$(OBJDIR)\th$O : $(SRCDIR)\th.c + $(TCC) -o$@ -c $** + +$(OBJDIR)\th_lang$O : $(SRCDIR)\th_lang.c + $(TCC) -o$@ -c $** + +VERSION.h : version$E $B\manifest.uuid $B\manifest + +$** > $@ + +page_index.h: mkindex$E $(SRC) + +$** > $@ + +clean: + -del $(OBJDIR)\*.obj + -del *.obj *_.c *.h *.map + +realclean: + -del $(APPNAME) translate$E mkindex$E makeheaders$E version$E + +} +foreach s [lsort $src] { + puts "\$(OBJDIR)\\$s\$O : ${s}_.c" + puts "\t\$(TCC) -o\$@ -c \$**\n" + puts "${s}_.c : \$(SRCDIR)\\$s.c" + puts "\t+translate\$E \$** > \$@\n" +} + +puts -nonewline "headers: makeheaders\$E page_index.h VERSION.h\n\t +makeheaders\$E " +foreach s [lsort $src] { + puts -nonewline "${s}_.c:$s.h " +} +puts "\$(SRCDIR)\\sqlite3.h \$(SRCDIR)\\th.h VERSION.h" +puts "\t@copy /Y nul: headers" +exit +} + +if { "msc" == [lindex $argv 0] } { + +puts {# DO NOT EDIT +# +# This file is automatically generated. Instead of editing this +# file, edit "makemake.tcl" then run +# "tclsh src/makemake.tcl msc > win/Makefile.msc" +# to regenerate this file. +B = .. +SRCDIR = $B\src +OBJDIR = . +O = .obj +E = .exe + + +# Maybe MSCDIR, SSL or INCL needs adjustment +MSCDIR = c:\msc +INCL = -I. -I$(SRCDIR) -I$B\win\include -I$(MSCDIR)\extra\include + +#SSL = -DFOSSIL_ENABLE_SSL=1 +SSL = + +MSCDEF = -Dstrncasecmp=memicmp -Dstrcasecmp=stricmp +I18N = -DFOSSIL_I18N=0 + +CFLAGS = -nologo -MD -O2 -Oy- -Zi +CFLAGS = -nologo -MT -O2 +BCC = $(CC) $(CFLAGS) +TCC = $(CC) -c $(CFLAGS) $(MSCDEF) $(I18N) $(SSL) $(INCL) +LIBS = zlib.lib ws2_32.lib +##SSL uncoment below +#LIBS = zlib.lib ws2_32.lib ssleay32.lib libeay32.lib user32.lib gdi32.lib advapi32.lib +LIBDIR = -LIBPATH:$(MSCDIR)\extra\lib +} +puts -nonewline "SRC = " +foreach s [lsort $src] { + puts -nonewline "${s}_.c " +} +puts "\n" +puts -nonewline "OBJ = " +foreach s [lsort $src] { + puts -nonewline "\$(OBJDIR)\\$s\$O " +} +puts "\$(OBJDIR)\\sqlite3\$O \$(OBJDIR)\\th\$O \$(OBJDIR)\\th_lang\$O " +puts { + +APPNAME = $(OBJDIR)\fossil$(E) + +all: $(OBJDIR) $(APPNAME) + +$(APPNAME) : translate$E mkindex$E headers $(OBJ) $(OBJDIR)\link + cd $(OBJDIR) + link -LINK -OUT:$@ $(LIBDIR) @link + +$(OBJDIR)\link:} +puts -nonewline "\techo " +foreach s [lsort $src] { + puts -nonewline "$s " +} +puts "sqlite3 th th_lang > \$@" +puts "\techo \$(LIBS) >> \$@\n\n" + +puts { + + +$(OBJDIR): + @-mkdir $@ + +translate$E: $(SRCDIR)\translate.c + $(BCC) $** + +makeheaders$E: $(SRCDIR)\makeheaders.c + $(BCC) $** + +mkindex$E: $(SRCDIR)\mkindex.c + $(BCC) $** + +version$E: $B\win\version.c + $(BCC) $** + +$(OBJDIR)\sqlite3$O : $(SRCDIR)\sqlite3.c + $(TCC) /Fo$@ -c -DSQLITE_OMIT_LOAD_EXTENSION=1 -DSQLITE_THREADSAFE=0 -DSQLITE_DEFAULT_FILE_FORMAT=4 -Dlocaltime=fossil_localtime -DSQLITE_ENABLE_LOCKING_STYLE=0 $** + +$(OBJDIR)\th$O : $(SRCDIR)\th.c + $(TCC) /Fo$@ -c $** + +$(OBJDIR)\th_lang$O : $(SRCDIR)\th_lang.c + $(TCC) /Fo$@ -c $** + +VERSION.h : version$E $B\manifest.uuid $B\manifest + $** > $@ + +page_index.h: mkindex$E $(SRC) + $** > $@ + +clean: + -del $(OBJDIR)\*.obj + -del *.obj *_.c *.h *.map + +realclean: + -del $(APPNAME) translate$E mkindex$E makeheaders$E version$E + +} +foreach s [lsort $src] { + puts "\$(OBJDIR)\\$s\$O : ${s}_.c" + puts "\t\$(TCC) /Fo\$@ -c \$**\n" + puts "${s}_.c : \$(SRCDIR)\\$s.c" + puts "\ttranslate\$E \$** > \$@\n" +} + +puts -nonewline "headers: makeheaders\$E page_index.h VERSION.h\n\tmakeheaders\$E " +foreach s [lsort $src] { + puts -nonewline "${s}_.c:$s.h " +} +puts "\$(SRCDIR)\\sqlite3.h \$(SRCDIR)\\th.h VERSION.h" +puts "\t@copy /Y nul: headers" + +} Index: src/popen.c ================================================================== --- src/popen.c +++ src/popen.c @@ -18,11 +18,13 @@ ** This file contains an implementation of a bi-directional popen(). */ #include "config.h" #include "popen.h" -#ifdef __MINGW32__ +#ifdef _WIN32 +#include <windows.h> +#include <fcntl.h> /* ** Print a fatal error and quit. */ static void win32_fatal_error(const char *zMsg){ fossil_fatal("%s"); @@ -29,11 +31,11 @@ } #endif -#ifdef __MINGW32__ +#ifdef _WIN32 /* ** On windows, create a child process and specify the stdin, stdout, ** and stderr channels for that process to use. ** ** Return the number of errors. @@ -91,11 +93,11 @@ ** The process ID of the child is written into *pChildPid. ** ** Return the number of errors. */ int popen2(const char *zCmd, int *pfdIn, FILE **ppOut, int *pChildPid){ -#ifdef __MINGW32__ +#ifdef _WIN32 HANDLE hStdinRd, hStdinWr, hStdoutRd, hStdoutWr, hStderr; SECURITY_ATTRIBUTES saAttr; DWORD childPid; int fd; @@ -114,12 +116,12 @@ SetHandleInformation( hStdinWr, HANDLE_FLAG_INHERIT, FALSE); win32_create_child_process((char*)zCmd, hStdinRd, hStdoutWr, hStderr,&childPid); *pChildPid = childPid; - *pfdIn = _open_osfhandle(hStdoutRd, 0); - fd = _open_osfhandle(hStdoutWr, 0); + *pfdIn = _open_osfhandle((long)hStdoutRd, 0); + fd = _open_osfhandle((long)hStdoutWr, 0); *ppOut = _fdopen(fd, "w"); CloseHandle(hStdinRd); CloseHandle(hStdoutWr); return 0; #else @@ -171,13 +173,13 @@ /* ** Close the connection to a child process previously created using ** popen2(). Kill off the child process, then close the pipes. */ void pclose2(int fdIn, FILE *pOut, int childPid){ -#ifdef __MINGW32__ +#ifdef _WIN32 /* Not implemented, yet */ #else close(fdIn); fclose(pOut); kill(childPid, SIGINT); #endif } Index: src/rss.c ================================================================== --- src/rss.c +++ src/rss.c @@ -16,13 +16,13 @@ ******************************************************************************* ** ** This file contains code used to create a RSS feed for the CGI interface. */ #include "config.h" +#include <time.h> #include "rss.h" #include <assert.h> -#include <time.h> /* ** WEBPAGE: timeline.rss */ void page_timeline_rss(void){ Index: src/sha1.c ================================================================== --- src/sha1.c +++ src/sha1.c @@ -1,22 +1,24 @@ /* ** This implementation of SHA1 is adapted from the example implementation ** contained in RFC-3174. */ -#include <stdint.h> -#include <sys/types.h> -#include "config.h" -#include "sha1.h" - /* * If you do not have the ISO standard stdint.h header file, then you * must typdef the following: * name meaning - * uint32_t unsigned 32 bit integer - * uint8_t unsigned 8 bit integer (i.e., unsigned char) - * - */ + * */ +#if defined(__DMC__) || defined(_MSC_VER) + typedef unsigned long uint32_t; //unsigned 32 bit integer + typedef unsigned char uint8_t; //unsigned 8 bit integer (i.e., unsigned char) +#else +# include <stdint.h> +#endif +#include <sys/types.h> +#include "config.h" +#include "sha1.h" + #define SHA1HashSize 20 #define shaSuccess 0 #define shaInputTooLong 1 #define shaStateError 2 Index: src/style.c ================================================================== --- src/style.c +++ src/style.c @@ -397,14 +397,13 @@ /* ** WEBPAGE: test_env */ void page_test_env(void){ style_header("Environment Test"); -#if !defined(__MINGW32__) +#if !defined(_WIN32) @ uid=%d(getuid()), gid=%d(getgid())<br> #endif @ g.zBaseURL = %h(g.zBaseURL)<br> @ g.zTop = %h(g.zTop)<br> - @ g.zRepositoryName = %h(g.zRepositoryName)<br> cgi_print_all(); style_footer(); } Index: src/user.c ================================================================== --- src/user.c +++ src/user.c @@ -39,11 +39,11 @@ if( z[i]<' ' ) z[i] = ' '; } blob_append(pBlob, z, -1); } -#ifdef __MINGW32__ +#if defined(_WIN32) /* ** getpass for Windows */ static char *getpass(const char *prompt){ static char pwd[64]; Index: src/vfile.c ================================================================== --- src/vfile.c +++ src/vfile.c @@ -19,11 +19,15 @@ */ #include "config.h" #include "vfile.h" #include <assert.h> #include <sys/types.h> +#if defined(__DMC__) +#include "dirent.h" +#else #include <dirent.h> +#endif /* ** Given a UUID, return the corresponding record ID. If the UUID ** does not exist, then return 0. ** Index: src/winhttp.c ================================================================== --- src/winhttp.c +++ src/winhttp.c @@ -16,12 +16,13 @@ ******************************************************************************* ** ** This file implements a very simple (and low-performance) HTTP server ** for windows. */ -#ifdef __MINGW32__ /* This code is for win32 only */ #include "config.h" +#ifdef _WIN32 +/* This code is for win32 only */ #include "winhttp.h" #include <windows.h> /* ** The HttpRequest structure holds information about each incoming @@ -220,6 +221,6 @@ } closesocket(s); WSACleanup(); } -#endif /* __MINGW32__ -- This code is for win32 only */ +#endif /* _WIN32 -- This code is for win32 only */ ADDED win/Makefile.dmc Index: win/Makefile.dmc ================================================================== --- win/Makefile.dmc +++ win/Makefile.dmc @@ -0,0 +1,513 @@ +# DO NOT EDIT +# +# This file is automatically generated. Instead of editing this +# file, edit "makemake.tcl" then run +# "tclsh src/makemake.tcl dmc > win/Makefile.dmc" +# to regenerate this file. +B = .. +SRCDIR = $B\src +OBJDIR = . +O = .obj +E = .exe + + +# Maybe DMDIR, SSL or INCL needs adjustment +DMDIR = c:\DM +INCL = -I. -I$(SRCDIR) -I$B\win\include -I$(DMDIR)\extra\include + +#SSL = -DFOSSIL_ENABLE_SSL=1 +SSL = + +DMCDEF = -Dstrncasecmp=memicmp -Dstrcasecmp=stricmp +I18N = -DFOSSIL_I18N=0 + +CFLAGS = -o +BCC = $(DMDIR)\bin\dmc $(CFLAGS) +TCC = $(DMDIR)\bin\dmc $(CFLAGS) $(DMCDEF) $(I18N) $(SSL) $(INCL) +LIBS = $(DMDIR)\extra\lib\ zlib wsock32 + +SRC = add_.c allrepo_.c attach_.c bag_.c blob_.c branch_.c browse_.c captcha_.c cgi_.c checkin_.c checkout_.c clearsign_.c clone_.c comformat_.c configure_.c content_.c db_.c delta_.c deltacmd_.c descendants_.c diff_.c diffcmd_.c doc_.c encode_.c file_.c finfo_.c graph_.c http_.c http_socket_.c http_ssl_.c http_transport_.c info_.c login_.c main_.c manifest_.c md5_.c merge_.c merge3_.c name_.c pivot_.c popen_.c pqueue_.c printf_.c rebuild_.c report_.c rss_.c schema_.c search_.c setup_.c sha1_.c shun_.c skins_.c stat_.c style_.c sync_.c tag_.c th_main_.c timeline_.c tkt_.c tktsetup_.c undo_.c update_.c url_.c user_.c verify_.c vfile_.c wiki_.c wikiformat_.c winhttp_.c xfer_.c zip_.c + +OBJ = $(OBJDIR)\add$O $(OBJDIR)\allrepo$O $(OBJDIR)\attach$O $(OBJDIR)\bag$O $(OBJDIR)\blob$O $(OBJDIR)\branch$O $(OBJDIR)\browse$O $(OBJDIR)\captcha$O $(OBJDIR)\cgi$O $(OBJDIR)\checkin$O $(OBJDIR)\checkout$O $(OBJDIR)\clearsign$O $(OBJDIR)\clone$O $(OBJDIR)\comformat$O $(OBJDIR)\configure$O $(OBJDIR)\content$O $(OBJDIR)\db$O $(OBJDIR)\delta$O $(OBJDIR)\deltacmd$O $(OBJDIR)\descendants$O $(OBJDIR)\diff$O $(OBJDIR)\diffcmd$O $(OBJDIR)\doc$O $(OBJDIR)\encode$O $(OBJDIR)\file$O $(OBJDIR)\finfo$O $(OBJDIR)\graph$O $(OBJDIR)\http$O $(OBJDIR)\http_socket$O $(OBJDIR)\http_ssl$O $(OBJDIR)\http_transport$O $(OBJDIR)\info$O $(OBJDIR)\login$O $(OBJDIR)\main$O $(OBJDIR)\manifest$O $(OBJDIR)\md5$O $(OBJDIR)\merge$O $(OBJDIR)\merge3$O $(OBJDIR)\name$O $(OBJDIR)\pivot$O $(OBJDIR)\popen$O $(OBJDIR)\pqueue$O $(OBJDIR)\printf$O $(OBJDIR)\rebuild$O $(OBJDIR)\report$O $(OBJDIR)\rss$O $(OBJDIR)\schema$O $(OBJDIR)\search$O $(OBJDIR)\setup$O $(OBJDIR)\sha1$O $(OBJDIR)\shun$O $(OBJDIR)\skins$O $(OBJDIR)\stat$O $(OBJDIR)\style$O $(OBJDIR)\sync$O $(OBJDIR)\tag$O $(OBJDIR)\th_main$O $(OBJDIR)\timeline$O $(OBJDIR)\tkt$O $(OBJDIR)\tktsetup$O $(OBJDIR)\undo$O $(OBJDIR)\update$O $(OBJDIR)\url$O $(OBJDIR)\user$O $(OBJDIR)\verify$O $(OBJDIR)\vfile$O $(OBJDIR)\wiki$O $(OBJDIR)\wikiformat$O $(OBJDIR)\winhttp$O $(OBJDIR)\xfer$O $(OBJDIR)\zip$O $(OBJDIR)\sqlite3$O $(OBJDIR)\th$O $(OBJDIR)\th_lang$O + + +APPNAME = $(OBJDIR)\fossil$(E) + +all: $(APPNAME) + +$(APPNAME) : translate$E mkindex$E headers $(OBJ) $(OBJDIR)\link + cd $(OBJDIR) + $(DMDIR)\bin\link @link + +$(OBJDIR)\link: + +echo add allrepo attach bag blob branch browse captcha cgi checkin checkout clearsign clone comformat configure content db delta deltacmd descendants diff diffcmd doc encode file finfo graph http http_socket http_ssl http_transport info login main manifest md5 merge merge3 name pivot popen pqueue printf rebuild report rss schema search setup sha1 shun skins stat style sync tag th_main timeline tkt tktsetup undo update url user verify vfile wiki wikiformat winhttp xfer zip sqlite3 th th_lang > $@ + +echo fossil >> $@ + +echo fossil >> $@ + +echo $(LIBS) >> $@ + + + +translate$E: $(SRCDIR)\translate.c + $(BCC) -o$@ $** + +makeheaders$E: $(SRCDIR)\makeheaders.c + $(BCC) -o$@ $** + +mkindex$E: $(SRCDIR)\mkindex.c + $(BCC) -o$@ $** + +version$E: $B\win\version.c + $(BCC) -o$@ $** + +$(OBJDIR)\sqlite3$O : $(SRCDIR)\sqlite3.c + $(TCC) -o$@ -c -DSQLITE_OMIT_LOAD_EXTENSION=1 -DSQLITE_THREADSAFE=0 -DSQLITE_DEFAULT_FILE_FORMAT=4 -Dlocaltime=fossil_localtime -DSQLITE_ENABLE_LOCKING_STYLE=0 $** + +$(OBJDIR)\th$O : $(SRCDIR)\th.c + $(TCC) -o$@ -c $** + +$(OBJDIR)\th_lang$O : $(SRCDIR)\th_lang.c + $(TCC) -o$@ -c $** + +VERSION.h : version$E $B\manifest.uuid $B\manifest + +$** > $@ + +page_index.h: mkindex$E $(SRC) + +$** > $@ + +clean: + -del $(OBJDIR)\*.obj + -del *.obj *_.c *.h *.map + +realclean: + -del $(APPNAME) translate$E mkindex$E makeheaders$E version$E + + +$(OBJDIR)\add$O : add_.c + $(TCC) -o$@ -c $** + +add_.c : $(SRCDIR)\add.c + +translate$E $** > $@ + +$(OBJDIR)\allrepo$O : allrepo_.c + $(TCC) -o$@ -c $** + +allrepo_.c : $(SRCDIR)\allrepo.c + +translate$E $** > $@ + +$(OBJDIR)\attach$O : attach_.c + $(TCC) -o$@ -c $** + +attach_.c : $(SRCDIR)\attach.c + +translate$E $** > $@ + +$(OBJDIR)\bag$O : bag_.c + $(TCC) -o$@ -c $** + +bag_.c : $(SRCDIR)\bag.c + +translate$E $** > $@ + +$(OBJDIR)\blob$O : blob_.c + $(TCC) -o$@ -c $** + +blob_.c : $(SRCDIR)\blob.c + +translate$E $** > $@ + +$(OBJDIR)\branch$O : branch_.c + $(TCC) -o$@ -c $** + +branch_.c : $(SRCDIR)\branch.c + +translate$E $** > $@ + +$(OBJDIR)\browse$O : browse_.c + $(TCC) -o$@ -c $** + +browse_.c : $(SRCDIR)\browse.c + +translate$E $** > $@ + +$(OBJDIR)\captcha$O : captcha_.c + $(TCC) -o$@ -c $** + +captcha_.c : $(SRCDIR)\captcha.c + +translate$E $** > $@ + +$(OBJDIR)\cgi$O : cgi_.c + $(TCC) -o$@ -c $** + +cgi_.c : $(SRCDIR)\cgi.c + +translate$E $** > $@ + +$(OBJDIR)\checkin$O : checkin_.c + $(TCC) -o$@ -c $** + +checkin_.c : $(SRCDIR)\checkin.c + +translate$E $** > $@ + +$(OBJDIR)\checkout$O : checkout_.c + $(TCC) -o$@ -c $** + +checkout_.c : $(SRCDIR)\checkout.c + +translate$E $** > $@ + +$(OBJDIR)\clearsign$O : clearsign_.c + $(TCC) -o$@ -c $** + +clearsign_.c : $(SRCDIR)\clearsign.c + +translate$E $** > $@ + +$(OBJDIR)\clone$O : clone_.c + $(TCC) -o$@ -c $** + +clone_.c : $(SRCDIR)\clone.c + +translate$E $** > $@ + +$(OBJDIR)\comformat$O : comformat_.c + $(TCC) -o$@ -c $** + +comformat_.c : $(SRCDIR)\comformat.c + +translate$E $** > $@ + +$(OBJDIR)\configure$O : configure_.c + $(TCC) -o$@ -c $** + +configure_.c : $(SRCDIR)\configure.c + +translate$E $** > $@ + +$(OBJDIR)\content$O : content_.c + $(TCC) -o$@ -c $** + +content_.c : $(SRCDIR)\content.c + +translate$E $** > $@ + +$(OBJDIR)\db$O : db_.c + $(TCC) -o$@ -c $** + +db_.c : $(SRCDIR)\db.c + +translate$E $** > $@ + +$(OBJDIR)\delta$O : delta_.c + $(TCC) -o$@ -c $** + +delta_.c : $(SRCDIR)\delta.c + +translate$E $** > $@ + +$(OBJDIR)\deltacmd$O : deltacmd_.c + $(TCC) -o$@ -c $** + +deltacmd_.c : $(SRCDIR)\deltacmd.c + +translate$E $** > $@ + +$(OBJDIR)\descendants$O : descendants_.c + $(TCC) -o$@ -c $** + +descendants_.c : $(SRCDIR)\descendants.c + +translate$E $** > $@ + +$(OBJDIR)\diff$O : diff_.c + $(TCC) -o$@ -c $** + +diff_.c : $(SRCDIR)\diff.c + +translate$E $** > $@ + +$(OBJDIR)\diffcmd$O : diffcmd_.c + $(TCC) -o$@ -c $** + +diffcmd_.c : $(SRCDIR)\diffcmd.c + +translate$E $** > $@ + +$(OBJDIR)\doc$O : doc_.c + $(TCC) -o$@ -c $** + +doc_.c : $(SRCDIR)\doc.c + +translate$E $** > $@ + +$(OBJDIR)\encode$O : encode_.c + $(TCC) -o$@ -c $** + +encode_.c : $(SRCDIR)\encode.c + +translate$E $** > $@ + +$(OBJDIR)\file$O : file_.c + $(TCC) -o$@ -c $** + +file_.c : $(SRCDIR)\file.c + +translate$E $** > $@ + +$(OBJDIR)\finfo$O : finfo_.c + $(TCC) -o$@ -c $** + +finfo_.c : $(SRCDIR)\finfo.c + +translate$E $** > $@ + +$(OBJDIR)\graph$O : graph_.c + $(TCC) -o$@ -c $** + +graph_.c : $(SRCDIR)\graph.c + +translate$E $** > $@ + +$(OBJDIR)\http$O : http_.c + $(TCC) -o$@ -c $** + +http_.c : $(SRCDIR)\http.c + +translate$E $** > $@ + +$(OBJDIR)\http_socket$O : http_socket_.c + $(TCC) -o$@ -c $** + +http_socket_.c : $(SRCDIR)\http_socket.c + +translate$E $** > $@ + +$(OBJDIR)\http_ssl$O : http_ssl_.c + $(TCC) -o$@ -c $** + +http_ssl_.c : $(SRCDIR)\http_ssl.c + +translate$E $** > $@ + +$(OBJDIR)\http_transport$O : http_transport_.c + $(TCC) -o$@ -c $** + +http_transport_.c : $(SRCDIR)\http_transport.c + +translate$E $** > $@ + +$(OBJDIR)\info$O : info_.c + $(TCC) -o$@ -c $** + +info_.c : $(SRCDIR)\info.c + +translate$E $** > $@ + +$(OBJDIR)\login$O : login_.c + $(TCC) -o$@ -c $** + +login_.c : $(SRCDIR)\login.c + +translate$E $** > $@ + +$(OBJDIR)\main$O : main_.c + $(TCC) -o$@ -c $** + +main_.c : $(SRCDIR)\main.c + +translate$E $** > $@ + +$(OBJDIR)\manifest$O : manifest_.c + $(TCC) -o$@ -c $** + +manifest_.c : $(SRCDIR)\manifest.c + +translate$E $** > $@ + +$(OBJDIR)\md5$O : md5_.c + $(TCC) -o$@ -c $** + +md5_.c : $(SRCDIR)\md5.c + +translate$E $** > $@ + +$(OBJDIR)\merge$O : merge_.c + $(TCC) -o$@ -c $** + +merge_.c : $(SRCDIR)\merge.c + +translate$E $** > $@ + +$(OBJDIR)\merge3$O : merge3_.c + $(TCC) -o$@ -c $** + +merge3_.c : $(SRCDIR)\merge3.c + +translate$E $** > $@ + +$(OBJDIR)\name$O : name_.c + $(TCC) -o$@ -c $** + +name_.c : $(SRCDIR)\name.c + +translate$E $** > $@ + +$(OBJDIR)\pivot$O : pivot_.c + $(TCC) -o$@ -c $** + +pivot_.c : $(SRCDIR)\pivot.c + +translate$E $** > $@ + +$(OBJDIR)\popen$O : popen_.c + $(TCC) -o$@ -c $** + +popen_.c : $(SRCDIR)\popen.c + +translate$E $** > $@ + +$(OBJDIR)\pqueue$O : pqueue_.c + $(TCC) -o$@ -c $** + +pqueue_.c : $(SRCDIR)\pqueue.c + +translate$E $** > $@ + +$(OBJDIR)\printf$O : printf_.c + $(TCC) -o$@ -c $** + +printf_.c : $(SRCDIR)\printf.c + +translate$E $** > $@ + +$(OBJDIR)\rebuild$O : rebuild_.c + $(TCC) -o$@ -c $** + +rebuild_.c : $(SRCDIR)\rebuild.c + +translate$E $** > $@ + +$(OBJDIR)\report$O : report_.c + $(TCC) -o$@ -c $** + +report_.c : $(SRCDIR)\report.c + +translate$E $** > $@ + +$(OBJDIR)\rss$O : rss_.c + $(TCC) -o$@ -c $** + +rss_.c : $(SRCDIR)\rss.c + +translate$E $** > $@ + +$(OBJDIR)\schema$O : schema_.c + $(TCC) -o$@ -c $** + +schema_.c : $(SRCDIR)\schema.c + +translate$E $** > $@ + +$(OBJDIR)\search$O : search_.c + $(TCC) -o$@ -c $** + +search_.c : $(SRCDIR)\search.c + +translate$E $** > $@ + +$(OBJDIR)\setup$O : setup_.c + $(TCC) -o$@ -c $** + +setup_.c : $(SRCDIR)\setup.c + +translate$E $** > $@ + +$(OBJDIR)\sha1$O : sha1_.c + $(TCC) -o$@ -c $** + +sha1_.c : $(SRCDIR)\sha1.c + +translate$E $** > $@ + +$(OBJDIR)\shun$O : shun_.c + $(TCC) -o$@ -c $** + +shun_.c : $(SRCDIR)\shun.c + +translate$E $** > $@ + +$(OBJDIR)\skins$O : skins_.c + $(TCC) -o$@ -c $** + +skins_.c : $(SRCDIR)\skins.c + +translate$E $** > $@ + +$(OBJDIR)\stat$O : stat_.c + $(TCC) -o$@ -c $** + +stat_.c : $(SRCDIR)\stat.c + +translate$E $** > $@ + +$(OBJDIR)\style$O : style_.c + $(TCC) -o$@ -c $** + +style_.c : $(SRCDIR)\style.c + +translate$E $** > $@ + +$(OBJDIR)\sync$O : sync_.c + $(TCC) -o$@ -c $** + +sync_.c : $(SRCDIR)\sync.c + +translate$E $** > $@ + +$(OBJDIR)\tag$O : tag_.c + $(TCC) -o$@ -c $** + +tag_.c : $(SRCDIR)\tag.c + +translate$E $** > $@ + +$(OBJDIR)\th_main$O : th_main_.c + $(TCC) -o$@ -c $** + +th_main_.c : $(SRCDIR)\th_main.c + +translate$E $** > $@ + +$(OBJDIR)\timeline$O : timeline_.c + $(TCC) -o$@ -c $** + +timeline_.c : $(SRCDIR)\timeline.c + +translate$E $** > $@ + +$(OBJDIR)\tkt$O : tkt_.c + $(TCC) -o$@ -c $** + +tkt_.c : $(SRCDIR)\tkt.c + +translate$E $** > $@ + +$(OBJDIR)\tktsetup$O : tktsetup_.c + $(TCC) -o$@ -c $** + +tktsetup_.c : $(SRCDIR)\tktsetup.c + +translate$E $** > $@ + +$(OBJDIR)\undo$O : undo_.c + $(TCC) -o$@ -c $** + +undo_.c : $(SRCDIR)\undo.c + +translate$E $** > $@ + +$(OBJDIR)\update$O : update_.c + $(TCC) -o$@ -c $** + +update_.c : $(SRCDIR)\update.c + +translate$E $** > $@ + +$(OBJDIR)\url$O : url_.c + $(TCC) -o$@ -c $** + +url_.c : $(SRCDIR)\url.c + +translate$E $** > $@ + +$(OBJDIR)\user$O : user_.c + $(TCC) -o$@ -c $** + +user_.c : $(SRCDIR)\user.c + +translate$E $** > $@ + +$(OBJDIR)\verify$O : verify_.c + $(TCC) -o$@ -c $** + +verify_.c : $(SRCDIR)\verify.c + +translate$E $** > $@ + +$(OBJDIR)\vfile$O : vfile_.c + $(TCC) -o$@ -c $** + +vfile_.c : $(SRCDIR)\vfile.c + +translate$E $** > $@ + +$(OBJDIR)\wiki$O : wiki_.c + $(TCC) -o$@ -c $** + +wiki_.c : $(SRCDIR)\wiki.c + +translate$E $** > $@ + +$(OBJDIR)\wikiformat$O : wikiformat_.c + $(TCC) -o$@ -c $** + +wikiformat_.c : $(SRCDIR)\wikiformat.c + +translate$E $** > $@ + +$(OBJDIR)\winhttp$O : winhttp_.c + $(TCC) -o$@ -c $** + +winhttp_.c : $(SRCDIR)\winhttp.c + +translate$E $** > $@ + +$(OBJDIR)\xfer$O : xfer_.c + $(TCC) -o$@ -c $** + +xfer_.c : $(SRCDIR)\xfer.c + +translate$E $** > $@ + +$(OBJDIR)\zip$O : zip_.c + $(TCC) -o$@ -c $** + +zip_.c : $(SRCDIR)\zip.c + +translate$E $** > $@ + +headers: makeheaders$E page_index.h VERSION.h + +makeheaders$E add_.c:add.h allrepo_.c:allrepo.h attach_.c:attach.h bag_.c:bag.h blob_.c:blob.h branch_.c:branch.h browse_.c:browse.h captcha_.c:captcha.h cgi_.c:cgi.h checkin_.c:checkin.h checkout_.c:checkout.h clearsign_.c:clearsign.h clone_.c:clone.h comformat_.c:comformat.h configure_.c:configure.h content_.c:content.h db_.c:db.h delta_.c:delta.h deltacmd_.c:deltacmd.h descendants_.c:descendants.h diff_.c:diff.h diffcmd_.c:diffcmd.h doc_.c:doc.h encode_.c:encode.h file_.c:file.h finfo_.c:finfo.h graph_.c:graph.h http_.c:http.h http_socket_.c:http_socket.h http_ssl_.c:http_ssl.h http_transport_.c:http_transport.h info_.c:info.h login_.c:login.h main_.c:main.h manifest_.c:manifest.h md5_.c:md5.h merge_.c:merge.h merge3_.c:merge3.h name_.c:name.h pivot_.c:pivot.h popen_.c:popen.h pqueue_.c:pqueue.h printf_.c:printf.h rebuild_.c:rebuild.h report_.c:report.h rss_.c:rss.h schema_.c:schema.h search_.c:search.h setup_.c:setup.h sha1_.c:sha1.h shun_.c:shun.h skins_.c:skins.h stat_.c:stat.h style_.c:style.h sync_.c:sync.h tag_.c:tag.h th_main_.c:th_main.h timeline_.c:timeline.h tkt_.c:tkt.h tktsetup_.c:tktsetup.h undo_.c:undo.h update_.c:update.h url_.c:url.h user_.c:user.h verify_.c:verify.h vfile_.c:vfile.h wiki_.c:wiki.h wikiformat_.c:wikiformat.h winhttp_.c:winhttp.h xfer_.c:xfer.h zip_.c:zip.h $(SRCDIR)\sqlite3.h $(SRCDIR)\th.h VERSION.h + @copy /Y nul: headers ADDED win/Makefile.msc Index: win/Makefile.msc ================================================================== --- win/Makefile.msc +++ win/Makefile.msc @@ -0,0 +1,520 @@ +# DO NOT EDIT +# +# This file is automatically generated. Instead of editing this +# file, edit "makemake.tcl" then run +# "tclsh src/makemake.tcl msc > win/Makefile.msc" +# to regenerate this file. +B = .. +SRCDIR = $B\src +OBJDIR = . +O = .obj +E = .exe + + +# Maybe MSCDIR, SSL or INCL needs adjustment +MSCDIR = c:\msc +INCL = -I. -I$(SRCDIR) -I$B\win\include -I$(MSCDIR)\extra\include + +#SSL = -DFOSSIL_ENABLE_SSL=1 +SSL = + +MSCDEF = -Dstrncasecmp=memicmp -Dstrcasecmp=stricmp +I18N = -DFOSSIL_I18N=0 + +CFLAGS = -nologo -MD -O2 -Oy- -Zi +CFLAGS = -nologo -MT -O2 +BCC = $(CC) $(CFLAGS) +TCC = $(CC) -c $(CFLAGS) $(MSCDEF) $(I18N) $(SSL) $(INCL) +LIBS = zlib.lib ws2_32.lib +##SSL uncoment below +#LIBS = zlib.lib ws2_32.lib ssleay32.lib libeay32.lib user32.lib gdi32.lib advapi32.lib +LIBDIR = -LIBPATH:$(MSCDIR)\extra\lib + +SRC = add_.c allrepo_.c attach_.c bag_.c blob_.c branch_.c browse_.c captcha_.c cgi_.c checkin_.c checkout_.c clearsign_.c clone_.c comformat_.c configure_.c content_.c db_.c delta_.c deltacmd_.c descendants_.c diff_.c diffcmd_.c doc_.c encode_.c file_.c finfo_.c graph_.c http_.c http_socket_.c http_ssl_.c http_transport_.c info_.c login_.c main_.c manifest_.c md5_.c merge_.c merge3_.c name_.c pivot_.c popen_.c pqueue_.c printf_.c rebuild_.c report_.c rss_.c schema_.c search_.c setup_.c sha1_.c shun_.c skins_.c stat_.c style_.c sync_.c tag_.c th_main_.c timeline_.c tkt_.c tktsetup_.c undo_.c update_.c url_.c user_.c verify_.c vfile_.c wiki_.c wikiformat_.c winhttp_.c xfer_.c zip_.c + +OBJ = $(OBJDIR)\add$O $(OBJDIR)\allrepo$O $(OBJDIR)\attach$O $(OBJDIR)\bag$O $(OBJDIR)\blob$O $(OBJDIR)\branch$O $(OBJDIR)\browse$O $(OBJDIR)\captcha$O $(OBJDIR)\cgi$O $(OBJDIR)\checkin$O $(OBJDIR)\checkout$O $(OBJDIR)\clearsign$O $(OBJDIR)\clone$O $(OBJDIR)\comformat$O $(OBJDIR)\configure$O $(OBJDIR)\content$O $(OBJDIR)\db$O $(OBJDIR)\delta$O $(OBJDIR)\deltacmd$O $(OBJDIR)\descendants$O $(OBJDIR)\diff$O $(OBJDIR)\diffcmd$O $(OBJDIR)\doc$O $(OBJDIR)\encode$O $(OBJDIR)\file$O $(OBJDIR)\finfo$O $(OBJDIR)\graph$O $(OBJDIR)\http$O $(OBJDIR)\http_socket$O $(OBJDIR)\http_ssl$O $(OBJDIR)\http_transport$O $(OBJDIR)\info$O $(OBJDIR)\login$O $(OBJDIR)\main$O $(OBJDIR)\manifest$O $(OBJDIR)\md5$O $(OBJDIR)\merge$O $(OBJDIR)\merge3$O $(OBJDIR)\name$O $(OBJDIR)\pivot$O $(OBJDIR)\popen$O $(OBJDIR)\pqueue$O $(OBJDIR)\printf$O $(OBJDIR)\rebuild$O $(OBJDIR)\report$O $(OBJDIR)\rss$O $(OBJDIR)\schema$O $(OBJDIR)\search$O $(OBJDIR)\setup$O $(OBJDIR)\sha1$O $(OBJDIR)\shun$O $(OBJDIR)\skins$O $(OBJDIR)\stat$O $(OBJDIR)\style$O $(OBJDIR)\sync$O $(OBJDIR)\tag$O $(OBJDIR)\th_main$O $(OBJDIR)\timeline$O $(OBJDIR)\tkt$O $(OBJDIR)\tktsetup$O $(OBJDIR)\undo$O $(OBJDIR)\update$O $(OBJDIR)\url$O $(OBJDIR)\user$O $(OBJDIR)\verify$O $(OBJDIR)\vfile$O $(OBJDIR)\wiki$O $(OBJDIR)\wikiformat$O $(OBJDIR)\winhttp$O $(OBJDIR)\xfer$O $(OBJDIR)\zip$O $(OBJDIR)\sqlite3$O $(OBJDIR)\th$O $(OBJDIR)\th_lang$O + + +APPNAME = $(OBJDIR)\fossil$(E) + +all: $(OBJDIR) $(APPNAME) + +$(APPNAME) : translate$E mkindex$E headers $(OBJ) $(OBJDIR)\link + cd $(OBJDIR) + link -LINK -OUT:$@ $(LIBDIR) @link + +$(OBJDIR)\link: + echo add allrepo attach bag blob branch browse captcha cgi checkin checkout clearsign clone comformat configure content db delta deltacmd descendants diff diffcmd doc encode file finfo graph http http_socket http_ssl http_transport info login main manifest md5 merge merge3 name pivot popen pqueue printf rebuild report rss schema search setup sha1 shun skins stat style sync tag th_main timeline tkt tktsetup undo update url user verify vfile wiki wikiformat winhttp xfer zip sqlite3 th th_lang > $@ + echo $(LIBS) >> $@ + + + + + +$(OBJDIR): + @-mkdir $@ + +translate$E: $(SRCDIR)\translate.c + $(BCC) $** + +makeheaders$E: $(SRCDIR)\makeheaders.c + $(BCC) $** + +mkindex$E: $(SRCDIR)\mkindex.c + $(BCC) $** + +version$E: $B\win\version.c + $(BCC) $** + +$(OBJDIR)\sqlite3$O : $(SRCDIR)\sqlite3.c + $(TCC) /Fo$@ -c -DSQLITE_OMIT_LOAD_EXTENSION=1 -DSQLITE_THREADSAFE=0 -DSQLITE_DEFAULT_FILE_FORMAT=4 -Dlocaltime=fossil_localtime -DSQLITE_ENABLE_LOCKING_STYLE=0 $** + +$(OBJDIR)\th$O : $(SRCDIR)\th.c + $(TCC) /Fo$@ -c $** + +$(OBJDIR)\th_lang$O : $(SRCDIR)\th_lang.c + $(TCC) /Fo$@ -c $** + +VERSION.h : version$E $B\manifest.uuid $B\manifest + $** > $@ + +page_index.h: mkindex$E $(SRC) + $** > $@ + +clean: + -del $(OBJDIR)\*.obj + -del *.obj *_.c *.h *.map + +realclean: + -del $(APPNAME) translate$E mkindex$E makeheaders$E version$E + + +$(OBJDIR)\add$O : add_.c + $(TCC) /Fo$@ -c $** + +add_.c : $(SRCDIR)\add.c + translate$E $** > $@ + +$(OBJDIR)\allrepo$O : allrepo_.c + $(TCC) /Fo$@ -c $** + +allrepo_.c : $(SRCDIR)\allrepo.c + translate$E $** > $@ + +$(OBJDIR)\attach$O : attach_.c + $(TCC) /Fo$@ -c $** + +attach_.c : $(SRCDIR)\attach.c + translate$E $** > $@ + +$(OBJDIR)\bag$O : bag_.c + $(TCC) /Fo$@ -c $** + +bag_.c : $(SRCDIR)\bag.c + translate$E $** > $@ + +$(OBJDIR)\blob$O : blob_.c + $(TCC) /Fo$@ -c $** + +blob_.c : $(SRCDIR)\blob.c + translate$E $** > $@ + +$(OBJDIR)\branch$O : branch_.c + $(TCC) /Fo$@ -c $** + +branch_.c : $(SRCDIR)\branch.c + translate$E $** > $@ + +$(OBJDIR)\browse$O : browse_.c + $(TCC) /Fo$@ -c $** + +browse_.c : $(SRCDIR)\browse.c + translate$E $** > $@ + +$(OBJDIR)\captcha$O : captcha_.c + $(TCC) /Fo$@ -c $** + +captcha_.c : $(SRCDIR)\captcha.c + translate$E $** > $@ + +$(OBJDIR)\cgi$O : cgi_.c + $(TCC) /Fo$@ -c $** + +cgi_.c : $(SRCDIR)\cgi.c + translate$E $** > $@ + +$(OBJDIR)\checkin$O : checkin_.c + $(TCC) /Fo$@ -c $** + +checkin_.c : $(SRCDIR)\checkin.c + translate$E $** > $@ + +$(OBJDIR)\checkout$O : checkout_.c + $(TCC) /Fo$@ -c $** + +checkout_.c : $(SRCDIR)\checkout.c + translate$E $** > $@ + +$(OBJDIR)\clearsign$O : clearsign_.c + $(TCC) /Fo$@ -c $** + +clearsign_.c : $(SRCDIR)\clearsign.c + translate$E $** > $@ + +$(OBJDIR)\clone$O : clone_.c + $(TCC) /Fo$@ -c $** + +clone_.c : $(SRCDIR)\clone.c + translate$E $** > $@ + +$(OBJDIR)\comformat$O : comformat_.c + $(TCC) /Fo$@ -c $** + +comformat_.c : $(SRCDIR)\comformat.c + translate$E $** > $@ + +$(OBJDIR)\configure$O : configure_.c + $(TCC) /Fo$@ -c $** + +configure_.c : $(SRCDIR)\configure.c + translate$E $** > $@ + +$(OBJDIR)\content$O : content_.c + $(TCC) /Fo$@ -c $** + +content_.c : $(SRCDIR)\content.c + translate$E $** > $@ + +$(OBJDIR)\db$O : db_.c + $(TCC) /Fo$@ -c $** + +db_.c : $(SRCDIR)\db.c + translate$E $** > $@ + +$(OBJDIR)\delta$O : delta_.c + $(TCC) /Fo$@ -c $** + +delta_.c : $(SRCDIR)\delta.c + translate$E $** > $@ + +$(OBJDIR)\deltacmd$O : deltacmd_.c + $(TCC) /Fo$@ -c $** + +deltacmd_.c : $(SRCDIR)\deltacmd.c + translate$E $** > $@ + +$(OBJDIR)\descendants$O : descendants_.c + $(TCC) /Fo$@ -c $** + +descendants_.c : $(SRCDIR)\descendants.c + translate$E $** > $@ + +$(OBJDIR)\diff$O : diff_.c + $(TCC) /Fo$@ -c $** + +diff_.c : $(SRCDIR)\diff.c + translate$E $** > $@ + +$(OBJDIR)\diffcmd$O : diffcmd_.c + $(TCC) /Fo$@ -c $** + +diffcmd_.c : $(SRCDIR)\diffcmd.c + translate$E $** > $@ + +$(OBJDIR)\doc$O : doc_.c + $(TCC) /Fo$@ -c $** + +doc_.c : $(SRCDIR)\doc.c + translate$E $** > $@ + +$(OBJDIR)\encode$O : encode_.c + $(TCC) /Fo$@ -c $** + +encode_.c : $(SRCDIR)\encode.c + translate$E $** > $@ + +$(OBJDIR)\file$O : file_.c + $(TCC) /Fo$@ -c $** + +file_.c : $(SRCDIR)\file.c + translate$E $** > $@ + +$(OBJDIR)\finfo$O : finfo_.c + $(TCC) /Fo$@ -c $** + +finfo_.c : $(SRCDIR)\finfo.c + translate$E $** > $@ + +$(OBJDIR)\graph$O : graph_.c + $(TCC) /Fo$@ -c $** + +graph_.c : $(SRCDIR)\graph.c + translate$E $** > $@ + +$(OBJDIR)\http$O : http_.c + $(TCC) /Fo$@ -c $** + +http_.c : $(SRCDIR)\http.c + translate$E $** > $@ + +$(OBJDIR)\http_socket$O : http_socket_.c + $(TCC) /Fo$@ -c $** + +http_socket_.c : $(SRCDIR)\http_socket.c + translate$E $** > $@ + +$(OBJDIR)\http_ssl$O : http_ssl_.c + $(TCC) /Fo$@ -c $** + +http_ssl_.c : $(SRCDIR)\http_ssl.c + translate$E $** > $@ + +$(OBJDIR)\http_transport$O : http_transport_.c + $(TCC) /Fo$@ -c $** + +http_transport_.c : $(SRCDIR)\http_transport.c + translate$E $** > $@ + +$(OBJDIR)\info$O : info_.c + $(TCC) /Fo$@ -c $** + +info_.c : $(SRCDIR)\info.c + translate$E $** > $@ + +$(OBJDIR)\login$O : login_.c + $(TCC) /Fo$@ -c $** + +login_.c : $(SRCDIR)\login.c + translate$E $** > $@ + +$(OBJDIR)\main$O : main_.c + $(TCC) /Fo$@ -c $** + +main_.c : $(SRCDIR)\main.c + translate$E $** > $@ + +$(OBJDIR)\manifest$O : manifest_.c + $(TCC) /Fo$@ -c $** + +manifest_.c : $(SRCDIR)\manifest.c + translate$E $** > $@ + +$(OBJDIR)\md5$O : md5_.c + $(TCC) /Fo$@ -c $** + +md5_.c : $(SRCDIR)\md5.c + translate$E $** > $@ + +$(OBJDIR)\merge$O : merge_.c + $(TCC) /Fo$@ -c $** + +merge_.c : $(SRCDIR)\merge.c + translate$E $** > $@ + +$(OBJDIR)\merge3$O : merge3_.c + $(TCC) /Fo$@ -c $** + +merge3_.c : $(SRCDIR)\merge3.c + translate$E $** > $@ + +$(OBJDIR)\name$O : name_.c + $(TCC) /Fo$@ -c $** + +name_.c : $(SRCDIR)\name.c + translate$E $** > $@ + +$(OBJDIR)\pivot$O : pivot_.c + $(TCC) /Fo$@ -c $** + +pivot_.c : $(SRCDIR)\pivot.c + translate$E $** > $@ + +$(OBJDIR)\popen$O : popen_.c + $(TCC) /Fo$@ -c $** + +popen_.c : $(SRCDIR)\popen.c + translate$E $** > $@ + +$(OBJDIR)\pqueue$O : pqueue_.c + $(TCC) /Fo$@ -c $** + +pqueue_.c : $(SRCDIR)\pqueue.c + translate$E $** > $@ + +$(OBJDIR)\printf$O : printf_.c + $(TCC) /Fo$@ -c $** + +printf_.c : $(SRCDIR)\printf.c + translate$E $** > $@ + +$(OBJDIR)\rebuild$O : rebuild_.c + $(TCC) /Fo$@ -c $** + +rebuild_.c : $(SRCDIR)\rebuild.c + translate$E $** > $@ + +$(OBJDIR)\report$O : report_.c + $(TCC) /Fo$@ -c $** + +report_.c : $(SRCDIR)\report.c + translate$E $** > $@ + +$(OBJDIR)\rss$O : rss_.c + $(TCC) /Fo$@ -c $** + +rss_.c : $(SRCDIR)\rss.c + translate$E $** > $@ + +$(OBJDIR)\schema$O : schema_.c + $(TCC) /Fo$@ -c $** + +schema_.c : $(SRCDIR)\schema.c + translate$E $** > $@ + +$(OBJDIR)\search$O : search_.c + $(TCC) /Fo$@ -c $** + +search_.c : $(SRCDIR)\search.c + translate$E $** > $@ + +$(OBJDIR)\setup$O : setup_.c + $(TCC) /Fo$@ -c $** + +setup_.c : $(SRCDIR)\setup.c + translate$E $** > $@ + +$(OBJDIR)\sha1$O : sha1_.c + $(TCC) /Fo$@ -c $** + +sha1_.c : $(SRCDIR)\sha1.c + translate$E $** > $@ + +$(OBJDIR)\shun$O : shun_.c + $(TCC) /Fo$@ -c $** + +shun_.c : $(SRCDIR)\shun.c + translate$E $** > $@ + +$(OBJDIR)\skins$O : skins_.c + $(TCC) /Fo$@ -c $** + +skins_.c : $(SRCDIR)\skins.c + translate$E $** > $@ + +$(OBJDIR)\stat$O : stat_.c + $(TCC) /Fo$@ -c $** + +stat_.c : $(SRCDIR)\stat.c + translate$E $** > $@ + +$(OBJDIR)\style$O : style_.c + $(TCC) /Fo$@ -c $** + +style_.c : $(SRCDIR)\style.c + translate$E $** > $@ + +$(OBJDIR)\sync$O : sync_.c + $(TCC) /Fo$@ -c $** + +sync_.c : $(SRCDIR)\sync.c + translate$E $** > $@ + +$(OBJDIR)\tag$O : tag_.c + $(TCC) /Fo$@ -c $** + +tag_.c : $(SRCDIR)\tag.c + translate$E $** > $@ + +$(OBJDIR)\th_main$O : th_main_.c + $(TCC) /Fo$@ -c $** + +th_main_.c : $(SRCDIR)\th_main.c + translate$E $** > $@ + +$(OBJDIR)\timeline$O : timeline_.c + $(TCC) /Fo$@ -c $** + +timeline_.c : $(SRCDIR)\timeline.c + translate$E $** > $@ + +$(OBJDIR)\tkt$O : tkt_.c + $(TCC) /Fo$@ -c $** + +tkt_.c : $(SRCDIR)\tkt.c + translate$E $** > $@ + +$(OBJDIR)\tktsetup$O : tktsetup_.c + $(TCC) /Fo$@ -c $** + +tktsetup_.c : $(SRCDIR)\tktsetup.c + translate$E $** > $@ + +$(OBJDIR)\undo$O : undo_.c + $(TCC) /Fo$@ -c $** + +undo_.c : $(SRCDIR)\undo.c + translate$E $** > $@ + +$(OBJDIR)\update$O : update_.c + $(TCC) /Fo$@ -c $** + +update_.c : $(SRCDIR)\update.c + translate$E $** > $@ + +$(OBJDIR)\url$O : url_.c + $(TCC) /Fo$@ -c $** + +url_.c : $(SRCDIR)\url.c + translate$E $** > $@ + +$(OBJDIR)\user$O : user_.c + $(TCC) /Fo$@ -c $** + +user_.c : $(SRCDIR)\user.c + translate$E $** > $@ + +$(OBJDIR)\verify$O : verify_.c + $(TCC) /Fo$@ -c $** + +verify_.c : $(SRCDIR)\verify.c + translate$E $** > $@ + +$(OBJDIR)\vfile$O : vfile_.c + $(TCC) /Fo$@ -c $** + +vfile_.c : $(SRCDIR)\vfile.c + translate$E $** > $@ + +$(OBJDIR)\wiki$O : wiki_.c + $(TCC) /Fo$@ -c $** + +wiki_.c : $(SRCDIR)\wiki.c + translate$E $** > $@ + +$(OBJDIR)\wikiformat$O : wikiformat_.c + $(TCC) /Fo$@ -c $** + +wikiformat_.c : $(SRCDIR)\wikiformat.c + translate$E $** > $@ + +$(OBJDIR)\winhttp$O : winhttp_.c + $(TCC) /Fo$@ -c $** + +winhttp_.c : $(SRCDIR)\winhttp.c + translate$E $** > $@ + +$(OBJDIR)\xfer$O : xfer_.c + $(TCC) /Fo$@ -c $** + +xfer_.c : $(SRCDIR)\xfer.c + translate$E $** > $@ + +$(OBJDIR)\zip$O : zip_.c + $(TCC) /Fo$@ -c $** + +zip_.c : $(SRCDIR)\zip.c + translate$E $** > $@ + +headers: makeheaders$E page_index.h VERSION.h + makeheaders$E add_.c:add.h allrepo_.c:allrepo.h attach_.c:attach.h bag_.c:bag.h blob_.c:blob.h branch_.c:branch.h browse_.c:browse.h captcha_.c:captcha.h cgi_.c:cgi.h checkin_.c:checkin.h checkout_.c:checkout.h clearsign_.c:clearsign.h clone_.c:clone.h comformat_.c:comformat.h configure_.c:configure.h content_.c:content.h db_.c:db.h delta_.c:delta.h deltacmd_.c:deltacmd.h descendants_.c:descendants.h diff_.c:diff.h diffcmd_.c:diffcmd.h doc_.c:doc.h encode_.c:encode.h file_.c:file.h finfo_.c:finfo.h graph_.c:graph.h http_.c:http.h http_socket_.c:http_socket.h http_ssl_.c:http_ssl.h http_transport_.c:http_transport.h info_.c:info.h login_.c:login.h main_.c:main.h manifest_.c:manifest.h md5_.c:md5.h merge_.c:merge.h merge3_.c:merge3.h name_.c:name.h pivot_.c:pivot.h popen_.c:popen.h pqueue_.c:pqueue.h printf_.c:printf.h rebuild_.c:rebuild.h report_.c:report.h rss_.c:rss.h schema_.c:schema.h search_.c:search.h setup_.c:setup.h sha1_.c:sha1.h shun_.c:shun.h skins_.c:skins.h stat_.c:stat.h style_.c:style.h sync_.c:sync.h tag_.c:tag.h th_main_.c:th_main.h timeline_.c:timeline.h tkt_.c:tkt.h tktsetup_.c:tktsetup.h undo_.c:undo.h update_.c:update.h url_.c:url.h user_.c:user.h verify_.c:verify.h vfile_.c:vfile.h wiki_.c:wiki.h wikiformat_.c:wikiformat.h winhttp_.c:winhttp.h xfer_.c:xfer.h zip_.c:zip.h $(SRCDIR)\sqlite3.h $(SRCDIR)\th.h VERSION.h + @copy /Y nul: headers ADDED win/include/dirent.h Index: win/include/dirent.h ================================================================== --- win/include/dirent.h +++ win/include/dirent.h @@ -0,0 +1,230 @@ +/***************************************************************************** + * dirent.h - dirent API for Microsoft Visual Studio + * + * Copyright (C) 2006 Toni Ronkko + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * ``Software''), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL TONI RONKKO BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Dec 15, 2009, John Cunningham + * Added rewinddir member function + * + * Jan 18, 2008, Toni Ronkko + * Using FindFirstFileA and WIN32_FIND_DATAA to avoid converting string + * between multi-byte and unicode representations. This makes the + * code simpler and also allows the code to be compiled under MingW. Thanks + * to Azriel Fasten for the suggestion. + * + * Mar 4, 2007, Toni Ronkko + * Bug fix: due to the strncpy_s() function this file only compiled in + * Visual Studio 2005. Using the new string functions only when the + * compiler version allows. + * + * Nov 2, 2006, Toni Ronkko + * Major update: removed support for Watcom C, MS-DOS and Turbo C to + * simplify the file, updated the code to compile cleanly on Visual + * Studio 2005 with both unicode and multi-byte character strings, + * removed rewinddir() as it had a bug. + * + * Aug 20, 2006, Toni Ronkko + * Removed all remarks about MSVC 1.0, which is antiqued now. Simplified + * comments by removing SGML tags. + * + * May 14 2002, Toni Ronkko + * Embedded the function definitions directly to the header so that no + * source modules need to be included in the Visual Studio project. Removed + * all the dependencies to other projects so that this very header can be + * used independently. + * + * May 28 1998, Toni Ronkko + * First version. + *****************************************************************************/ +#ifndef DIRENT_H +#define DIRENT_H + +#include <windows.h> +#include <string.h> +#include <assert.h> + + +typedef struct dirent +{ + char d_name[MAX_PATH + 1]; /* current dir entry (multi-byte char string) */ + WIN32_FIND_DATAA data; /* file attributes */ +} dirent; + + +typedef struct DIR +{ + dirent current; /* Current directory entry */ + int cached; /* Indicates un-processed entry in memory */ + HANDLE search_handle; /* File search handle */ + char patt[MAX_PATH + 3]; /* search pattern (3 = pattern + "\\*\0") */ +} DIR; + + +/* Forward declarations */ +static DIR *opendir (const char *dirname); +static struct dirent *readdir (DIR *dirp); +static int closedir (DIR *dirp); +static void rewinddir(DIR* dirp); + + +/* Use the new safe string functions introduced in Visual Studio 2005 */ +#if defined(_MSC_VER) && _MSC_VER >= 1400 +# define STRNCPY(dest,src,size) strncpy_s((dest),(size),(src),_TRUNCATE) +#else +# define STRNCPY(dest,src,size) strncpy((dest),(src),(size)) +#endif + + +/***************************************************************************** + * Open directory stream DIRNAME for read and return a pointer to the + * internal working area that is used to retrieve individual directory + * entries. + */ +static DIR *opendir(const char *dirname) +{ + DIR *dirp; + assert (dirname != NULL); + assert (strlen (dirname) < MAX_PATH); + + /* construct new DIR structure */ + dirp = (DIR*) malloc (sizeof (struct DIR)); + if (dirp != NULL) { + char *p; + + /* take directory name... */ + STRNCPY (dirp->patt, dirname, sizeof(dirp->patt)); + dirp->patt[MAX_PATH] = '\0'; + + /* ... and append search pattern to it */ + p = strchr (dirp->patt, '\0'); + if (dirp->patt < p && *(p-1) != '\\' && *(p-1) != ':') { + *p++ = '\\'; + } + *p++ = '*'; + *p = '\0'; + + /* open stream and retrieve first file */ + dirp->search_handle = FindFirstFileA (dirp->patt, &dirp->current.data); + if (dirp->search_handle == INVALID_HANDLE_VALUE) { + /* invalid search pattern? */ + free (dirp); + return NULL; + } + + /* there is an un-processed directory entry in memory now */ + dirp->cached = 1; + } + + return dirp; +} + + +/***************************************************************************** + * Read a directory entry, and return a pointer to a dirent structure + * containing the name of the entry in d_name field. Individual directory + * entries returned by this very function include regular files, + * sub-directories, pseudo-directories "." and "..", but also volume labels, + * hidden files and system files may be returned. + */ +static struct dirent *readdir(DIR *dirp) +{ + assert (dirp != NULL); + + if (dirp->search_handle == INVALID_HANDLE_VALUE) { + /* directory stream was opened/rewound incorrectly or ended normally */ + return NULL; + } + + /* get next directory entry */ + if (dirp->cached != 0) { + /* a valid directory entry already in memory */ + dirp->cached = 0; + } else { + /* read next directory entry from disk */ + if (FindNextFileA (dirp->search_handle, &dirp->current.data) == FALSE) { + /* the very last file has been processed or an error occured */ + FindClose (dirp->search_handle); + dirp->search_handle = INVALID_HANDLE_VALUE; + return NULL; + } + } + + /* copy as a multibyte character string */ + STRNCPY ( dirp->current.d_name, + dirp->current.data.cFileName, + sizeof(dirp->current.d_name) ); + dirp->current.d_name[MAX_PATH] = '\0'; + + return &dirp->current; +} + + +/***************************************************************************** + * Close directory stream opened by opendir() function. Close of the + * directory stream invalidates the DIR structure as well as any previously + * read directory entry. + */ +static int closedir(DIR *dirp) +{ + assert (dirp != NULL); + + /* release search handle */ + if (dirp->search_handle != INVALID_HANDLE_VALUE) { + FindClose (dirp->search_handle); + dirp->search_handle = INVALID_HANDLE_VALUE; + } + + /* release directory handle */ + free (dirp); + return 0; +} + + +/***************************************************************************** + * Resets the position of the directory stream to which dirp refers to the + * beginning of the directory. It also causes the directory stream to refer + * to the current state of the corresponding directory, as a call to opendir() + * would have done. If dirp does not refer to a directory stream, the effect + * is undefined. + */ +static void rewinddir(DIR* dirp) +{ + /* release search handle */ + if (dirp->search_handle != INVALID_HANDLE_VALUE) { + FindClose (dirp->search_handle); + dirp->search_handle = INVALID_HANDLE_VALUE; + } + + /* open new search handle and retrieve first file */ + dirp->search_handle = FindFirstFileA (dirp->patt, &dirp->current.data); + if (dirp->search_handle == INVALID_HANDLE_VALUE) { + /* invalid search pattern? */ + free (dirp); + return; + } + + /* there is an un-processed directory entry in memory now */ + dirp->cached = 1; +} + + +#endif /*DIRENT_H*/ ADDED win/include/unistd.h Index: win/include/unistd.h ================================================================== --- win/include/unistd.h +++ win/include/unistd.h @@ -0,0 +1,47 @@ +#ifndef _UNISTD_H +#define _UNISTD_H 1 + +/* This file intended to serve as a drop-in replacement for + * unistd.h on Windows + * Please add functionality as neeeded + */ + +#include <stdlib.h> +#include <io.h> +#define srandom srand +#define random rand +#if defined(__DMC__) +#endif + +#if defined(_WIN32) +#define _CRT_SECURE_NO_WARNINGS 1 + +#ifndef F_OK +#define F_OK 0 +#endif /* not F_OK */ + +#ifndef X_OK +#define X_OK 1 +#endif /* not X_OK */ + +#ifndef R_OK +#define R_OK 2 +#endif /* not R_OK */ + +#ifndef W_OK +#define W_OK 4 +#endif /* not W_OK */ + +#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) +#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) + + + +#endif + +#define access _access +#define ftruncate _chsize + +#define ssize_t int + +#endif /* unistd.h */ ADDED win/version.c Index: win/version.c ================================================================== --- win/version.c +++ win/version.c @@ -0,0 +1,19 @@ +#include <stdio.h> + +int main(int argc, char *argv[]){ + FILE *m,*u; + char b[10240]; + u = fopen(argv[1],"r"); + fgets(b, sizeof(b)-1,u); + b[strlen(b)-1] =0; + printf("#define MANIFEST_UUID \"%s\"\n",b); + printf("#define MANIFEST_VERSION \"[%10.10s]\"\n",b); + m = fopen(argv[2],"r"); + while(b == fgets(b, sizeof(b)-1,m)){ + if(0 == strncmp("D ",b,2)){ + printf("#define MANIFEST_DATE \"%.10s %.8s\"\n",b+2,b+13); + return 0; + } + } + return 1; +}