get the location regex right and use it everywhere
authorminima <minima>
Thu, 7 Nov 2002 17:01:59 +0000 (17:01 +0000)
committerminima <minima>
Thu, 7 Nov 2002 17:01:59 +0000 (17:01 +0000)
cmd/set/sys_location.pl
perl/DXBearing.pm
perl/DXUtil.pm

index aac91823a694117ff464107b070acee534971f1a..58fb6ae5b5c7467818149f4ae2780f5c8b9e0151 100644 (file)
@@ -17,7 +17,8 @@ $line =~ s/^\s+//;
 $line =~ s/\s+$//;
 
 return (1, $self->msg('loce1')) if !$line;
-return (1, $self->msg('loce2', $line)) unless $line =~ /\d+ \d+ [NnSs] \d+ \d+ [EeWw]/o;
+return (1, $self->msg('loce3', uc $line)) if is_qra($line);
+return (1, $self->msg('loce2', $line)) unless is_latlong($line);
 
 $user = DXUser->get_current($call);
 if ($user) {
index b7101a53ce627ad1f535a413784ff98e6021a2a4..e7736f8a138d64a367865bce605631389f96f861 100644 (file)
@@ -110,7 +110,7 @@ sub bdist
 # turn a lat long string into floating point lat and long
 sub stoll
 {
-       my ($latd, $latm, $latl, $longd, $longm, $longl) = $_[0] =~ /(\d{1,2})\s+(\d{1,2})\s*([NnSs])\s+(\d{1,3})\s+(\d{1,2})\s*([EeWw])/;
+       my ($latd, $latm, $latl, $longd, $longm, $longl) = $_[0] =~ /(\d{1,2})\s+(\d{1,2})\s*([NnSs])\s+(1?\d{1,2})\s+(\d{1,2})\s*([EeWw])/;
        
        $longd += ($longm/60);
        $longd = 0-$longd if (uc $longl) eq 'W'; 
index 219e9f3bed6c3cdff7fdb1601eb1308c7e4be21e..c633413e7bfa2a0fdef19fde66645dffcef91ce6 100644 (file)
@@ -379,7 +379,7 @@ sub is_qra
 # does it look like a valid lat/long
 sub is_latlong
 {
-       return $_[0] =~ /^\s*\d{1,2}\s+\d{1,2}\s*[NnSs]\s+\d{1,2}\s+\d{1,2}\s*[EeWw]\s*$/;
+       return $_[0] =~ /^\s*\d{1,2}\s+\d{1,2}\s*[NnSs]\s+1?\d{1,2}\s+\d{1,2}\s*[EeWw]\s*$/;
 }
 
 # insert an item into a list if it isn't already there returns 1 if there 0 if not