4 # Copyright (c) 2001 Dirk Koopman G1TLH
8 # Modified on 2002/10/27 by K1XX for his own use
9 # Valid inputs (and then tarted up by G1TLH to include in the
12 # sh/hftable (original operation, starts from today for own prefix)
14 # sh/hftable [<date>] [<no. of days>] [prefix] [prefix] [prefix] ..
16 # sh/hftable [<date>] [<no. of days>] (data from your own prefix)
18 # sh/hftable [<date>] [<no. of days>] [callsign] [callsign] [callsign] ..
20 # sh/hftable [<date>] [<no of days>] all
23 # Known good data formats
25 # 24-Nov-02 (using - . or / as separator)
26 # 24nov02 (ie no separators)
29 # mm-dd-yy (this depends on your locale settings)
30 # 11-24-02 (using - . or / as separator)
37 my ($self, $line) = @_;
38 my @f = split /\s+/, $line;
56 if ($f =~ /^\d+$/ && $f < 366) { # no of days
60 if (my $utime = Date::Parse::str2time($f)) { # is it a parseable date?
62 $now = Julian::Day->new($utime);
63 $date = cldate($utime);
67 if (is_callsign($f)) {
76 if (my @ciz = Prefix::to_ciz('nc', $f)) {
77 push @dxcc, map {[$_, 2]} @ciz;
80 push @out, $self->msg('e27', $f);
85 # return error messages if any
86 return (1, @out) if @out;
89 unless (@pref) { # no prefix or callsign, use default prefix
90 if ($self->dxcc >= 61 && $self->dxcc < 67) {
91 push @dxcc, [$_, 2] for (61..67);
94 push @dxcc, [$self->dxcc, 2];
95 push @pref, $self->call;
101 $now = Julian::Day->new(time); #no starting date
102 $date = cldate(time);
105 # generate the spot list
106 for ($i = 0; $i < $days; $i++) {
107 my $fh = $Spot::statp->open($now); # get the next file
109 Spot::genstats($now);
110 $fh = $Spot::statp->open($now);
115 next if $l[0] eq 'TOTALS';
116 next unless $all || grep $l[$_->[1]] eq $_->[0], @dxcc;
117 my $ref = $list{$l[0]} || [0,0,0,0,0,0,0,0,0,0];
119 foreach my $item (@l[4..13]) {
124 $list{$l[0]} = $ref if $ref->[0];
132 my $l = join ',', @pref;
133 push @out, $self->msg('stathft', $l, $date, $days);
134 push @out, sprintf "%9s|%5s|%5s|%5s|%5s|%5s|%5s|%5s|%5s|%5s|%5s|%5s|", qw(Callsign Tot 160m 80m 60m 40m 30m 20m 17m 15m 12m 10m);
136 for (sort {$list{$b}->[0] <=> $list{$a}->[0] || $a cmp $b} keys %list) {
139 my @list = (sprintf "%9s", $_);
140 foreach my $j (0..11) {
144 $r = sprintf("%5d", $r);
150 push @out, join('|', @list);
151 last if $limit && $nocalls >= $limit;
154 $nocalls = sprintf "%9s", "$nocalls calls";
155 @tot = map {$_ ? sprintf("%5d", $_) : ' ' } @tot;
156 push @out, join('|', $nocalls, @tot,"");