From: djk Date: Tue, 9 Nov 1999 17:58:00 +0000 (+0000) Subject: fixed uninit var in dbshow X-Git-Tag: R_1_34~1 X-Git-Url: http://dxcluster.net/gitweb/gitweb.cgi?a=commitdiff_plain;h=fd598bf2c7b12871c8941ecff8242dbd2b12d62e;p=spider.git fixed uninit var in dbshow changed qra format, added lat/log -> qra conversion --- diff --git a/cmd/dbshow.pl b/cmd/dbshow.pl index 10cce960..967cb469 100644 --- a/cmd/dbshow.pl +++ b/cmd/dbshow.pl @@ -44,7 +44,7 @@ foreach $n (@db) { push @out, "@f"; for (@f) { push @out, $db->name . " $_"; - my $value = $db->getkey($_); + my $value = $db->getkey($_) || ""; push @out, $db->name . ": $_ : $value"; if ($value) { push @out, split /\n/, $value; diff --git a/cmd/show/qra.pl b/cmd/show/qra.pl index 90c5bb1a..2bbb606f 100644 --- a/cmd/show/qra.pl +++ b/cmd/show/qra.pl @@ -10,6 +10,8 @@ my ($self, $line) = @_; my @list = split /\s+/, $line; # generate a list of callsigns my @out; +my $fll; +my $tll; my $lat = $self->user->lat; my $long = $self->user->long; if (!$long && !$lat) { @@ -18,8 +20,16 @@ if (!$long && !$lat) { $long = $main::mylongitude; } +my $fqra = DXBearing::is_qra($list[0]); +my $sqra = $list[0] =~ /^[A-Za-z][A-Za-z]\d\d$/; +my $ll = $line =~ /^\d+\s+\d+\s*[NSns]\s+\d+\s+\d+\s*[EWew]/; return (1, $self->msg('qrashe1')) unless @list > 0; -return (1, $self->msg('qrae2', $list[0])) unless (DXBearing::is_qra($list[0]) || $list[0] =~ /^[A-Za-z][A-Za-z]\d\d$/); +return (1, $self->msg('qrae2', $list[0])) unless $fqra || $sqra || $ll; + +if ($ll) { + my ($llat, $llong) = DXBearing::stoll($line); + return (1, "QRA $line = " . DXBearing::lltoqra($llat, $llong)); +} #print "$lat $long\n"; @@ -30,6 +40,7 @@ if (@list > 1) { $f = $l; $f .= 'MM' if $f =~ /^[A-Z][A-Z]\d\d$/; ($lat, $long) = DXBearing::qratoll($f); + $fll = DXBearing::lltos($lat, $long); #print "$lat $long\n"; return (1, $self->msg('qrae2', $list[1])) unless (DXBearing::is_qra($list[1]) || $list[1] =~ /^[A-Za-z][A-Za-z]\d\d$/); @@ -40,13 +51,18 @@ $l .= 'MM' if $l =~ /^[A-Z][A-Z]\d\d$/; my ($qlat, $qlong) = DXBearing::qratoll($l); #print "$qlat $qlong\n"; +$fll = DXBearing::lltos($lat, $long); +$fll =~ s/\s+([NSEW])/$1/g; +$tll = DXBearing::lltos($qlat, $qlong); +$tll =~ s/\s+([NSEW])/$1/g; + my ($b, $dx) = DXBearing::bdist($lat, $long, $qlat, $qlong); my ($r, $rdx) = DXBearing::bdist($qlat, $qlong, $lat, $long); my $to = ''; -$to = " -> $list[1]" if $f; -my $from = $list[0]; +$to = "->\U$list[1]($tll)" if $f; +my $from = "\U$list[0]($fll)" ; -push @out, sprintf "$list[0]$to Bearing: %.0f Deg. Recip: %.0f Deg. %.0fMi. %.0fKm.", $b, $r, $dx * 0.62133785, $dx; +push @out, sprintf "$from$to To: %.0f Fr: %.0f Dst: %.0fMi %.0fKm", $b, $r, $dx * 0.62133785, $dx; return (1, @out);