From: Dirk Koopman Date: Sat, 21 Sep 2019 11:58:26 +0000 (+0100) Subject: improve is_callsign, is_ipaddr X-Git-Url: http://gb7djk.dxcluster.net/gitweb/gitweb.cgi?a=commitdiff_plain;ds=sidebyside;h=41f5538eb0eadf4daf02c5ca45b75f0dc79ca628;p=spider.git improve is_callsign, is_ipaddr fix typo in update_sysop.pl and watchdbg --- diff --git a/perl/DXUtil.pm b/perl/DXUtil.pm index bad92927..b9afba12 100644 --- a/perl/DXUtil.pm +++ b/perl/DXUtil.pm @@ -382,11 +382,11 @@ sub unpad sub is_callsign { return $_[0] =~ m!^ - (?:(?:[A-Z]{1,2}\d* | \d[A-Z]{1,2}\d*)/)? # out of area prefix / - (?:[A-Z]{1,2}\d+ | \d[A-Z]{1,2}\d+)? # main prefix one - [A-Z]{1,5} # callsign letters - (?:-(?:\d{1,2}|\#))? # - nn possibly (eg G8BPQ-8) or -# (an RBN spot) - (?:/[0-9A-Z]{1,7})? # / another prefix, callsign or special label (including /MM, /P as well as /EURO or /LGT) possibly + (?:\d?[A-Z]{1,2}\d*/)? # out of area prefix / + (?:\d?[A-Z]{1,2}\d+) # main prefix one (required) + [A-Z]{1,5} # callsign letters (required) + (?:-(?:\d{1,2}|\#))? # - nn possibly (eg G8BPQ-8) or -# (an RBN spot) + (?:/[0-9A-Z]{1,7})? # / another prefix, callsign or special label (including /MM, /P as well as /EURO or /LGT) possibly $!x; # longest callign allowed is 1X11/1Y11XXXXX-11/XXXXXXX @@ -440,7 +440,7 @@ sub is_latlong # is it an ip address? sub is_ipaddr { - return $_[0] =~ /^\d+\.\d+\.\d+\.\d+$/ || $_[0] =~ /^[0-9a-f:]+$/; + return $_[0] =~ /^\d+\.\d+\.\d+\.\d+$/ || $_[0] =~ /^[0-9a-f:,]+$/; } # insert an item into a list if it isn't already there returns 1 if there 0 if not diff --git a/perl/update_sysop.pl b/perl/update_sysop.pl index 168ee16a..666a7d5d 100755 --- a/perl/update_sysop.pl +++ b/perl/update_sysop.pl @@ -98,7 +98,7 @@ if (-e $lockfn) { DXUser::init(1); create_it(); -DXUser:finish(); +DXUser::finish(); print "Update of $myalias on cluster $mycall successful\n"; exit(0); diff --git a/perl/watchdbg b/perl/watchdbg index ff4d3438..8d9551d3 100755 --- a/perl/watchdbg +++ b/perl/watchdbg @@ -6,7 +6,7 @@ # examples:- # # watchdbg g1tlh # watch everything g1tlh does -# watchdbg 2 PCPROT # watch all PCPROT messages + up to 2 lines before +# watchdbg -2 PCPROT # watch all PCPROT messages + up to 2 lines before # watchdbg gb7baa gb7djk # watch the conversation between BAA and DJK # @@ -41,7 +41,7 @@ my @prev; # seek to end of file $fh->seek(0, 2); for (;;) { - my $line = <$fh>; + my $line = $fh->getline; if ($line) { if ($exp) { push @prev, $line;