#!/usr/local/bin/tclsh
# -*- tcl -*-
# check the manifest against the current contents of the directory

set manifest [lindex $argv 0]

rename file ori_file
proc   file {name} {
    global files
    set    files($name) 1
    if {! [ori_file exists $name]} {
	puts stdout "missing: $name"
    }
}

# read manifest and check existence of all listed files
source $manifest


# now backwards: find all files and check
# for files not listed in the manifest

set list [exec find . -print]
regsub -all "\n" $list { } list

foreach f $list {
    if {[catch {set files($f)}]} {
	puts stdout "new:     $f"
    }
}
