got the prefix code working quite well, changed a few country codes.
[spider.git] / cmd / show / prefix.pl
diff --git a/cmd/show/prefix.pl b/cmd/show/prefix.pl
new file mode 100644 (file)
index 0000000..9273243
--- /dev/null
@@ -0,0 +1,25 @@
+#
+# show the dxcc number for each callsign or prefix entered
+#
+# $Id$
+#
+
+my ($self, $line) = @_;
+my @list = split /\s+/, $line;               # generate a list of callsigns
+
+my $l;
+my @out;
+
+print "line: $line\n";
+foreach $l (@list) {
+  my @ans = Prefix::extract($l);
+  print "ans:", @ans, "\n";
+  next if !@ans;
+  my $pre = shift @ans;
+  my $a;
+  foreach $a (@ans) {
+    push @out, sprintf "%s   DXCC: %3d ITU: %3d CQ: %3d (%s, %s)", uc $l, $a->dxcc(), $a->itu(), $a->cq(), $pre, $a->name();
+  }
+}
+
+return (1, @out);