diff --git a/gdbcompare b/gdbcompare index 1cfdcd7..dff7bb0 100755 --- a/gdbcompare +++ b/gdbcompare @@ -1,11 +1,12 @@ #! /usr/bin/perl -# $Id: gdbcompare,v 1.1 2006/12/12 22:56:16 jkratoch Exp $ +# $Id: gdbcompare,v 1.2 2007/01/07 22:47:44 jkratoch Exp $ use strict; use warnings; use Data::Dumper; +my $reverse=shift @ARGV if ($ARGV[0]||"") eq "-r"; my $suffix=shift @ARGV if ($ARGV[0]||"")=~/^(?:sum|log)$/; $suffix||="sum"; @@ -26,7 +27,7 @@ system("rm -f tests/gdbcompare-*.diff") and die; for my $arch (sort keys(%arch)) { sub trans { return {"."=>0,"-"=>1}->{($_[0]=~/([-.])[^-.]+[.]\w+$/)[0]}.$_[0]; }; - my @sorted=sort { my $a1=trans $a; my $b1=trans $b; $b1 cmp $a1; } @{$arch{$arch}}; + my @sorted=sort { my $a1=trans $a; my $b1=trans $b; ($b1 cmp $a1) * ($reverse ? -1 : 1); } @{$arch{$arch}}; do { system $_ and die $_; } for "diff -u tests/'".$sorted[1]."' tests/'".$sorted[0]."' >tests/gdbcompare-'$arch'.diff;true"; }