Compare commits

...
160 Commits
Author SHA1 Message Date
jan.nijtmans 8729900f69 Backport latest improvements from androwish 2018-09-03 09:47:40 +00:00
jan.nijtmans 93fe453205 merge 8.6 2018-09-03 07:51:24 +00:00
jan.nijtmans 215b5dd08d merge 8.6 2018-05-31 20:31:42 +00:00
jan.nijtmans 1d768f7890 merge core-8-6-branch 2018-01-20 16:34:17 +00:00
jan.nijtmans 80206cc113 merge core-8-6-branch 2017-12-28 16:54:46 +00:00
jan.nijtmans f851263f52 upstream androwish changes 2017-11-17 12:40:34 +00:00
jan.nijtmans 3ddad4402a merge core-8-6-branch 2017-11-17 12:33:14 +00:00
jan.nijtmans 42259830ab merge core-8-6-branch 2017-11-03 12:59:49 +00:00
jan.nijtmans 8f2cdcfe32 merge core-8-6-branch 2017-10-27 14:56:33 +00:00
jan.nijtmans 3e94587dff merge core-8-6-branch 2017-10-10 15:05:14 +00:00
jan.nijtmans 8270c03fac Merge core-8-6-branch, fallback for MAP_FILE 2017-09-04 13:21:51 +00:00
jan.nijtmans 0420e8dd91 merge core-8-6-branch 2017-09-01 14:00:17 +00:00
jan.nijtmans c433e9b60a merge rfe-6c0d7aec67
Adapt upstream Androwish improvements
2017-07-14 15:03:29 +00:00
jan.nijtmans a64be34c0b merge rfe-6c0d7aec67 2017-07-03 12:34:23 +00:00
jan.nijtmans 310ee501e8 Merge rfe-6c0d7aec67 2017-06-16 14:33:10 +00:00
jan.nijtmans 0104227d89 Merge rfe-6c0d7aec67 2017-06-13 12:20:39 +00:00
jan.nijtmans 43778c199d Merge rfe-6c0d7aec67 2017-06-08 08:27:55 +00:00
jan.nijtmans d7023c5bf4 merge core-8-6-branch 2017-06-02 14:27:29 +00:00
jan.nijtmans d1f1107ccd merge trunk 2017-05-23 12:24:10 +00:00
jan.nijtmans 202ffed8ed merge core-8-6-branch 2017-05-18 12:58:37 +00:00
jan.nijtmans 4e74fe9243 merge core-8-6-branch 2017-05-08 08:11:07 +00:00
jan.nijtmans fe6c8e39c5 merge core-8-6-branch 2017-05-03 13:37:04 +00:00
jan.nijtmans 39394a7c8c merge core-8-6-branch 2017-04-25 11:12:48 +00:00
jan.nijtmans db323b6992 merge core-8-6-branch 2017-04-18 19:06:10 +00:00
jan.nijtmans f803ae2b11 merge core-8-6-branch 2017-04-18 18:56:48 +00:00
jan.nijtmans 174f55c044 Fix executable flag 2017-04-12 12:30:43 +00:00
jan.nijtmans a270140a3e merge core-8-6-branch 2017-04-12 12:29:49 +00:00
jan.nijtmans 841c04fbac merge core-8-6-branch 2017-04-03 13:21:03 +00:00
jan.nijtmans 232349c3de merge core-8-6-branch 2017-03-31 11:21:19 +00:00
jan.nijtmans fb2b7d4615 merge core-8-6-branch 2017-03-24 10:33:14 +00:00
jan.nijtmans b645469c95 merge core-8-6-branch 2017-03-07 12:21:28 +00:00
jan.nijtmans e295641767 merge core-8-6-branch 2017-03-07 09:09:44 +00:00
jan.nijtmans c3a18ac8f4 merge core-8-6-branch 2017-02-27 16:04:00 +00:00
jan.nijtmans f9dda45e97 merge core-8-6-branch 2017-02-25 15:57:39 +00:00
jan.nijtmans a5c310f993 merge core-8-6-branch 2017-01-17 09:06:45 +00:00
jan.nijtmans 80d9aa777b Merge core-8-6-branch. Better deal with patterns regarding hidden files in ZIP filesystem (taken over from upstream androwish) 2017-01-16 12:46:42 +00:00
jan.nijtmans c745f44e3a Merge core-8-6-branch 2017-01-06 11:47:15 +00:00
jan.nijtmans 21d4596064 Merge core-8-6-branch. Remove (temporarily) write-functions from zipfs. Let first TIP-version handle read-only functions only. 2016-11-14 15:51:03 +00:00
jan.nijtmans 5f738db586 Merge core-8-6-branch. Update upstream changes to zipfs.c 2016-11-07 11:16:52 +00:00
jan.nijtmans 76bb4d1ea4 merge core-8-6-branch 2016-11-02 12:09:04 +00:00
jan.nijtmans 4db368d595 merge core-8-6-branch 2016-10-03 14:56:00 +00:00
jan.nijtmans e9e40f5f02 merge core-8-6-branch 2016-09-26 15:03:11 +00:00
jan.nijtmans c3c935369d merge core-8-6-branch 2016-09-08 07:24:06 +00:00
jan.nijtmans bd1370959e merge core-8-6-branch 2016-08-30 13:42:21 +00:00
jan.nijtmans 9a7f1bd48c merge core-8-6-branch 2016-08-19 08:58:35 +00:00
jan.nijtmans 47cb19c83f merge core-8-6-branch 2016-06-23 11:51:36 +00:00
jan.nijtmans f4cc5617a6 merge core-8-6-branch 2016-06-14 10:00:04 +00:00
jan.nijtmans e48602d674 Merge core-8-6-branch 2016-06-03 13:22:58 +00:00
jan.nijtmans e9a8c42972 merge core-8-6-branch 2016-05-19 11:46:43 +00:00
jan.nijtmans 5bcc7fa342 merge core-8-6-branch 2016-04-24 16:14:07 +00:00
jan.nijtmans b0c45c3ad0 merge core-8-6-branch 2016-04-18 09:35:33 +00:00
jan.nijtmans e1e49c9dd1 Merge core-8-6-branch, cherry-pick [http://www.androwish.org/index.html/info/04ea31271c40789d|04ea31271c40789d] 2016-04-08 14:55:57 +00:00
jan.nijtmans 18ba46bf37 merge core-8-6-branch 2016-04-07 09:19:05 +00:00
jan.nijtmans 5b719a2281 merge core-8-6-branch 2016-04-05 08:23:23 +00:00
jan.nijtmans edbf30e23a merge core-8-6-branch 2016-03-30 09:20:54 +00:00
jan.nijtmans 395d0889b0 merge core-8-6-branch 2016-03-30 07:52:15 +00:00
jan.nijtmans ba0d107038 merge core-8-6-branch 2016-03-23 15:12:01 +00:00
jan.nijtmans 763f9dff55 minor upstream changes 2016-03-02 15:39:32 +00:00
jan.nijtmans bbcef5b648 merge trunk 2016-03-02 15:10:48 +00:00
jan.nijtmans 25d1f4aa03 Merge trunk 2016-02-08 16:11:13 +00:00
jan.nijtmans 22f5c55560 Upstream zipfs change and unbreak zipfs test-case 2016-01-29 09:17:55 +00:00
jan.nijtmans 3cf33e9e9f merge trunk 2016-01-24 16:57:57 +00:00
jan.nijtmans a288c5e54a Merge trunk.
Depend on ensemble now, adapt documentation.
2016-01-23 20:33:38 +00:00
jan.nijtmans c3e9d3205f Add "zipfs" ensemble. 2016-01-22 08:45:38 +00:00
jan.nijtmans 227fbec0fc Merge trunk, upstream fixes to zipfs.c for win32 2016-01-19 10:43:40 +00:00
jan.nijtmans dc21089720 Merge trunk 2016-01-18 14:33:32 +00:00
jan.nijtmans f6bb864fc7 Minor tweaks in documentation/testcases. Don't use deprecated Tcl methods any more 2016-01-18 09:28:55 +00:00
jan.nijtmans 982211da16 Merge trunk. Update documentation 2016-01-09 23:02:42 +00:00
jan.nijtmans a1740d9766 Make al zipfs command Tcl_Obj-based 2016-01-01 16:50:52 +00:00
jan.nijtmans e9795fb407 first shot at documentation 2015-12-22 11:39:28 +00:00
jan.nijtmans 299924e512 Remove TIP #414 fragment, not strictly needed for the zipfs TIP.
Add more zipfs test-cases
2015-12-22 09:11:57 +00:00
jan.nijtmans a03e74efc1 USE_TCL_STUBS is not defined anyway 2015-12-21 21:25:40 +00:00
jan.nijtmans 3c03a492f9 Start with a few simple basic test-cases 2015-12-21 15:21:21 +00:00
jan.nijtmans 56c5833c4a Eliminate all use of ZIPFS_IN_TCL 2015-12-21 14:01:57 +00:00
jan.nijtmans 63b07461da Fix android compilation (zipfsFilesystem.loadFileProc is a constant, so it cannot be written) 2015-12-21 12:43:54 +00:00
jan.nijtmans 1c3288f038 Finally, make it compile warning-free using Visual Studio, if ZIPFS_IN_TCL is defined 2015-12-21 11:59:08 +00:00
jan.nijtmans 8ecd6aeb5b Make it compile warning-free with MSVC compiler (VS2013, at least). Other tweaks. 2015-12-21 11:29:38 +00:00
jan.nijtmans 4d00715902 CONST -> const 2015-12-21 10:49:36 +00:00
jan.nijtmans 95aeb2a3d6 Merge trunk.
Remove utf-32 encoding, will not be part of the "zipfs" TIP.
2015-12-21 10:38:12 +00:00
jan.nijtmans b0a98f480d Undo more Android-specific changes, which don't form part of Zipfs, as further preparation for Zipfs TIP.
Rename zipfs.h to tclZipfs.h, so it can be installed together with tcl.h
2015-12-21 10:03:06 +00:00
jan.nijtmans cb73551e8d Start of "zipfs" branch, meant for keeping track of the proposed changes for a new TIP. Remove some android-specific build/configure files. 2015-12-21 09:31:36 +00:00
jan.nijtmans 4d946107e7 Put back the stub entries for TclpGetDate/TclpLocaltime/TclpGmtime. Although those functions are dead (they will be removed in Tcl 9, already done in the "novem" branch), removing those functions is a good idea, this cannot be done in any 8.x release. It hinders the acceptance of a "zipfs" TIP, therefore this change should not be part of the "androwish" change-set. 2015-12-21 09:16:38 +00:00
jan.nijtmans c795f44ea5 upstream androwish change 2015-12-18 12:39:24 +00:00
jan.nijtmans ecd9567624 Minor tweaks on ZIPFS_IN_TCL 2015-12-17 15:23:27 +00:00
jan.nijtmans d6fdfa4624 minor tweaks for MSVC 2015-12-17 12:04:22 +00:00
jan.nijtmans 58ace2b1dc remove unnecessary Tclzipfs defines in tclStubInit.c 2015-12-16 15:18:59 +00:00
jan.nijtmans 8f6089f225 No need for more than tcl.h in zipfs.h 2015-12-16 13:37:20 +00:00
jan.nijtmans 19627fed47 Remove zipfs symbols from stub table. Those symbols should be exported as-is, without using the stub mechanism. 2015-12-16 13:26:54 +00:00
jan.nijtmans 83145e2bb1 merge trunk 2015-12-16 13:21:58 +00:00
jan.nijtmans 621c76324a Merge trunk. Upstream zipfs change 2015-12-15 09:31:57 +00:00
jan.nijtmans e961e1c08a Merge trunk. Upstream androwish changes 2015-12-11 22:56:07 +00:00
jan.nijtmans e740674cb8 Merge trunk. Upstream zipfs change 2015-12-09 10:20:02 +00:00
jan.nijtmans 23ced66a6b merge trunk 2015-11-30 07:37:05 +00:00
jan.nijtmans b637222a5d merge trunk 2015-11-25 21:07:55 +00:00
jan.nijtmans 9a0f7dd2c8 merge trunk 2015-11-22 16:06:02 +00:00
jan.nijtmans 440e5fc7dc Merge trunk 2015-11-18 08:53:34 +00:00
jan.nijtmans 74ed7238b0 merge trunk 2015-11-14 21:37:35 +00:00
jan.nijtmans 38d734ddcf better handle out-of-memory conditions in ZIP filesystem
hard-wire initial encoding on Android to UTF-8
2015-11-03 13:13:14 +00:00
jan.nijtmans cbeed9da92 Merge trunk. Added comments in ZIP filesystem (no functional changes) 2015-11-01 22:04:02 +00:00
jan.nijtmans a369d46795 merge trunk 2015-10-28 09:04:46 +00:00
jan.nijtmans 4594b4f27a merge trunk 2015-10-25 22:59:16 +00:00
jan.nijtmans ff3f0131bd Merge trunk 2015-10-25 20:14:13 +00:00
jan.nijtmans 5b793fef99 merge trunk 2015-10-23 08:52:41 +00:00
jan.nijtmans 13aa1642ac Merge trunk 2015-10-23 08:13:49 +00:00
jan.nijtmans d905cc4737 merge trunk 2015-10-18 10:48:54 +00:00
jan.nijtmans d954f3c4ee Merge trunk 2015-10-14 19:04:36 +00:00
jan.nijtmans c770024ce1 merge trunk 2015-10-09 19:11:11 +00:00
jan.nijtmans c1f95640c4 merge trunk 2015-10-07 07:23:01 +00:00
jan.nijtmans 48ef2b50eb merge trunk 2015-10-06 10:50:56 +00:00
jan.nijtmans 071aa09c6e merge trunk 2015-10-04 09:42:24 +00:00
jan.nijtmans 10cd3c906d merge trunk 2015-09-30 13:57:25 +00:00
jan.nijtmans 0fca37f803 merge trunk 2015-09-29 21:20:04 +00:00
jan.nijtmans 9dd94f7396 Don't use mutex retry mechanism on Android. (problems ???) 2015-09-28 10:58:30 +00:00
jan.nijtmans ce65c7b396 merge trunk 2015-09-27 12:59:23 +00:00
jan.nijtmans a80a084de9 merge trunk 2015-09-23 11:35:03 +00:00
jan.nijtmans ddc625f2fe merge trunk 2015-09-22 08:06:16 +00:00
jan.nijtmans 842b15b839 fixed bug in zipfs error handling (backported from androwish) 2015-09-17 11:47:04 +00:00
jan.nijtmans 4506b4536b Merge trunk 2015-09-02 07:16:50 +00:00
jan.nijtmans dbe627594e Dependancies from androwish upstream 2015-08-31 17:30:01 +00:00
jan.nijtmans 130fe11f2b Merge trunk, but remove experimental tip-389-impl merge. 2015-08-31 10:22:29 +00:00
jan.nijtmans 3bce1ab6f2 Merge tip-389-impl (experimental) 2015-08-24 19:39:40 +00:00
jan.nijtmans fe773c0a46 merge trunk 2015-08-24 19:35:08 +00:00
jan.nijtmans ecc90e3787 one more.... 2015-08-24 08:01:23 +00:00
jan.nijtmans 6e0d4b6761 Remove unused internal stub entries as well. 2015-08-24 07:58:42 +00:00
jan.nijtmans 53ad2ab17d Merge trunk.
Throw away TclpGetDate, TclpLocaltime and TclpGmtime and all related dead code. It makes the androwish binary (somewhat) smaller.
2015-08-21 13:29:06 +00:00
jan.nijtmans a2a59dfb75 merge trunk 2015-08-19 09:06:22 +00:00
jan.nijtmans 829af34165 merge trunk. Put back some (actually unused) Tclp*UnixTime functions. 2015-08-17 14:48:56 +00:00
jan.nijtmans 1579eae899 merge trunk 2015-08-06 04:33:49 +00:00
jan.nijtmans 6fcdce9c74 merge trunk 2015-07-16 05:31:51 +00:00
jan.nijtmans ac785323be merge trunk. Undo unnecessary changes in tclEncoding.c, making it equal to trunk again (thanks to Christian Werner for testing this on androidwish). 2015-07-15 14:52:25 +00:00
jan.nijtmans d68207f7ca Remove unused local variables. Now unix/tclUnixTime.c is idential in "androwish" compared to "novem". (Yes, those functions are planned to be removed in Tcl 9.0!) 2015-07-15 09:31:11 +00:00
jan.nijtmans ddc615491d Merge trunk.
Remove TclpLocaltime, TclpGmtime and TclpGetDate completely, in order to prove that those functions are not used anywhere within Tcl any more. They are only retained for the internal stub entries, which might be used by extensions, but androwish doesn't use that.
2015-07-15 09:22:01 +00:00
jan.nijtmans b1031c0d07 merge trunk 2015-07-15 07:52:41 +00:00
jan.nijtmans 83da0d6374 merge trunk 2015-07-02 13:18:19 +00:00
jan.nijtmans e886aae69e merge trunk 2015-07-02 09:18:59 +00:00
jan.nijtmans adceea62b6 Branch for androwish, as help to keep track on which android-specific changes could be included into the core without harm. 2015-06-21 22:29:11 +00:00
jan.nijtmans 348f13ad57 Merge trunk. Upgrade to Unicode 8.0 2015-06-18 13:09:52 +00:00
jan.nijtmans dd60d52814 apply contributed patch which fixes a segfault 2015-01-17 18:40:19 +00:00
jan.nijtmans 428c3163c5 merge trunk 2015-01-17 17:42:53 +00:00
jan.nijtmans 410178bb88 Merge trunk.
Update to Unicode 8 beta
2014-11-14 12:29:54 +00:00
jan.nijtmans 18eed1d727 merge trunk 2014-07-10 14:23:25 +00:00
jan.nijtmans ce72e40607 Merge trunk.
Update Unicode tables to Unicode 7.0 beta.
2014-05-01 09:40:52 +00:00
jan.nijtmans f038b7fc3d merge trunk 2013-06-18 13:46:12 +00:00
jan.nijtmans 30dbc0a75b Update Unicode tables to Unicode 6.3 beta.
Merge trunk
2013-06-10 07:36:47 +00:00
jan.nijtmans 57d33c5027 merge trunk 2013-03-06 13:37:19 +00:00
jan.nijtmans e1c5526cb2 Merge trunk.
Unicode 6.3 does not have that many spaces.....
2013-02-25 16:03:26 +00:00
jan.nijtmans 290c2ef84f Merge trunk.
Upgrade all tables to Unicode 6.3 (not released yet)
2013-02-25 13:38:06 +00:00
jan.nijtmans 073618d375 Merge trunk 2012-09-26 12:00:50 +00:00
jan.nijtmans 5ddf03d324 merge trunk 2012-04-22 20:51:02 +00:00
jan.nijtmans ac98be85ce merge trunk 2012-02-03 21:25:41 +00:00
jan.nijtmans 048fae9de6 merge trunk 2012-01-26 21:58:18 +00:00
jan.nijtmans 81735df1fa merge trunk 2012-01-23 22:19:24 +00:00
jan.nijtmans 9c32ab0d8b Merge to feature branch 2011-10-05 14:23:40 +00:00
jan.nijtmans 861e75f503 Merge to feature branch 2011-09-21 09:03:42 +00:00
jan.nijtmans e891120584 merge to feature branch 2011-09-17 07:19:28 +00:00
jan.nijtmans 2045bb3c21 merge to feature branch 2011-09-16 08:14:27 +00:00
jan.nijtmans a498488c59 Merge to feature branch 2011-08-29 07:44:12 +00:00
jan.nijtmans dd43ee3dbf Merge to feature branch 2011-08-25 12:11:24 +00:00
jan.nijtmans 39ad9eb8f3 fix tests utf-2.8 and utf-2.9 2011-08-24 08:32:39 +00:00
jan.nijtmans b30ba5a92b Upcoming TIP implementation: Full support for Unicode 6.0 2011-08-24 07:50:13 +00:00
13 changed files with 3976 additions and 5 deletions
Executable → Regular
View File
+61
View File
@@ -0,0 +1,61 @@
'\"
'\" Copyright (c) 2015 Jan Nijtmans <jan.nijtmans@gmail.com>
'\" Copyright (c) 2015 Christian Werner <chw@ch-werner.de>
'\"
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
.TH Tclzipfs 3 8.7 Tcl "Tcl Library Procedures"
.so man.macros
.BS
.SH NAME
Tclzipfs_Init, Tclzipfs_SafeInit, Tclzipfs_Mount, Tclzipfs_Unmount \- handle ZIP files as VFS
.SH SYNOPSIS
.nf
\fB#include <tclZipfs.h>\fR
.sp
int
\fBTclzipfs_Init\fR(\fIinterp\fR)
.sp
int
\fBTclzipfs_SafeInit\fR(\fIinterp\fR)
.sp
int
\fBTclzipfs_Mount\fR(\fIinterp, zipname, mntpt, passwd\fR)
.sp
int
\fBTclzipfs_Unmount\fR(\fIinterp, zipname\fR)
.SH ARGUMENTS
.AS Tcl_Interp **termPtr
.AP Tcl_Interp *interp in
Interpreter in which the zip file system is mounted. The interpreter's result is
modified to hold the result or error message from the script.
.AP "const char" *zipname in
Name of a zipfile.
.AP "const char" *mntpt in
Name of a mount point.
.AP "const char" *passwd in
An (optional) password.
.BE
.SH DESCRIPTION
\fBTclzipfs_Init()\fR performs one-time initialization of the file system
and registers it process wide. Additionally, a package named \fIzipfs\fR
is provided and supplemental Tcl commands are created in the given
interpreter \fIinterp\fR.
.PP
\fBTclzipfs_SafeInit()\fR is the version of \fBTclzipfs_Init()\fR for
safe interpreters. It exposes only uncritical supplemental Tcl commands
in the given interpreter \fIinterp\fR.
.PP
\fBTclzipfs_Mount()\fR mount the ZIP archive \fIzipname\fR on the mount
point given in \fImntpt\fR using the optional ZIP password \fIpasswd\fR.
Errors during that process are reported in the interpreter \fIinterp\fR.
If \fIzipname\fR is a NULL pointer, information on all currently mounted
ZIP file systems is written into \fIinterp\fR's result as a sequence of
mount points and ZIP file names.
.PP
\fBTclzipfs_Unmount()\fR undoes the effect of \fBTclzipfs_Mount()\fR,
i.e. it unmounts the mounted ZIP archive file \fIzipname\fR. Errors are
reported in the interpreter \fIinterp\fR.
.SH KEYWORDS
compress, filesystem, zip
+120
View File
@@ -0,0 +1,120 @@
'\"
'\" Copyright (c) 2015 Jan Nijtmans <jan.nijtmans@gmail.com>
'\" Copyright (c) 2015 Christian Werner <chw@ch-werner.de>
'\"
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
.TH zipfs n 1.0 Zipfs "zipfs Commands"
.so man.macros
.BS
'\" Note: do not modify the .SH NAME line immediately below!
.SH NAME
zipfs \- Mount and work with ZIP files within Tcl
.SH SYNOPSIS
.nf
\fBpackage require zipfs \fR?\fB1.0\fR?
.sp
\fBzipfs exists\fR \fIfilename\fR
\fBzipfs find\fR \fIdir\fR
\fBzipfs info\fR \fIfilename\fR
\fBzipfs list\fR \fB?(-glob|-regexp)?\fR \fI?pattern?\fR
\fBzipfs mkimg\fR \fIoutfile\fR \fIindir\fR \fI?strip?\fR \fI?password?\fR \fI?infile?\fR
\fBzipfs mkkey\fR \fIpassword\fR
\fBzipfs mkzip\fR \fIoutfile\fR \fIindir\fR \fI?strip?\fR \fI?password?\fR
\fBzipfs mount\fR \fI?zipfile?\fR \fI?mountpoint?\fR \fI?password?\fR
\fBzipfs unmount\fR \fIzipfile\fR
.fi
.BE
.SH DESCRIPTION
.PP
The \fBzipfs\fR package provides tcl with the ability to mount
the contents of a zip file as a virtual file system.
.TP
\fBzipfs exists\fR \fIfilename\fR
.
Return 1 if the given filename exists in the mounted zipfs and 0 if it does not.
.TP
\fBzipfs find\fR \fIdir\fR
.
Recursively lists files including and below the directory \fIdir\fR.
The result list consists of relative path names starting from the
given directory. This command is also used by the \fBzipfs mkzip\fR
and \fBzipfs mkimg\fR commands.
.TP
\fBzipfs info\fR \fIfile\fR
.
Return information about the given file in the mounted zipfs. The information
consists of (1) the name of the ZIP archive file that contains the file,
(2) the size of the file after decompressions, (3) the compressed size of
the file, and (4) the offset of the compressed data in the ZIP archive file.
.RS
.PP
Note: querying the mount point gives the start of zip data offset in (4),
which can be used to truncate the zip info off an executable.
.RE
.TP
\fBzipfs list\fR \fB?(-glob|-regexp)?\fR \fI?pattern?\fR
.
Return a list of all files in the mounted zipfs. The order of the names
in the list is arbitrary.
.TP
\fBzipfs mkimg\fR \fIoutfile\fR \fIindir\fR \fI?strip?\fR \fI?password?\fR \fI?infile?\fR
.
Creates an image (potentially a new executable file) similar to
\fBzipfs mkzip\fR. If the \fIinfile\fR parameter is specified,
this file is prepended in front of the ZIP archive, otherwise the file
returned by \fBTcl_NameOfExecutable(3)\fR (i.e. the executable file of
the running process) is used. If the \fIpassword\fR parameter is not empty,
an obfuscated version of that password is placed between the image and ZIP
chunks of the output file and the contents of the ZIP chunk are protected
with that password.
.RS
.PP
Caution: highly experimental, not usable on Android, only partially tested
on Linux and Windows.
.RE
.TP
\fBzipfs mkkey\fR \fIpassword\fR
.
For the clear text \fIpassword\fR argument an obfuscated string version
is returned with the same format used in the \fBzipfs mkimg\fR command.
.TP
\fBzipfs mkzip\fR \fIoutfile\fR \fIindir\fR \fI?strip?\fR \fI?password?\fR
.
Creates a ZIP archive file named \fIoutfile\fR from the contents of the input
directory \fIindir\fR (contained regular files only) with optional ZIP
password \fIpassword\fR. While processing the files below \fIindir\fR the
optional file name prefix given in \fIstrip\fR is stripped off the beginning
of the respective file name.
.RS
.PP
Caution: the choice of the \fIindir\fR parameter
(less the optional stripped prefix) determines the later root name of the
archive's content.
.RE
.TP
\fBzipfs mount ?\fIzipfile\fR? ?\fImountpoint\fR? ?\fIpassword\fR?
.
The \fBzipfs mount\fR command mounts a ZIP archive file as a VFS.
After this command executes, files contained in \fIzipfile\fR
will appear to Tcl to be regular files at the mount point.
.RS
.PP
With no \fImountpoint\fR, returns the mount point for \fIzipfile\fR.
With no \fIzipfile\fR, return all zipfile/mount point pairs.
If \fImountpoint\fR is specified as an empty string, the mount point
will be the current directory. If \fIpassword\fR is specified, files from
\fIzipfile\fR are decrypted using this password when read.
.RE
.TP
\fBzipfs unmount \fIzipfile\fR
.
Unmounts a previously mounted ZIP archive file \fIzipfile\fR.
.SH "SEE ALSO"
tclsh(1), file(n), zlib(n)
.SH "KEYWORDS"
compress, filesystem, zip
'\" Local Variables:
'\" mode: nroff
'\" End:
+34
View File
@@ -189,6 +189,8 @@ const Tcl_Filesystem tclNativeFilesystem = {
TclpObjChdir
};
MODULE_SCOPE Tcl_Filesystem zipfsFilesystem;
/*
* Define the tail of the linked list. Note that for unconventional uses of
* Tcl without a native filesystem, we may in the future wish to modify the
@@ -1408,6 +1410,22 @@ TclFSNormalizeToUniquePath(
Claim();
for (fsRecPtr=firstFsRecPtr; fsRecPtr!=NULL; fsRecPtr=fsRecPtr->nextPtr) {
if (fsRecPtr->fsPtr == &zipfsFilesystem) {
ClientData clientData = NULL;
/*
* Allow mounted zipfs filesystem to overtake entire normalisation.
* This is needed on unix for mounts on symlinks right below root.
*/
if (fsRecPtr->fsPtr->pathInFilesystemProc != NULL) {
if (fsRecPtr->fsPtr->pathInFilesystemProc(pathPtr,
&clientData)!=-1) {
TclFSSetPathDetails(pathPtr, fsRecPtr->fsPtr, clientData);
break;
}
}
continue;
}
if (fsRecPtr->fsPtr != &tclNativeFilesystem) {
continue;
}
@@ -1432,6 +1450,9 @@ TclFSNormalizeToUniquePath(
if (fsRecPtr->fsPtr == &tclNativeFilesystem) {
continue;
}
if (fsRecPtr->fsPtr == &zipfsFilesystem) {
continue;
}
if (fsRecPtr->fsPtr->normalizePathProc != NULL) {
startAt = fsRecPtr->fsPtr->normalizePathProc(interp, pathPtr,
@@ -2912,6 +2933,19 @@ Tcl_FSChdir(
}
fsPtr = Tcl_FSGetFileSystemForPath(pathPtr);
if ((fsPtr != NULL) && (fsPtr != &tclNativeFilesystem)) {
/*
* Watch out for tilde substitution.
* Only valid in native filesystem.
*/
char *name = Tcl_GetString(pathPtr);
if ((name != NULL) && (*name == '~')) {
fsPtr = &tclNativeFilesystem;
}
}
if (fsPtr != NULL) {
if (fsPtr->chdirProc != NULL) {
/*
+48
View File
@@ -0,0 +1,48 @@
/*
* tclZipfs.h --
*
* This header file describes the interface of the ZIPFS filesystem
*
* Copyright (c) 2013-2015 Christian Werner <chw@ch-werner.de>
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
#ifndef _ZIPFS_H
#define _ZIPFS_H
#include "tcl.h"
#ifdef __cplusplus
extern "C" {
#endif
#ifndef ZIPFSAPI
# define ZIPFSAPI extern
#endif
#ifdef BUILD_tcl
# undef ZIPFSAPI
# define ZIPFSAPI DLLEXPORT
#endif
ZIPFSAPI int Tclzipfs_Mount(Tcl_Interp *interp, const char *zipname,
const char *mntpt, const char *passwd);
ZIPFSAPI int Tclzipfs_Unmount(Tcl_Interp *interp, const char *zipname);
ZIPFSAPI int Tclzipfs_Init(Tcl_Interp *interp);
ZIPFSAPI int Tclzipfs_SafeInit(Tcl_Interp *interp);
#ifdef __cplusplus
}
#endif
#endif /* _ZIPFS_H */
/*
* Local Variables:
* mode: c
* c-basic-offset: 4
* fill-column: 78
* End:
*/
+131
View File
@@ -0,0 +1,131 @@
/* crypt.h -- base code for crypt/uncrypt ZIPfile
Version 1.01e, February 12th, 2005
Copyright (C) 1998-2005 Gilles Vollant
This code is a modified version of crypting code in Infozip distribution
The encryption/decryption parts of this source code (as opposed to the
non-echoing password parts) were originally written in Europe. The
whole source package can be freely distributed, including from the USA.
(Prior to January 2000, re-export from the US was a violation of US law.)
This encryption code is a direct transcription of the algorithm from
Roger Schlafly, described by Phil Katz in the file appnote.txt. This
file (appnote.txt) is distributed with the PKZIP program (even in the
version without encryption capabilities).
If you don't need crypting in your application, just define symbols
NOCRYPT and NOUNCRYPT.
This code support the "Traditional PKWARE Encryption".
The new AES encryption added on Zip format by Winzip (see the page
http://www.winzip.com/aes_info.htm ) and PKWare PKZip 5.x Strong
Encryption is not supported.
*/
#define CRC32(c, b) ((*(pcrc_32_tab+(((int)(c) ^ (b)) & 0xff))) ^ ((c) >> 8))
/***********************************************************************
* Return the next byte in the pseudo-random sequence
*/
static int decrypt_byte(unsigned long* pkeys, const unsigned int* pcrc_32_tab)
{
unsigned temp; /* POTENTIAL BUG: temp*(temp^1) may overflow in an
* unpredictable manner on 16-bit systems; not a problem
* with any known compiler so far, though */
temp = ((unsigned)(*(pkeys+2)) & 0xffff) | 2;
return (int)(((temp * (temp ^ 1)) >> 8) & 0xff);
}
/***********************************************************************
* Update the encryption keys with the next byte of plain text
*/
static int update_keys(unsigned long* pkeys,const unsigned int* pcrc_32_tab,int c)
{
(*(pkeys+0)) = CRC32((*(pkeys+0)), c);
(*(pkeys+1)) += (*(pkeys+0)) & 0xff;
(*(pkeys+1)) = (*(pkeys+1)) * 134775813L + 1;
{
register int keyshift = (int)((*(pkeys+1)) >> 24);
(*(pkeys+2)) = CRC32((*(pkeys+2)), keyshift);
}
return c;
}
/***********************************************************************
* Initialize the encryption keys and the random header according to
* the given password.
*/
static void init_keys(const char* passwd,unsigned long* pkeys,const unsigned int* pcrc_32_tab)
{
*(pkeys+0) = 305419896L;
*(pkeys+1) = 591751049L;
*(pkeys+2) = 878082192L;
while (*passwd != '\0') {
update_keys(pkeys,pcrc_32_tab,(int)*passwd);
passwd++;
}
}
#define zdecode(pkeys,pcrc_32_tab,c) \
(update_keys(pkeys,pcrc_32_tab,c ^= decrypt_byte(pkeys,pcrc_32_tab)))
#define zencode(pkeys,pcrc_32_tab,c,t) \
(t=decrypt_byte(pkeys,pcrc_32_tab), update_keys(pkeys,pcrc_32_tab,c), t^(c))
#ifdef INCLUDECRYPTINGCODE_IFCRYPTALLOWED
#define RAND_HEAD_LEN 12
/* "last resort" source for second part of crypt seed pattern */
# ifndef ZCR_SEED2
# define ZCR_SEED2 3141592654UL /* use PI as default pattern */
# endif
static int crypthead(const char* passwd, /* password string */
unsigned char* buf, /* where to write header */
int bufSize,
unsigned long* pkeys,
const unsigned int* pcrc_32_tab,
unsigned long crcForCrypting)
{
int n; /* index in random header */
int t; /* temporary */
int c; /* random byte */
unsigned char header[RAND_HEAD_LEN-2]; /* random header */
static unsigned calls = 0; /* ensure different random header each time */
if (bufSize<RAND_HEAD_LEN)
return 0;
/* First generate RAND_HEAD_LEN-2 random bytes. We encrypt the
* output of rand() to get less predictability, since rand() is
* often poorly implemented.
*/
if (++calls == 1)
{
srand((unsigned)(time(NULL) ^ ZCR_SEED2));
}
init_keys(passwd, pkeys, pcrc_32_tab);
for (n = 0; n < RAND_HEAD_LEN-2; n++)
{
c = (rand() >> 7) & 0xff;
header[n] = (unsigned char)zencode(pkeys, pcrc_32_tab, c, t);
}
/* Encrypt random header (last two bytes is high word of crc) */
init_keys(passwd, pkeys, pcrc_32_tab);
for (n = 0; n < RAND_HEAD_LEN-2; n++)
{
buf[n] = (unsigned char)zencode(pkeys, pcrc_32_tab, header[n], t);
}
buf[n++] = (unsigned char)zencode(pkeys, pcrc_32_tab, (int)(crcForCrypting >> 16) & 0xff, t);
buf[n++] = (unsigned char)zencode(pkeys, pcrc_32_tab, (int)(crcForCrypting >> 24) & 0xff, t);
return n;
}
#endif
+3437
View File
File diff suppressed because it is too large Load Diff
+117
View File
@@ -0,0 +1,117 @@
# The file tests the tclZlib.c file.
#
# This file contains a collection of tests for one or more of the Tcl built-in
# commands. Sourcing this file into Tcl runs the tests and generates output
# for errors. No output means no errors were found.
#
# Copyright (c) 1996-1998 by Sun Microsystems, Inc.
# Copyright (c) 1998-1999 by Scriptics Corporation.
#
# See the file "license.terms" for information on usage and redistribution of
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
if {"::tcltest" ni [namespace children]} {
package require tcltest 2.1
namespace import -force ::tcltest::*
}
testConstraint zipfs [expr {[llength [info commands zlib]] && [regexp tcltest [info nameofexecutable]]}]
test zipfs-1.1 {zipfs basics} -constraints zipfs -body {
load {} zipfs
} -result {}
test zipfs-1.2 {zipfs basics} -constraints zipfs -body {
package require zipfs
} -result {1.0}
test zipfs-1.3 {zipfs basics} -constraints zipfs -returnCodes error -body {
zipfs mount a b c d e f
} -result {wrong # args: should be "zipfs mount ?zipfile? ?mountpoint? ?password?"}
test zipfs-1.4 {zipfs basics} -constraints zipfs -returnCodes error -body {
zipfs unmount a b c d e f
} -result {wrong # args: should be "zipfs unmount zipfile"}
test zipfs-1.5 {zipfs basics} -constraints zipfs -returnCodes error -body {
zipfs mkkey a b c d e f
} -result {wrong # args: should be "zipfs mkkey password"}
test zipfs-1.6 {zipfs basics} -constraints zipfs -returnCodes error -body {
zipfs mkimg a b c d e f
} -result {wrong # args: should be "zipfs mkimg outfile indir ?strip? ?password? ?infile?"}
test zipfs-1.7 {zipfs basics} -constraints zipfs -returnCodes error -body {
zipfs mkzip a b c d e f
} -result {wrong # args: should be "zipfs mkzip outfile indir ?strip? ?password?"}
test zipfs-1.8 {zipfs basics} -constraints zipfs -returnCodes error -body {
zipfs exists a b c d e f
} -result {wrong # args: should be "zipfs exists filename"}
test zipfs-1.9 {zipfs basics} -constraints zipfs -returnCodes error -body {
zipfs info a b c d e f
} -result {wrong # args: should be "zipfs info filename"}
test zipfs-1.10 {zipfs basics} -constraints zipfs -returnCodes error -body {
zipfs list a b c d e f
} -result {wrong # args: should be "zipfs list ?(-glob|-regexp)? ?pattern?"}
test zipfs-2.1 {zipfs mkzip empty archive} -constraints zipfs -returnCodes error -body {
zipfs mkzip abc.zip [file join [file normalize $tcl_library] xxxx]
} -result {empty archive}
test zipfs-2.2 {zipfs mkzip} -constraints zipfs -body {
set pwd [pwd]
cd [file join [file normalize $tcl_library] encoding]
zipfs mkzip abc.zip .
zipfs mount abc.zip /abc
zipfs list -glob /abc/cp850.*
} -cleanup {
cd $pwd
} -result {/abc/cp850.enc}
test zipfs-2.3 {zipfs unmount} -constraints zipfs -body {
lrange [zipfs info /abc/cp850.enc] 0 2
} -result [list \
[file join [file normalize $tcl_library] encoding abc.zip] 1090 527]
test zipfs-2.4 {zipfs unmount} -constraints zipfs -body {
set f [open /abc/cp850.enc]
read $f
} -result {# Encoding file: cp850, single-byte
S
003F 0 1
00
0000000100020003000400050006000700080009000A000B000C000D000E000F
0010001100120013001400150016001700180019001A001B001C001D001E001F
0020002100220023002400250026002700280029002A002B002C002D002E002F
0030003100320033003400350036003700380039003A003B003C003D003E003F
0040004100420043004400450046004700480049004A004B004C004D004E004F
0050005100520053005400550056005700580059005A005B005C005D005E005F
0060006100620063006400650066006700680069006A006B006C006D006E006F
0070007100720073007400750076007700780079007A007B007C007D007E007F
00C700FC00E900E200E400E000E500E700EA00EB00E800EF00EE00EC00C400C5
00C900E600C600F400F600F200FB00F900FF00D600DC00F800A300D800D70192
00E100ED00F300FA00F100D100AA00BA00BF00AE00AC00BD00BC00A100AB00BB
2591259225932502252400C100C200C000A9256325512557255D00A200A52510
25142534252C251C2500253C00E300C3255A25542569256625602550256C00A4
00F000D000CA00CB00C8013100CD00CE00CF2518250C2588258400A600CC2580
00D300DF00D400D200F500D500B500FE00DE00DA00DB00D900FD00DD00AF00B4
00AD00B1201700BE00B600A700F700B800B000A800B700B900B300B225A000A0
}
test zipfs-2.5 {zipfs exists} -constraints zipfs -body {
zipfs unmount abc.zip
zipfs exists /abc/cp850.enc
} -cleanup {
file delete abc.zip
} -result 1
::tcltest::cleanupTests
return
# Local Variables:
# mode: tcl
# End:
+8 -2
View File
@@ -310,7 +310,7 @@ GENERIC_OBJS = regcomp.o regexec.o regfree.o regerror.o tclAlloc.o \
tclStrToD.o tclThread.o \
tclThreadAlloc.o tclThreadJoin.o tclThreadStorage.o tclStubInit.o \
tclTimer.o tclTrace.o tclUtf.o tclUtil.o tclVar.o tclZlib.o \
tclTomMathInterface.o
tclTomMathInterface.o zipfs.o
OO_OBJS = tclOO.o tclOOBasic.o tclOOCall.o tclOODefineCmds.o tclOOInfo.o \
tclOOMethod.o tclOOStubInit.o
@@ -375,6 +375,7 @@ GENERIC_HDRS = \
$(GENERIC_DIR)/tclInt.h \
$(GENERIC_DIR)/tclIntDecls.h \
$(GENERIC_DIR)/tclIntPlatDecls.h \
$(GENERIC_DIR)/tclZipfs.h \
$(GENERIC_DIR)/tclTomMath.h \
$(GENERIC_DIR)/tclTomMathDecls.h \
$(GENERIC_DIR)/tclOO.h \
@@ -465,7 +466,8 @@ GENERIC_SRCS = \
$(GENERIC_DIR)/tclUtil.c \
$(GENERIC_DIR)/tclVar.c \
$(GENERIC_DIR)/tclAssembly.c \
$(GENERIC_DIR)/tclZlib.c
$(GENERIC_DIR)/tclZlib.c \
$(GENERIC_DIR)/zipfs.c
OO_SRCS = \
$(GENERIC_DIR)/tclOO.c \
@@ -954,6 +956,7 @@ install-headers:
@for i in $(GENERIC_DIR)/tcl.h $(GENERIC_DIR)/tclDecls.h \
$(GENERIC_DIR)/tclOO.h $(GENERIC_DIR)/tclOODecls.h \
$(GENERIC_DIR)/tclPlatDecls.h \
$(GENERIC_DIR)/tclZipfs.h \
$(GENERIC_DIR)/tclTomMath.h \
$(GENERIC_DIR)/tclTomMathDecls.h ; \
do \
@@ -1323,6 +1326,9 @@ tclVar.o: $(GENERIC_DIR)/tclVar.c
tclZlib.o: $(GENERIC_DIR)/tclZlib.c
$(CC) -c $(CC_SWITCHES) $(ZLIB_INCLUDE) $(GENERIC_DIR)/tclZlib.c
zipfs.o: $(GENERIC_DIR)/zipfs.c
$(CC) -c $(CC_SWITCHES) $(ZLIB_INCLUDE) $(GENERIC_DIR)/zipfs.c
tclTest.o: $(GENERIC_DIR)/tclTest.c $(IOHDR) $(TCLREHDRS)
$(CC) -c $(APP_CC_SWITCHES) $(GENERIC_DIR)/tclTest.c
+5
View File
@@ -17,6 +17,7 @@
#include "tcl.h"
#ifdef TCL_TEST
#include "tclZipfs.h"
extern Tcl_PackageInitProc Tcltest_Init;
extern Tcl_PackageInitProc Tcltest_SafeInit;
#endif /* TCL_TEST */
@@ -123,6 +124,10 @@ Tcl_AppInit(
return TCL_ERROR;
}
Tcl_StaticPackage(interp, "Tcltest", Tcltest_Init, Tcltest_SafeInit);
if (Tclzipfs_Init(interp) == TCL_ERROR) {
return TCL_ERROR;
}
Tcl_StaticPackage(interp, "zipfs", Tclzipfs_Init, Tclzipfs_SafeInit);
#endif /* TCL_TEST */
/*
+4 -2
View File
@@ -302,7 +302,8 @@ GENERIC_OBJS = \
tclUtf.$(OBJEXT) \
tclUtil.$(OBJEXT) \
tclVar.$(OBJEXT) \
tclZlib.$(OBJEXT)
tclZlib.$(OBJEXT) \
zipfs.$(OBJEXT)
TOMMATH_OBJS = \
bncore.${OBJEXT} \
@@ -635,6 +636,7 @@ install-libraries: libraries install-tzdata install-msgs
@echo "Installing header files";
@for i in "$(GENERIC_DIR)/tcl.h" "$(GENERIC_DIR)/tclDecls.h" \
"$(GENERIC_DIR)/tclOO.h" "$(GENERIC_DIR)/tclOODecls.h" \
"$(GENERIC_DIR)/tclZipfs.h" \
"$(GENERIC_DIR)/tclPlatDecls.h" \
"$(GENERIC_DIR)/tclTomMath.h" \
"$(GENERIC_DIR)/tclTomMathDecls.h"; \
@@ -749,7 +751,7 @@ clean: cleanhelp clean-packages
distclean: distclean-packages clean
$(RM) Makefile config.status config.cache config.log tclConfig.sh \
tcl.hpj config.status.lineno
tcl.hpj config.status.lineno tclsh.exe.manifest
#
# Bundled package targets
+6 -1
View File
@@ -235,7 +235,8 @@ COREOBJS = \
$(TMP_DIR)\tclUtf.obj \
$(TMP_DIR)\tclUtil.obj \
$(TMP_DIR)\tclVar.obj \
$(TMP_DIR)\tclZlib.obj
$(TMP_DIR)\tclZlib.obj \
$(TMP_DIR)\zipfs.obj
ZLIBOBJS = \
$(TMP_DIR)\adler32.obj \
@@ -683,6 +684,9 @@ $(TMP_DIR)\tclWinTest.obj: $(WINDIR)\tclWinTest.c
$(TMP_DIR)\tclZlib.obj: $(GENERICDIR)\tclZlib.c
$(cc32) $(pkgcflags) -I$(COMPATDIR)\zlib -Fo$@ $?
$(TMP_DIR)\zipfs.obj: $(GENERICDIR)\zipfs.c
$(cc32) $(TCL_CFLAGS) -I$(COMPATDIR)\zlib -DBUILD_tcl -Fo$@ $?
$(TMP_DIR)\tclPkgConfig.obj: $(GENERICDIR)\tclPkgConfig.c
$(cc32) $(pkgcflags) \
-DCFG_INSTALL_LIBDIR="\"$(LIB_INSTALL_DIR:\=\\)\"" \
@@ -832,6 +836,7 @@ install-libraries: tclConfig tcl-nmake install-msgs install-tzdata
@$(CPY) "$(GENERICDIR)\tclDecls.h" "$(INCLUDE_INSTALL_DIR)\"
@$(CPY) "$(GENERICDIR)\tclOO.h" "$(INCLUDE_INSTALL_DIR)\"
@$(CPY) "$(GENERICDIR)\tclOODecls.h" "$(INCLUDE_INSTALL_DIR)\"
@$(CPY) "$(GENERICDIR)\tclZipfs.h" "$(INCLUDE_INSTALL_DIR)\"
@$(CPY) "$(GENERICDIR)\tclPlatDecls.h" "$(INCLUDE_INSTALL_DIR)\"
@$(CPY) "$(GENERICDIR)\tclTomMath.h" "$(INCLUDE_INSTALL_DIR)\"
@$(CPY) "$(GENERICDIR)\tclTomMathDecls.h" "$(INCLUDE_INSTALL_DIR)\"
+5
View File
@@ -25,6 +25,7 @@
#include <tchar.h>
#ifdef TCL_TEST
#include "tclZipfs.h"
extern Tcl_PackageInitProc Tcltest_Init;
extern Tcl_PackageInitProc Tcltest_SafeInit;
#endif /* TCL_TEST */
@@ -176,6 +177,10 @@ Tcl_AppInit(
return TCL_ERROR;
}
Tcl_StaticPackage(interp, "Tcltest", Tcltest_Init, Tcltest_SafeInit);
if (Tclzipfs_Init(interp) == TCL_ERROR) {
return TCL_ERROR;
}
Tcl_StaticPackage(interp, "zipfs", Tclzipfs_Init, Tclzipfs_SafeInit);
#endif /* TCL_TEST */
/*