b416bf4b004e4ef9c2552b980af572ae368f37f0
[spider.git] / cmd / show / prefix.pl
1 #
2 # show the prefix info for each callsign or prefix entered
3 #
4 # $Id$
5 #
6
7 my ($self, $line) = @_;
8 my @list = split /\s+/, $line;  # generate a list of callsigns
9
10 my $l;
11 my @out;
12
13 #print "line: $line\n";
14 foreach $l (@list) {
15         my @ans = Prefix::extract($l);
16         next if !@ans;
17         my $pre = shift @ans;
18         my $a;
19         foreach $a (@ans) {
20                 push @out, sprintf "%s DXCC: %d ITU: %d CQ: %d LL: %s %s (%s, %s)", uc $l, $a->dxcc, $a->itu, $a->cq, slat($a->lat), slong($a->long), $pre, $a->name;
21                 $l = " " x length $l;
22         }
23         if ($USDB::present && $ans[0]->state) {
24                 push @out, sprintf "%s City: %s State: %s", $l, join (' ', map {ucfirst} split(/\s+/, lc $ans[0]->city)), $ans[0]->state;
25         }
26 }
27
28 return (1, @out);