fix stupid unpad typo in dx command
authorDirk Koopman <djk@tobit.co.uk>
Tue, 7 Mar 2023 11:50:12 +0000 (11:50 +0000)
committerDirk Koopman <djk@tobit.co.uk>
Tue, 7 Mar 2023 11:50:12 +0000 (11:50 +0000)
Changes
cmd/dx.pl
perl/DXCIDR.pm
perl/DXCommandmode.pm
perl/DXUtil.pm

diff --git a/Changes b/Changes
index 4334369324d2c2c1a1b3245f62f29f387b456526..fdfdb9a63d114e966cf2ded85b4ffbddd3c399fd 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,3 +1,6 @@
+07Mar23=======================================================================
+1. Fix odd (and old) regression dx command (line ending 59+++) '++' being the 
+   culprit.
 06Mar23=======================================================================
 1. Fix filter error reporting, including incrementing concurrent error count 
    if there are actually any detected parse errors.
index d1e278837d49fe018083121bf7cf44b77050424b..a6475347569bae6ce7084ada8aa4b6c3a09a9df7 100644 (file)
--- a/cmd/dx.pl
+++ b/cmd/dx.pl
@@ -76,7 +76,7 @@ if (is_freq($f[1]) && $f[0] =~ m{^[\w\d]+(?:/[\w\d]+){0,2}$}) {
 }
 $line =~ s/^\s*$f[0]//;
 $line =~ s/^\s*$f[1]//;
-$line =~ unpad($line);
+$line = unpad($line);
 $line =~ s/\t+/ /g;                            # do this here because it needs to be stopped ASAP!
 $line ||= ' ';
 
index b702d7b899c197f2647dd92da34d2efb3f502396..0a829bf1f474035eb73e42c85b381569b479d236 100644 (file)
@@ -162,9 +162,10 @@ sub _sort
        my @in;
        my @out;
        for (@_) {
-               push @in, [inet_pton(m|:|?AF_INET6:AF_INET, $_), split m|/|];
+               my @ip = split m|/|;
+               push @in, [inet_pton(m|:|?AF_INET6:AF_INET, $ip[0]), @ip];
        }
-       @out = sort {$a->[0] <=> $b->[0]} @in;
+       @out = sort {$a->[1] cmp $b->[1]} @in;
        return map { "$_->[1]/$_->[2]"} @out;
 }
 
index d0f9bb6531cf25bfffe6627e1cfc5f64807c1d69..d1feb3e18eb2e6dea892108a3eb15d2a8977d81f 100644 (file)
@@ -602,7 +602,7 @@ sub run_cmd
                        $self->send($self->msg('e26'));
                        $self->disconnect;
                        return ();
-               }
+               } 
        }
        return map {s/([^\s])\s+$/$1/; $_} @ans;
 }
@@ -882,7 +882,6 @@ sub find_cmd_name {
                
                if (isdbg('eval')) {
                        my @list = split /\n/, $eval;
-                       my $line;
                        for (@list) {
                                dbg($_ . "\n") if isdbg('eval');
                        }
index 207d27711e002e017ee72bcd5dcd5fede0273a82..b89d88ea9a89def800ffdfcba3ba39d1cc4e26aa 100644 (file)
@@ -380,8 +380,8 @@ sub filecopy
 sub unpad
 {
        my $s = shift;
-       $s =~ s/\s+$//;
-       $s =~ s/^\s+//;
+       $s =~ s/^\s*//;
+       $s =~ s/\s*$//;
        return $s;
 }