summaryrefslogtreecommitdiff
path: root/core/settings/citytime/findvalidzones
blob: f9e8b5b0b18b8b1a40e3c0d93d058f6bdece38ca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/usr/bin/perl

# A Little utility to help tidy up messy zoneinfo directories.

use File::Find;

find sub {
    if ( -f $_ ) {
	my $a;
	open T, $_;
	read T, $a, 4;
	if ( $a eq "TZif" ) {
	    my $d="$File::Find::dir/$_";
	    $d =~ s/^.\///;
	    $D{$d}=1;
	}
	close T;
    }
}, ".";

open Z, "zone.tab" || die;

while (<Z>) {
    next if /^#/;
    if ( ($cc, $north, $east, $z, $comment) = 
	$_ =~ /^(\S\S)\s+([+-]\d+)([+-]\d+)\s+(\S+)\s*(\S*)/ )
    {
	$Z{$z}=1;
    }
}

for $d ( sort keys %D ) {
    print "rm $d\n" if !$Z{$d};
}

for $z ( sort keys %Z ) {
    print "zone $z, but no such file\n" if !$D{$z};
}