1
0
mirror of https://frontier.innolan.net/rainlance/amiga-tz.git synced 2025-11-19 22:59:34 +00:00
Files
amiga-tz/zoneinfo2tdf.pl
Paul Eggert dccd5a16af Switch from SCCS to git.
Remove the SCCS keyword '%W%' from all files.
Mostly this just remove comments.
Remove trailing white space, too.
* Makefile (TZCODE_VERSION): New macro.
(version.h): New rule.
(tzselect): Interpolate TZCODE_VERSION.
(clean): Remove version.h.
(zdump.o, zic.o): Depend on version.h.
* asctime.c, date.c, difftime.c, ialloc.c, localtime.c, scheck.c:
* strftime.c, zdump.c, zic.c: Remove elsieid.
* private.h: Remove privatehid.
* tzfile.h: Remove tzfilehid.
* tzselect.h (TZCODE_VERSION): Rename from VERSION.
* zdump.c, zic.c: Include "version.h",
and use TZCODE_VERSION instead of elsieid.
2012-07-18 17:30:38 -07:00

53 lines
1.4 KiB
Perl
Executable File

#! /usr/bin/perl -w
# Courtesy Ken Pizzini.
use strict;
#This file released to the public domain.
#Note: error checking is poor --- only trust the output if the input
#has been checked by zic.
my $contZone = '';
while (<>) {
my $origline = $_;
my @fields = ();
while (s/^\s*((?:"[^"]*"|[^\s#])+)//) {
push @fields, $1;
}
next unless @fields;
my $type = lc($fields[0]);
if ($contZone) {
@fields >= 3 or warn "bad continuation line";
unshift @fields, '+', $contZone;
$type = 'zone';
}
$contZone = '';
if ($type eq 'zone') {
# Zone NAME GMTOFF RULES/SAVE FORMAT [UNTIL]
my $nfields = @fields;
$nfields >= 5 or warn "bad zone line";
if ($nfields > 6) {
#this splice is optional, depending on one's preference
#(one big date-time field, or componentized date and time):
splice(@fields, 5, $nfields-5, "@fields[5..$nfields-1]");
}
$contZone = $fields[1] if @fields > 5;
} elsif ($type eq 'rule') {
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
@fields == 10 or warn "bad rule line";
} elsif ($type eq 'link') {
# Link LINK-FROM LINK-TO
@fields == 3 or warn "bad link line";
} elsif ($type eq 'leap') {
# Leap YEAR MONTH DAY HH:MM:SS CORR R/S
@fields == 7 or warn "bad leap line";
} else {
warn "Fubar at input line $.: $origline";
}
print join("\t", @fields), "\n";
}