make state loading in showstate() similar to ckstate()
This commit is contained in:
parent
f044adbfa4
commit
83bb1cf716
|
@ -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$/) {
|
if (!/^1:(\d+) 1:(\d+):(\d+)$/) {
|
||||||
chomp;
|
|
||||||
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
|
||||||
|
|
Loading…
Reference in New Issue
Block a user