]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Get the shell enhancements compiling with MSVC.
authormistachkin <mistachkin@noemail.net>
Thu, 4 Jan 2018 22:46:08 +0000 (22:46 +0000)
committermistachkin <mistachkin@noemail.net>
Thu, 4 Jan 2018 22:46:08 +0000 (22:46 +0000)
FossilOrigin-Name: 335387f9e0d4569097d34cd99cd332b38a282e9b7ae25f088eb47df5c25837ef

Makefile.msc
ext/misc/fileio.c
ext/misc/zipfile.c
manifest
manifest.uuid
src/shell.c.in
src/test_windirent.h
test/shell8.test

index 5a479efb16d64fa18e4f0131c4fc5f8e5ebb9329..4fb128c56793a4cf0db6f268379b1f6b2bc79be2 100644 (file)
@@ -1506,7 +1506,8 @@ TESTEXT = \
   $(TOP)\ext\misc\spellfix.c \
   $(TOP)\ext\misc\totype.c \
   $(TOP)\ext\misc\unionvtab.c \
-  $(TOP)\ext\misc\wholenumber.c
+  $(TOP)\ext\misc\wholenumber.c \
+  $(TOP)\ext\misc\zipfile.c
 
 # Source code to the library files needed by the test fixture
 # (non-amalgamation)
@@ -2069,7 +2070,11 @@ SHELL_SRC = \
        $(TOP)\src\shell.c.in \
        $(TOP)\ext\misc\shathree.c \
        $(TOP)\ext\misc\fileio.c \
-       $(TOP)\ext\misc\completion.c
+       $(TOP)\ext\misc\completion.c \
+       $(TOP)\ext\misc\sqlar.c \
+       $(TOP)\ext\expert\sqlite3expert.c \
+       $(TOP)\ext\expert\sqlite3expert.h \
+       $(TOP)\ext\misc\zipfile.c
 
 shell.c:       $(SHELL_SRC) $(TOP)\tool\mkshellc.tcl
        $(TCLSH_CMD) $(TOP)\tool\mkshellc.tcl > shell.c
index 7dbac4043fd53ff4131456bd27ab8772c5fe83b4..2464d18f809e73a22b5a76e4a6929a7e815dcdc9 100644 (file)
@@ -82,10 +82,21 @@ SQLITE_EXTENSION_INIT1
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
-#include <unistd.h>
-#include <dirent.h>
+#if !defined(_WIN32) && !defined(WIN32)
+#  include <unistd.h>
+#  include <dirent.h>
+#  include <utime.h>
+#else
+#  include "windows.h"
+#  include <io.h>
+#  include <direct.h>
+#  include "test_windirent.h"
+#  define dirent DIRENT
+#  define timespec TIMESPEC
+#  define mkdir(path,mode) _mkdir(path)
+#  define lstat(path,buf) _stat(path,buf)
+#endif
 #include <time.h>
-#include <utime.h>
 #include <errno.h>
 
 
