author | kergoth <kergoth> | 2002-01-25 22:14:26 (UTC) |
---|---|---|
committer | kergoth <kergoth> | 2002-01-25 22:14:26 (UTC) |
commit | 15318cad33835e4e2dc620d033e43cd930676cdd (patch) (unidiff) | |
tree | c2fa0399a2c47fda8e2cd0092c73a809d17f68eb /core/settings/citytime/findvalidzones | |
download | opie-15318cad33835e4e2dc620d033e43cd930676cdd.zip opie-15318cad33835e4e2dc620d033e43cd930676cdd.tar.gz opie-15318cad33835e4e2dc620d033e43cd930676cdd.tar.bz2 |
Initial revision
Diffstat (limited to 'core/settings/citytime/findvalidzones') (more/less context) (ignore whitespace changes)
-rwxr-xr-x | core/settings/citytime/findvalidzones | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/core/settings/citytime/findvalidzones b/core/settings/citytime/findvalidzones new file mode 100755 index 0000000..f9e8b5b --- a/dev/null +++ b/core/settings/citytime/findvalidzones | |||
@@ -0,0 +1,38 @@ | |||
1 | #!/usr/bin/perl | ||
2 | |||
3 | # A Little utility to help tidy up messy zoneinfo directories. | ||
4 | |||
5 | use File::Find; | ||
6 | |||
7 | find sub { | ||
8 | if ( -f $_ ) { | ||
9 | my $a; | ||
10 | open T, $_; | ||
11 | read T, $a, 4; | ||
12 | if ( $a eq "TZif" ) { | ||
13 | my $d="$File::Find::dir/$_"; | ||
14 | $d =~ s/^.\///; | ||
15 | $D{$d}=1; | ||
16 | } | ||
17 | close T; | ||
18 | } | ||
19 | }, "."; | ||
20 | |||
21 | open Z, "zone.tab" || die; | ||
22 | |||
23 | while (<Z>) { | ||
24 | next if /^#/; | ||
25 | if ( ($cc, $north, $east, $z, $comment) = | ||
26 | $_ =~ /^(\S\S)\s+([+-]\d+)([+-]\d+)\s+(\S+)\s*(\S*)/ ) | ||
27 | { | ||
28 | $Z{$z}=1; | ||
29 | } | ||
30 | } | ||
31 | |||
32 | for $d ( sort keys %D ) { | ||
33 | print "rm $d\n" if !$Z{$d}; | ||
34 | } | ||
35 | |||
36 | for $z ( sort keys %Z ) { | ||
37 | print "zone $z, but no such file\n" if !$D{$z}; | ||
38 | } | ||