From: minima Date: Thu, 7 Nov 2002 17:01:59 +0000 (+0000) Subject: get the location regex right and use it everywhere X-Git-Tag: PRE-1-52~112 X-Git-Url: http://www.dxcluster.org/gitweb/gitweb.cgi?p=spider.git;a=commitdiff_plain;h=5bda7945001817ba3005d357b7b2f257ffe8a2cf get the location regex right and use it everywhere --- diff --git a/cmd/set/sys_location.pl b/cmd/set/sys_location.pl index aac91823..58fb6ae5 100644 --- a/cmd/set/sys_location.pl +++ b/cmd/set/sys_location.pl @@ -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) { diff --git a/perl/DXBearing.pm b/perl/DXBearing.pm index b7101a53..e7736f8a 100644 --- a/perl/DXBearing.pm +++ b/perl/DXBearing.pm @@ -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'; diff --git a/perl/DXUtil.pm b/perl/DXUtil.pm index 219e9f3b..c633413e 100644 --- a/perl/DXUtil.pm +++ b/perl/DXUtil.pm @@ -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