+# Process the status to arrive at a "last" status
+if ($opt_last) {
+ for $host (sort keys %disks) {
+ for $disk (sort keys %{$disks{$host}}) {
+ $level{$host}{$disk}{"0000-LA-ST"} = '';
+ for $date (sort keys %dates) {
+ if ($level{$host}{$disk}{$date} eq "E"
+ && $level{$host}{$disk}{"0000-LA-ST"} =~ /^\d/ ) {
+ $level{$host}{$disk}{"0000-LA-ST"} .= $level{$host}{$disk}{$date};
+ } elsif ($level{$host}{$disk}{$date} eq "") {
+ $level{$host}{$disk}{"0000-LA-ST"} =~ s/E//;
+ } else {
+ $level{$host}{$disk}{"0000-LA-ST"} = $level{$host}{$disk}{$date};
+ }
+ }
+ }
+ }
+}
+
+# Number of level 0 backups
+if ($opt_num0) {
+ for $host (sort keys %disks) {
+ for $disk (sort keys %{$disks{$host}}) {
+ $level{$host}{$disk}{'0000-NM-L0'} = 0;
+ for $date (sort keys %dates) {
+ if ($level{$host}{$disk}{$date} =~ /0/) {
+ $level{$host}{$disk}{'0000-NM-L0'} += 1;
+ }
+ }
+ }
+ }
+}
+
+# Runs to the last level 0
+if ($opt_togo0) {
+ for $host (sort keys %disks) {
+ for $disk (sort keys %{$disks{$host}}) {
+ $level{$host}{$disk}{'0000-TO-GO'} = 0;
+ my $togo=0;
+ for $date (sort keys %dates) {
+ if ($level{$host}{$disk}{$date} =~ /0/) {
+ $level{$host}{$disk}{'0000-TO-GO'} = $togo;
+ }
+ $togo++;
+ }
+ }
+ }
+}
+
+unless ($opt_skipmissed)