Browse Source

make state loading in showstate() similar to ckstate()

Oswald Buddenhagen 11 years ago
parent
commit
83bb1cf716
1 changed files with 6 additions and 8 deletions
  1. 6 8
      src/run-tests.pl

+ 6 - 8
src/run-tests.pl

@@ -362,34 +362,32 @@ sub showstate($)
 		print STDERR " Cannot read sync state $fn: $!\n";
 		print STDERR " Cannot read sync state $fn: $!\n";
 		return;
 		return;
 	}
 	}
-	$_ = <FILE>;
+	chomp(my @ls = <FILE>);
+	close FILE;
+	$_ = shift(@ls);
 	if (!defined $_) {
 	if (!defined $_) {
 		print STDERR " Missing sync state header.\n";
 		print STDERR " Missing sync state header.\n";
-		close FILE;
 		return;
 		return;
 	}
 	}
-	if (!/^1:(\d+) 1:(\d+):(\d+)\n$/) {
-		chomp;
+	if (!/^1:(\d+) 1:(\d+):(\d+)$/) {
 		print STDERR " Malformed sync state header '$_'.\n";
 		print STDERR " Malformed sync state header '$_'.\n";
-		close FILE;
 		return;
 		return;
 	}
 	}
 	print " [ $1, $2, $3,\n   ";
 	print " [ $1, $2, $3,\n   ";
 	my $frst = 1;
 	my $frst = 1;
-	for (<FILE>) {
+	for (@ls) {
 		if ($frst) {
 		if ($frst) {
 			$frst = 0;
 			$frst = 0;
 		} else {
 		} else {
 			print ", ";
 			print ", ";
 		}
 		}
-		if (!/^(-?\d+) (-?\d+) (.*)\n$/) {
+		if (!/^(-?\d+) (-?\d+) (.*)$/) {
 			print "??, ??, \"??\"";
 			print "??, ??, \"??\"";
 		} else {
 		} else {
 			print "$1, $2, \"$3\"";
 			print "$1, $2, \"$3\"";
 		}
 		}
 	}
 	}
 	print " ],\n";
 	print " ],\n";
-	close FILE;
 }
 }
 
 
 # $filename
 # $filename