From 83bb1cf716d5f44b773b952aa789aadac04171b2 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Sat, 16 Nov 2013 13:21:45 +0100 Subject: [PATCH] make state loading in showstate() similar to ckstate() --- src/run-tests.pl | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/run-tests.pl b/src/run-tests.pl index 5e72c87..10bca9c 100755 --- a/src/run-tests.pl +++ b/src/run-tests.pl @@ -362,34 +362,32 @@ sub showstate($) print STDERR " Cannot read sync state $fn: $!\n"; return; } - $_ = ; + chomp(my @ls = ); + close FILE; + $_ = shift(@ls); if (!defined $_) { print STDERR " Missing sync state header.\n"; - close FILE; return; } - if (!/^1:(\d+) 1:(\d+):(\d+)\n$/) { - chomp; + if (!/^1:(\d+) 1:(\d+):(\d+)$/) { print STDERR " Malformed sync state header '$_'.\n"; - close FILE; return; } print " [ $1, $2, $3,\n "; my $frst = 1; - for () { + for (@ls) { if ($frst) { $frst = 0; } else { print ", "; } - if (!/^(-?\d+) (-?\d+) (.*)\n$/) { + if (!/^(-?\d+) (-?\d+) (.*)$/) { print "??, ??, \"??\""; } else { print "$1, $2, \"$3\""; } } print " ],\n"; - close FILE; } # $filename