$Id: index.html,v 1.2 2004/05/16 22:58:43 cniemira Exp $
Tclrar is a Tcl extension which brings unrar functionality to Tcl via the incorporation of the freeware unrar library provided by the folks at rarlabs. It imports the rar:: namespace, and adds new commands to your interpreter.
Tclrar is released under a BSD-Style OpenSource license.
To use: Tclrar requires Tcl version 8.0+. It has been tested on Solaris, Windows, and Linux. In theory, it should work anywhere that Tcl and unrar work.
To build: You need the unrar source code (tclrar is distributed as a patch file which is applied to this source) and a C compiler. It has been tested with gcc on Solaris and Linux, and msys on Windows.
The current version of Tclrar is 0.1, and it is built against Unrar version 3.3.6.
This should work as-is under Linux. Under Windows, or other OS's, you'll probably need to edit your Makefile.
$ tar zxf unrarsrc-3.3.6.tar.gz $ patch -p0 < patch_unrar-tclrar patching file unrar/consio.hpp patching file unrar/dll.hpp patching file unrar/extract.cpp patching file unrar/license.txt patching file unrar/list.cpp patching file unrar/Makefile patching file unrar/rdwrfn.cpp patching file unrar/tclrar.cpp patching file unrar/tclrar.hpp patching file unrar/version.hpp patching file unrar/volume.cpp $ cd unrar $ make $ tclsh % pkg_mkIndex . % lappend auto_path . /usr/lib/tcl8.4 /usr/lib . % package require tclrar 3.30.0.01
rar::extract file desination
The extract command is used to extract the contents of a given rar archive file into a given desitnation directory. Both arguements are mandatory, and a callback procedure must have been set with setBusyProc.
rar::extract /home/siege/archive_data/bigdataset.r01 /tmp
rar::setBusyProc proc
Set a callback procedure for commands to send output to. This is a procedure which take a single string as an arguement.
rar::setBusyProc puts
Just about the only thing you can do (right now) is:
package require tclrar proc callback {msg} { variable used if [regexp -line {Reading (.+)$} $msg all rarout] { lappend used [lindex $rarout 0] } } rar::setBusyProc callback rar::extract "/tmp/somearchive.01.rar" "/tmp/explode" puts "Rar used the following files:\n[join {, } $used]"
The to-do list isn't short. The library has barely any functionality to it at all, little error handling capacity, and no robustness.