#!/usr/bin/env tclkit # Create a clean/empty wiki from one which has been filled with pages. # This does not delete pages 0..9, but these can be changed afterwards. # # 2001-10-11, jcw if {[llength $argv] != 2} { puts stderr "Usage: $argv0 infile outfile" exit 1 } # note: the datafile is opened read-only, so changes # cannot be commited back to the datafile itself mk::file open db [lindex $argv 0] -readonly # remove (almost) all data from several MetaKit views mk::view size db.pages 10 mk::view size db.archive 0 mk::view size db.admin 0 # because the wiki is a scripted document, care must be # taken to keep the 256-byte file prefix intact set ifd [open [lindex $argv 0]] fconfigure $ifd -translation binary -encoding binary set header [read $ifd 256] close $ifd # save what remains of the MK data in optimally packed format set ofd [open [lindex $argv 1] w] fconfigure $ofd -translation binary -encoding binary puts -nonewline $ofd $header mk::file save db $ofd close $ofd exit