From 5bda7945001817ba3005d357b7b2f257ffe8a2cf Mon Sep 17 00:00:00 2001 From: minima Date: Thu, 7 Nov 2002 17:01:59 +0000 Subject: [PATCH] get the location regex right and use it everywhere --- cmd/set/sys_location.pl | 3 ++- perl/DXBearing.pm | 2 +- perl/DXUtil.pm | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) 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 -- 2.43.0