Tclrar -- A Tcl extension for extracting rar archives

$Id: index.html,v 1.2 2004/05/16 22:58:43 cniemira Exp $


Overview

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.

Features

Tclrar is released under a BSD-Style OpenSource license.

Requirements

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.

Current Version

The current version of Tclrar is 0.1, and it is built against Unrar version 3.3.6.

Building

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

Reference

rar::extract

Synopsis

rar::extract file desination

Description

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.

Example

rar::extract /home/siege/archive_data/bigdataset.r01 /tmp

rar::setBusyProc

Synopsis

rar::setBusyProc proc

Description

Set a callback procedure for commands to send output to. This is a procedure which take a single string as an arguement.

Example

rar::setBusyProc puts

Examples

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]"

To Do

The to-do list isn't short. The library has barely any functionality to it at all, little error handling capacity, and no robustness.


SourceForge.net Logo