#!/s/std/bin/perl -w

# This script takes a list of simics checkpoint configurations and
# then verifies that all of the ".check" files are present.

# Milo M. K. Martin - Jan 14, 2001

# This should also check for .image and checkpoints that are not being
# referenced by an existing checkpoint... do this with the simlinks in
# /p/multifacet/simics/checkpoints and images

foreach $filename (@ARGV) {
    print "$filename\n";

    open(CHECKPOINT, $filename) || die "Error: file not found: $filename";
    @file = <CHECKPOINT>;
    $text = join(" ", @file);
    @checks = sort grep(/\.check/, split(/\"/,$text));
    @images = sort grep(/\.image/, split(/\"/,$text));
    
    foreach $i ((@checks,@images)) {
        if (-e $i) {
#                print "  OK: $i\n";
        } else {
            
            print "  NOT FOUND: $i\n";
        }
    }
}
