[MINC-development] Re: reviews are a lottery

Steve ROBBINS minc-development@bic.mni.mcgill.ca
Tue, 3 Dec 2002 23:40:04 -0500


On Tue, Dec 03, 2002 at 06:07:09PM +1000, Andrew Janke wrote:

> Let us know if this version behaves itself as you think it should, if not I'm
> happy to make changes to bring it inline with whatever you have already.

Keen!  The new version does what I expected for both my test cases.  ;-)

By the way I also snarfed your version of "minchistory" and munged it almost
beyond recognition, introducing a dependency on Text::Format along the way ...


-S

#!/usr/bin/env perl
#
# Andrew Janke - rotor@cmr.uq.edu.au
# Simple script to dump history information from a minc file
#
# Thu Feb  3 14:00:26 EST 2000 - initial version
# Wed Oct 18 10:01:17 EST 2000 - rewrite and removed -clobber ommision
# Tue Dec  3 23:38:15 EST 2002 - rewritten to pretty-print entries <smr>

use Text::Format;

chomp($me = `basename $0`);
if ($#ARGV < 0)  { die "Usage: $me <file.mnc>\n";         }


$text = new Text::Format( firstIndent => 0,
			  bodyIndent => 5,
			  columns => 78 );


foreach (@ARGV) { process_file($_); }



sub process_file {
    my $fname = shift;

    if (!-e $fname){
	warn "$me: Couldn't find $fname\n"; return;
    }

    print "--- History of $fname ---\n\n";

    $counter = 1;
    foreach (`mincinfo -attvalue :history $fname`){
	chomp;
	next if $_ eq '';
	printf "[%02d] ", $counter ++;
	print $text->format($_);
    }
    print "\n";
}