fdcc3d60ec7c0a4dfa2feec32a1a28d1724b6258
2 # zoneinfo2lua.pl - Make Lua module from /usr/share/zoneinfo
3 # Execute from within /usr/share/zoneinfo
11 open( ZTAB
, "< ./zone.tab" ) || die "Unable to open zone.tab: $!";
14 chomp( my $line = readline ZTAB
);
15 next if $line =~ /^#/ || $line =~ /^\s+$/;
17 my ( undef, undef, $zone, @comment ) = split /\s+/, $line;
19 printf STDERR
"%-40s", $zone;
21 if( open ZONE
, "< ./$zone" ) {
24 while( tell(ZONE
) > 0 ) {
25 read ZONE
, my $char, 1;
26 ( $char eq "\012" ) ?
last : seek ZONE
, -2, 1;
29 chomp( my $tz = readline ZONE
);
30 print STDERR
( $tz || "(no tzinfo found)" ), "\n";
40 print STDERR
"Unable to open $zone: $!\n";
49 LuCI - Autogenerated Zoneinfo Module
51 Licensed under the Apache License, Version 2.0 (the "License");
52 you may not use this file except in compliance with the License.
53 You may obtain a copy of the License at
55 http://www.apache.org/licenses/LICENSE-2.0
59 module "luci.sys.zoneinfo"
64 foreach my $zone ( sort keys %TZ ) {
65 printf "\t{ '%s', '%s' },\n", $zone, $TZ{$zone}