+07Sep20=======================================================================
+1, Change interface to watchdbg & grepdbg slightly so that multiple search
+ regexes are ANDed rather than ORed together. ORing is easily achieved
+ already by the usual regex pattern 'PATT..|PATT..|..' whereas ANDing could
+ not be done as easily without resorting lots of 'PATT.*PATH' things which
+ would not necessarily get what was wanted.
+2. Make sure that the pc92 C record only contains nodes and users and not
+ other extranoeus things like skimmers...
15Aug20=======================================================================
1. Simplify the skimmer scoring mechanism.
13Aug20=======================================================================
clear_pc92_changes(); # remove any slugged data, we are generating it as now
my @dxchan = grep { $_->call ne $main::mycall && !$_->{isolate} } DXChannel::get_all();
dbg("ROUTE: all dxchan: " . join(',', map{$_->{call}} @dxchan)) if isdbg('routelow');
- my @localnodes = map { my $r = Route::get($_->{call}); $r ? $r : () } @dxchan;
+ my @localnodes = map { my $r = Route::get($_->{call});($_->is_node || $_->is_user) && $r ? $r : () } @dxchan;
dbg("ROUTE: localnodes: " . join(',', map{$_->{call}} @localnodes)) if isdbg('routelow');
return pc92c($node, @localnodes);
} else {
my $c;
if ($uref) {
$c = $uref->user_call;
- } else {
+ }
+ else {
$c = "$ucall?";
}
if ((length $line) + (length $c) + 1 < $width) {
$line .= $c . ' ';
- } else {
+ }
+ else {
$line =~ s/\s+$//;
push @out, $line;
$line = ' ' x ($level*2) . "$pcall->$c ";
$line =~ s/->$//g;
$line =~ s/\s+$//;
push @out, $line if length $line;
- } else {
+ }
+ else {
# recursion detector
if ((DXChannel::get($call) && $level > 1) || $seen->{$call} || $level > $maxlevel) {
return @out;
# ten lines including the line matching the regular expression.
#
# <regexp> is the regular expression you are searching for,
-# a caseless search is done
+# a caseless search is done. There can be more than one <regexp>
+# a <regexp> preceeded by a '!' is treated as NOT <regexp>. Each
+# <regexp> is implcitly ANDed together.
#
# If you specify something that likes a filename and that filename
# has a .pm on the end of it and it exists then rather than doing
$today = $fp->unixtoj(time());
my $nolines = 1;
my @prev;
+my @patt;
-for my $arg (@ARGV) {
+foreach my $arg (@ARGV) {
if ($arg =~ /^-/) {
$arg =~ s/^-//o;
if ($arg =~ /^\s*\-+(?:[h\?]e?l?p?)/) {
die "$arg not found";
}
} else {
- $string = $arg;
- last;
+ push @patt, $arg;
}
}
-$string ||= '.*';
+push @patt, '.*' unless @patt;
push @list, "0" unless @list;
for my $entry (@list) {
chomp $line;
push @prev, $line;
shift @prev while @prev > $nolines;
- if ($line =~ m{$string}io) {
+ my $flag = 0;
+ foreach my $p (@patt) {
+ if ($p =~ /^!/) {
+ my $r = substr $p, 1;
+ last if $line =~ m{$r}i;
+ } else {
+ last unless $line =~ m{$p}i;
+ }
+ ++$flag;
+ }
+ if ($flag == @patt) {
for (@prev) {
s/([\x00-\x1f\x7f-\xff])/sprintf("\\x%02X", ord($1))/eg;
my ($t, $l) = split /\^/, $_, 2;
sub usage
{
- die "usage: grepdbg [nn days before] [-nnn lines before] [<regexp>|<perl file name>]\n";
+ die "usage: grepdbg [nn days before] [-nnn lines before] [<perl file name>] [<regexp>|!<regexp>]...\n";
}
exit(0);
# watch the end of the current debug file (like tail -f) applying
# any regexes supplied on the command line.
#
+# There can be more than one <regexp>. a <regexp> preceeded by a '!' is
+# treated as NOT <regexp>. Each <regexp> is implcitly ANDed together.
+# All <regexp> are caseless.
+#
# examples:-
#
# watchdbg g1tlh # watch everything g1tlh does
my $nolines = 1;
$nolines = shift if $ARGV[0] =~ /^-?\d+$/;
$nolines = abs $nolines if $nolines < 0;
-my $exp = join '|', @ARGV;
+my @patt = @ARGV;
my @prev;
# seek to end of file
for (;;) {
my $line = $fh->getline;
if ($line) {
- if ($exp) {
+ if (@patt) {
push @prev, $line;
shift @prev while @prev > $nolines;
- if ($line =~ m{(?:$exp)}oi) {
+ my $flag = 0;
+ foreach my $p (@patt) {
+ if ($p =~ /^!/) {
+ my $r = substr $p, 1;
+ last if $line =~ m{$r}i;
+ } else {
+ last unless $line =~ m{$p}i;
+ }
+ ++$flag;
+ }
+ if ($flag == @patt) {
printit(@prev);
@prev = ();
}
$line =~ s/([\x00-\x1f\x7f-\xff])/sprintf("\\x%02X", ord($1))/eg;
my ($t, $l) = split /\^/, $line, 2;
$t = time unless defined $t;
- printf "%02d:%02d:%02d %s\n", (gmtime($t))[2,1,0], $l;
+ printf "%02d:%02d:%02d %s\n", (gmtime($t))[2,1,0], $l;
}
}
exit(0);