@@ -203,10 +214,13 @@ static int writeFile(
   mode_t mode,                    /* MODE parameter passed to writefile() */
   sqlite3_int64 mtime             /* MTIME parameter (or -1 to not set time) */
 ){
+#if !defined(_WIN32) && !defined(WIN32)
   if( S_ISLNK(mode) ){
     const char *zTo = (const char*)sqlite3_value_text(pData);
     if( symlink(zTo, zFile)<0 ) return 1;
-  }else{
+  }else
+#endif
+  {
     if( S_ISDIR(mode) ){
       if( mkdir(zFile, mode) ){
         /* The mkdir() call to create the directory failed. This might not
@@ -246,6 +260,7 @@ static int writeFile(
   }
 
   if( mtime>=0 ){
+#if !defined(_WIN32) && !defined(WIN32)
     struct timespec times[2];
     times[0].tv_nsec = times[1].tv_nsec = 0;
     times[0].tv_sec = time(0);
@@ -253,6 +268,28 @@ static int writeFile(
     if( utimensat(AT_FDCWD, zFile, times, AT_SYMLINK_NOFOLLOW) ){
       return 1;
     }
+#else
+    FILETIME lastAccess;
+    FILETIME lastWrite;
+    SYSTEMTIME currentTime;
+    LONGLONG intervals;
+    HANDLE hFile;
+    GetSystemTime(&currentTime);
+    SystemTimeToFileTime(&currentTime, &lastAccess);
+    intervals = Int32x32To64(mtime, 10000000) + 116444736000000000;
+    lastWrite.dwLowDateTime = (DWORD)intervals;
+    lastWrite.dwHighDateTime = intervals >> 32;
+    hFile = CreateFile(
+      zFile, FILE_WRITE_ATTRIBUTES, 0, NULL, OPEN_EXISTING, 0, NULL
+    );
+    if( hFile!=INVALID_HANDLE_VALUE ){
+      BOOL bResult = SetFileTime(hFile, NULL, &lastAccess, &lastWrite);
+      CloseHandle(hFile);
+      return !bResult;
+    }else{
+      return 1;
+    }
+#endif
   }
 
   return 0;
@@ -282,7 +319,7 @@ static void writefileFunc(
   zFile = (const char*)sqlite3_value_text(argv[0]);
   if( zFile==0 ) return;
   if( argc>=3 ){
-    mode = sqlite3_value_int(argv[2]);
+    mode = (mode_t)sqlite3_value_int(argv[2]);
   }
   if( argc==4 ){
     mtime = sqlite3_value_int64(argv[3]);
@@ -518,6 +555,7 @@ static int fsdirColumn(
       mode_t m = pCur->sStat.st_mode;
       if( S_ISDIR(m) ){
         sqlite3_result_null(ctx);
+#if !defined(_WIN32) && !defined(WIN32)
       }else if( S_ISLNK(m) ){
         char aStatic[64];
         char *aBuf = aStatic;
@@ -538,6 +576,7 @@ static int fsdirColumn(
 
         sqlite3_result_text(ctx, aBuf, n, SQLITE_TRANSIENT);
         if( aBuf!=aStatic ) sqlite3_free(aBuf);
+#endif
       }else{
         readFileContents(ctx, pCur->zPath);
       }
index 9d0865377d29b71faf06aac9b3c87d10d25071b7..c3dc5f2d3ee3c1a1a7caa68d8faaabf5d2df9134 100644 (file)
@@ -20,10 +20,14 @@ SQLITE_EXTENSION_INIT1
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
-#include <unistd.h>
-#include <dirent.h>
+#if !defined(_WIN32) && !defined(WIN32)
+#  include <unistd.h>
+#  include <dirent.h>
+#  include <utime.h>
+#else
+#  include <io.h>
+#endif
 #include <time.h>
-#include <utime.h>
 #include <errno.h>
 
 #include <zlib.h>
@@ -387,9 +391,9 @@ static int zipfileReadData(
   char **pzErrmsg                 /* OUT: Error message (from sqlite3_malloc) */
 ){
   size_t n;
-  fseek(pFile, iOff, SEEK_SET);
+  fseek(pFile, (long)iOff, SEEK_SET);
   n = fread(aRead, 1, nRead, pFile);
-  if( n!=nRead ){
+  if( (int)n!=nRead ){
     *pzErrmsg = sqlite3_mprintf("error in fread()");
     return SQLITE_ERROR;
   }
@@ -402,9 +406,9 @@ static int zipfileAppendData(
   int nWrite
 ){
   size_t n;
-  fseek(pTab->pWriteFd, pTab->szCurrent, SEEK_SET);
+  fseek(pTab->pWriteFd, (long)pTab->szCurrent, SEEK_SET);
   n = fwrite(aWrite, 1, nWrite, pTab->pWriteFd);
-  if( n!=nWrite ){
+  if( (int)n!=nWrite ){
     pTab->base.zErrMsg = sqlite3_mprintf("error in fwrite()");
     return SQLITE_ERROR;
   }
@@ -649,17 +653,22 @@ static time_t zipfileMtime(ZipfileCsr *pCsr){
 static void zipfileMtimeToDos(ZipfileCDS *pCds, u32 mTime){
   time_t t = (time_t)mTime;
   struct tm res;
+
+#if !defined(_WIN32) && !defined(WIN32)
   localtime_r(&t, &res);
+#else
+  memcpy(&res, localtime(&t), sizeof(struct tm));
+#endif
 
-  pCds->mTime = 
+  pCds->mTime = (u16)(
     (res.tm_sec / 2) + 
     (res.tm_min << 5) +
-    (res.tm_hour << 11);
+    (res.tm_hour << 11));
 
-  pCds->mDate = 
+  pCds->mDate = (u16)(
     (res.tm_mday-1) +
     ((res.tm_mon+1) << 5) +
-    ((res.tm_year-80) << 9);
+    ((res.tm_year-80) << 9));
 }
 
 /*
@@ -754,6 +763,7 @@ static int zipfileReadEOCD(
   i64 szFile;                     /* Total size of file in bytes */
   int nRead;                      /* Bytes to read from file */
   i64 iOff;                       /* Offset to read from */
+  int rc;
 
   fseek(pFile, 0, SEEK_END);
   szFile = (i64)ftell(pFile);
@@ -763,7 +773,7 @@ static int zipfileReadEOCD(
   nRead = (int)(MIN(szFile, ZIPFILE_BUFFER_SIZE));
   iOff = szFile - nRead;
 
-  int rc = zipfileReadData(pFile, aRead, nRead, iOff, &pTab->base.zErrMsg);
+  rc = zipfileReadData(pFile, aRead, nRead, iOff, &pTab->base.zErrMsg);
   if( rc==SQLITE_OK ){
     int i;
 
@@ -968,7 +978,7 @@ static ZipfileEntry *zipfileNewEntry(
 ){
   u8 *aWrite;
   ZipfileEntry *pNew;
-  pCds->nFile = nPath;
+  pCds->nFile = (u16)nPath;
   pCds->nExtra = mTime ? 9 : 0;
   pNew = (ZipfileEntry*)sqlite3_malloc(
     sizeof(ZipfileEntry) + 
@@ -1036,7 +1046,7 @@ static int zipfileAppendEntry(
   zipfileWrite32(aBuf, pCds->crc32);
   zipfileWrite32(aBuf, pCds->szCompressed);
   zipfileWrite32(aBuf, pCds->szUncompressed);
-  zipfileWrite16(aBuf, nPath);
+  zipfileWrite16(aBuf, (u16)nPath);
   zipfileWrite16(aBuf, pCds->nExtra);
   assert( aBuf==&pTab->aBuffer[ZIPFILE_LFH_FIXED_SZ] );
   rc = zipfileAppendData(pTab, pTab->aBuffer, aBuf - pTab->aBuffer);
@@ -1066,13 +1076,15 @@ static int zipfileGetMode(ZipfileTab *pTab, sqlite3_value *pVal, int *pMode){
   if( z==0 || (z[0]>=0 && z[0]<=9) ){
     mode = sqlite3_value_int(pVal);
   }else{
-    const char zTemplate[10] = "-rwxrwxrwx";
+    const char zTemplate[11] = "-rwxrwxrwx";
     int i;
     if( strlen(z)!=10 ) goto parse_error;
     switch( z[0] ){
       case '-': mode |= S_IFREG; break;
       case 'd': mode |= S_IFDIR; break;
+#if !defined(_WIN32) && !defined(WIN32)
       case 'l': mode |= S_IFLNK; break;
+#endif
       default: goto parse_error;
     }
     for(i=1; i<10; i++){
@@ -1178,13 +1190,13 @@ static int zipfileUpdate(
     cds.iVersionMadeBy = ZIPFILE_NEWENTRY_MADEBY;
     cds.iVersionExtract = ZIPFILE_NEWENTRY_REQUIRED;
     cds.flags = ZIPFILE_NEWENTRY_FLAGS;
-    cds.iCompression = iMethod;
+    cds.iCompression = (u16)iMethod;
     zipfileMtimeToDos(&cds, (u32)mTime);
     cds.crc32 = crc32(0, pData, nData);
     cds.szCompressed = nData;
-    cds.szUncompressed = sz;
+    cds.szUncompressed = (u32)sz;
     cds.iExternalAttr = (mode<<16);
-    cds.iOffset = pTab->szCurrent;
+    cds.iOffset = (u32)pTab->szCurrent;
     pNew = zipfileNewEntry(&cds, zPath, nPath, (u32)mTime);
     if( pNew==0 ){
       rc = SQLITE_NOMEM;
@@ -1291,10 +1303,10 @@ static int zipfileCommit(sqlite3_vtab *pVtab){
     /* Write out the EOCD record */
     eocd.iDisk = 0;
     eocd.iFirstDisk = 0;
-    eocd.nEntry = nEntry;
-    eocd.nEntryTotal = nEntry;
-    eocd.nSize = pTab->szCurrent - iOffset;;
-    eocd.iOffset = iOffset;
+    eocd.nEntry = (u16)nEntry;
+    eocd.nEntryTotal = (u16)nEntry;
+    eocd.nSize = (u32)(pTab->szCurrent - iOffset);
+    eocd.iOffset = (u32)iOffset;
     rc = zipfileAppendEOCD(pTab, &eocd);
 
     zipfileCleanupTransaction(pTab);
index eb4d9552dd96a960b564ec4ab1f3caab0484f7e6..32e1f5b38adbbba2247b8363d356d5b935d91790 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,10 +1,10 @@
-C Merge\sin\sall\srecent\strunk\senhancements.
-D 2018-01-04T19:54:55.108
+C Get\sthe\sshell\senhancements\scompiling\swith\sMSVC.
+D 2018-01-04T22:46:08.740
 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
 F Makefile.in 1b11037c5ed3399a79433cc82c59b5e36a7b3a3e4e195bb27640d0d2145e03e1
 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
-F Makefile.msc 8723bebdec08013054d1ade8f65a13cad34bf8dd015f09649754be2b5f6edc59
+F Makefile.msc feaf722defab458cbf9583249e441239bae08fcf7fb907496c7d3fed16862f21
 F README.md eeae1e552f93ef72ef7c5b8f6647b368a001c28820ad1df179d3dae602bef681
 F VERSION 0c10cdfed866fdd2d80434f64f042c3330f1daaed12e54287beb104f04b3faaf
 F aclocal.m4 a5c22d164aff7ed549d53a90fa56d56955281f50
@@ -276,7 +276,7 @@ F ext/misc/compress.c 122faa92d25033d6c3f07c39231de074ab3d2e83
 F ext/misc/csv.c 1a009b93650732e22334edc92459c4630b9fa703397cbb3c8ca279921a36ca11
 F ext/misc/dbdump.c 3509fa6b8932d04e932d6b6b827b6a82ca362781b8e8f3c77336f416793e215e
 F ext/misc/eval.c f971962e92ebb8b0a4e6b62949463ee454d88fa2
-F ext/misc/fileio.c 014152d4133e7b29eab8eb39d0c640659c23a6d23d882b4778f487ae7d1a457b
+F ext/misc/fileio.c 16cf8d9b9372269a61644717929578a71c48eb018a76709f3bf1196bdc957d46
 F ext/misc/fuzzer.c 7c64b8197bb77b7d64eff7cac7848870235d4c25
 F ext/misc/ieee754.c f190d0cc5182529acb15babd177781be1ac1718c
 F ext/misc/json1.c dbe086615b9546c156bf32b9378fc09383b58bd17513b866cfd24c1e15281984
@@ -302,7 +302,7 @@ F ext/misc/vfsstat.c bf10ef0bc51e1ad6756629e1edb142f7a8db1178
 F ext/misc/vtablog.c 31d0d8f4406795679dcd3a67917c213d3a2a5fb3ea5de35f6e773491ed7e13c9
 F ext/misc/vtshim.c 1976e6dd68dd0d64508c91a6dfab8e75f8aaf6cd
 F ext/misc/wholenumber.c 784b12543d60702ebdd47da936e278aa03076212
-F ext/misc/zipfile.c 2df8f94003903fe3cc104b807418c54e68040964d4319c522ac2f485152f5abd
+F ext/misc/zipfile.c d88033b4748db9929a0096f627d3a75e9fe0e11d7a92724a6c1c575d5448cea4
 F ext/rbu/rbu.c ea7d1b7eb44c123a2a619332e19fe5313500705c4a58aaa1887905c0d83ffc2e
 F ext/rbu/rbu1.test 43836fac8c7179a358eaf38a8a1ef3d6e6285842
 F ext/rbu/rbu10.test 1846519a438697f45e9dcb246908af81b551c29e1078d0304fae83f1fed7e9ee
@@ -483,7 +483,7 @@ F src/random.c 80f5d666f23feb3e6665a6ce04c7197212a88384
 F src/resolve.c bbee7e31d369a18a2f4836644769882e9c5d40ef4a3af911db06410b65cb3730
 F src/rowset.c 7b7e7e479212e65b723bf40128c7b36dc5afdfac
 F src/select.c 8b22abe193e4d8243befa2038e4ae2405802fed1c446e5e502d11f652e09ba74
-F src/shell.c.in 3e2db269982c4a6f7e8e32ef5620eda718a21a71bb2b5cd73c3ea9b87c6d21bc
+F src/shell.c.in e17f15b3394206e5f0002267426d03fc4932da40af60a48e409238a8ee6c40ec
 F src/sqlite.h.in 1f1a2da222ec57465794e8984d77f32d0bd0da80cdc136beadda461a0be9d80c
 F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
 F src/sqlite3ext.h c02d628cca67f3889c689d82d25c3eb45e2c155db08e4c6089b5840d64687d34
@@ -541,7 +541,7 @@ F src/test_thread.c 911d15fb14e19c0c542bdc8aabf981c2f10a4858
 F src/test_vfs.c f0186261a24de2671d080bcd8050732f0cb64f6e
 F src/test_vfstrace.c bab9594adc976cbe696ff3970728830b4c5ed698
 F src/test_windirent.c 17f91f5f2aa1bb7328abb49414c363b5d2a9d3ff
-F src/test_windirent.h 5d67483a55442e31e1bde0f4a230e6e932ad5906
+F src/test_windirent.h e3de7323538e5233dfffd33538fc7e9d56c85e266d36540adb1cedb566e14eea
 F src/test_wsd.c 41cadfd9d97fe8e3e4e44f61a4a8ccd6f7ca8fe9
 F src/threads.c 4ae07fa022a3dc7c5beb373cf744a85d3c5c6c3c
 F src/tokenize.c 1003d6d90c6783206c711f0a9397656fa5b055209f4d092caa43bb3bf5215db5
@@ -1224,7 +1224,7 @@ F test/shell4.test 89ad573879a745974ff2df20ff97c5d6ffffbd5d
 F test/shell5.test 23939a4c51f0421330ea61dbd3c74f9c215f5f8d3d1a94846da6ffc777a35458
 F test/shell6.test 1ceb51b2678c472ba6cf1e5da96679ce8347889fe2c3bf93a0e0fa73f00b00d3
 F test/shell7.test 115132f66d0463417f408562cc2cf534f6bbc6d83a6d50f0072a9eb171bae97f
-F test/shell8.test 96f35965fe84d633fb2338696f5cbc1bcf6bdbdd79677244bc617a8452851dc7
+F test/shell8.test 7585847402452d594f0e5f93430d34ed63b2f34ca7e956f63db157f9327c6896
 F test/shortread1.test bb591ef20f0fd9ed26d0d12e80eee6d7ac8897a3
 F test/show_speedtest1_rtree.tcl 32e6c5f073d7426148a6936a0408f4b5b169aba5
 F test/shrink.test 1b4330b1fd9e818c04726d45cb28db73087535ce
@@ -1694,7 +1694,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
 F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
 F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P 01d4e866fb7b01aeada537d41c4a47747c7810e2028f51077ee5b8b78c348954 a6eee0fcd89d3958f8720ebdb5f0a8558b4795d747128091dae283eb81c4f74f
-R d4f5940088399233b1f4f56f19294263
-U drh
-Z c1193b259bc575590a62665cc9281689
+P 406f79183736b6ad360169b837172afef2c82a4312f5787db08c54167a44b15e
+R 73aa9301733dc3abdd11287ef3222fd8
+U mistachkin
+Z 751be0dac1987ad178cccedeeaed1d64
index 0fefe4597b46b990dd89dfe0a656db44b4a60177..f23cbae652e1dded1c09f91abaf5a8e1e2827a60 100644 (file)
@@ -1 +1 @@
-406f79183736b6ad360169b837172afef2c82a4312f5787db08c54167a44b15e
\ No newline at end of file
+335387f9e0d4569097d34cd99cd332b38a282e9b7ae25f088eb47df5c25837ef
\ No newline at end of file
index 6f1c92e0069f4794760ba08f45093e71d4558f1b..21ca7edbb827387f6ffd6cc43247cacb9c100179 100644 (file)
@@ -73,8 +73,9 @@
 #  include <pwd.h>
 # endif
 # include <unistd.h>
-# include <sys/types.h>
 #endif
+#include <sys/types.h>
+#include <sys/stat.h>
 
 #if HAVE_READLINE
 # include <readline/readline.h>
@@ -874,6 +875,11 @@ static void shellAddSchemaName(
 #define SQLITE_EXTENSION_INIT1
 #define SQLITE_EXTENSION_INIT2(X) (void)(X)
 
+#if defined(_WIN32) || defined(WIN32)
+INCLUDE test_windirent.c
+#define dirent DIRENT
+#define timespec TIMESPEC
+#endif
 INCLUDE ../ext/misc/shathree.c
 INCLUDE ../ext/misc/fileio.c
 INCLUDE ../ext/misc/completion.c
@@ -4551,7 +4557,7 @@ static int arParseCommand(
           struct ArSwitch *pOpt;            /* Iterator */
           for(pOpt=&aSwitch[0]; pOpt<pEnd; pOpt++){
             const char *zLong = pOpt->zLong;
-            if( (n-2)<=strlen(zLong) && 0==memcmp(&z[2], zLong, n-2) ){
+            if( (n-2)<=(int)strlen(zLong) && 0==memcmp(&z[2], zLong, n-2) ){
               if( pMatch ){
                 return arErrorMsg("ambiguous option: %s",z);
               }else{
index 578e2a7c22e5661b1cb6dd5f1ba5b14e414c5e39..2303c0c8fb21336171f8ac3a58422c8a0d56310b 100644 (file)
 #include <errno.h>
 #include <io.h>
 #include <limits.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+
+/*
+** We may need several defines that should have been in "sys/stat.h".
+*/
+
+#ifndef S_ISREG
+#define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG)
+#endif
+
+#ifndef S_ISDIR
+#define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
+#endif
+
+#ifndef S_ISLNK
+#define S_ISLNK(mode) (0)
+#endif
+
+/*
+** We may need to provide the "mode_t" type.
+*/
+
+#ifndef MODE_T_DEFINED
+  #define MODE_T_DEFINED
+  typedef unsigned short mode_t;
+#endif
 
 /*
 ** We may need to provide the "ino_t" type.
 ** We need to provide the necessary structures and related types.
 */
 
+#ifndef DIRENT_DEFINED
+#define DIRENT_DEFINED
 typedef struct DIRENT DIRENT;
-typedef struct DIR DIR;
 typedef DIRENT *LPDIRENT;
-typedef DIR *LPDIR;
-
 struct DIRENT {
   ino_t d_ino;               /* Sequence number, do not use. */
   unsigned d_attributes;     /* Win32 file attributes. */
   char d_name[NAME_MAX + 1]; /* Name within the directory. */
 };
+#endif
 
+#ifndef DIR_DEFINED
+#define DIR_DEFINED
+typedef struct DIR DIR;
+typedef DIR *LPDIR;
 struct DIR {
   intptr_t d_handle; /* Value returned by "_findfirst". */
   DIRENT d_first;    /* DIRENT constructed based on "_findfirst". */
   DIRENT d_next;     /* DIRENT constructed based on "_findnext". */
 };
+#endif
+
+#ifndef TIMESPEC_DEFINED
+#define TIMESPEC_DEFINED
+typedef struct TIMESPEC TIMESPEC;
+typedef TIMESPEC *LPTIMESPEC;
+struct TIMESPEC {
+  time_t tv_sec; /* Number of whole seconds. */
+  long tv_nsec;  /* Number of whole nanoseconds. */
+};
+#endif
 
 /*
 ** Provide a macro, for use by the implementation, to determine if a
index 14980a84a53b2a567350cbcf9673e5ecde98e69e..50e269ef3ed815e2cc49c10b1d4490f2063f349b 100644 (file)
@@ -40,7 +40,11 @@ proc dir_to_list {dirname {n -1}} {
   set res [list]
   foreach f [glob -nocomplain $dirname/*] {
     set mtime [file mtime $f]
-    set perm [file attributes $f -perm]
+    if {$::tcl_platform(platform)!="windows"} {
+      set perm [file attributes $f -perm]
+    } else {
+      set perm 0
+    }
     set relpath [file join {*}[lrange [file split $f] $n end]]
     lappend res 
     if {[file isdirectory $f]} {