From 9da1742219a27b1c02fd57794412088e4d7b3d1d Mon Sep 17 00:00:00 2001 From: djk Date: Tue, 15 Jun 1999 09:19:17 +0000 Subject: [PATCH] 1. added grepdbg program (so you can search your debug files and get times and dates of incidents). 2. Moved DXVars.pm to DXVars.pm.issue to force new users to cp it to their local directory. 3. added $allowzero to DXProt to allow thru PC19s with zero protocol versions. --- Changes | 6 +++ perl/DXLog.pm | 6 +-- perl/DXProt.pm | 4 +- perl/{DXVars.pm => DXVars.pm.issue} | 0 perl/Julian.pm | 1 - perl/Spot.pm | 2 +- perl/grepdbg | 66 +++++++++++++++++++++++++++++ 7 files changed, 79 insertions(+), 6 deletions(-) rename perl/{DXVars.pm => DXVars.pm.issue} (100%) create mode 100755 perl/grepdbg diff --git a/Changes b/Changes index 67be5403..17d937a7 100644 --- a/Changes +++ b/Changes @@ -1,3 +1,9 @@ +15Jun99======================================================================= +1. added grepdbg program (so you can search your debug files and get times +and dates of incidents). +2. Moved DXVars.pm to DXVars.pm.issue to force new users to cp it to their +local directory. +3. added $allowzero to DXProt to allow thru PC19s with zero protocol versions. 14Jun99======================================================================= 1. changed IO::File in help and apropos to IO::File 2. added a check for isa('DXNode') for PC50s diff --git a/perl/DXLog.pm b/perl/DXLog.pm index 8281e154..17559b36 100644 --- a/perl/DXLog.pm +++ b/perl/DXLog.pm @@ -31,7 +31,7 @@ require Exporter; use IO::File; use DXVars; -use DXDebug (); +# use DXDebug (); use DXUtil; use Julian; use Carp; @@ -53,7 +53,7 @@ sub new $ref->{'sort'} = $sort; # make sure the directory exists - mkdir($ref->{prefix}, 0777) if ! -e $ref->{prefix}; + mkdir($ref->{prefix}, 0777) unless -e $ref->{prefix}; return bless $ref; } @@ -83,7 +83,7 @@ sub open $self->{year} = $year; $self->{thing} = $thing; - DXDebug::dbg("dxlog", "opening $self->{fn}\n"); +# DXDebug::dbg("dxlog", "opening $self->{fn}\n"); return $self->{fh}; } diff --git a/perl/DXProt.pm b/perl/DXProt.pm index 17328bc2..16b67023 100644 --- a/perl/DXProt.pm +++ b/perl/DXProt.pm @@ -31,7 +31,7 @@ use strict; use vars qw($me $pc11_max_age $pc11_dup_age $pc23_dup_age %spotdup %wwvdup $last_hour %pings %rcmds %nodehops @baddx $baddxfn $pc12_dup_age - %anndup); + %anndup $allowzero); $me = undef; # the channel id for this cluster $pc11_max_age = 1*3600; # the maximum age for an incoming 'real-time' pc11 @@ -385,6 +385,8 @@ sub normal my $call = uc $field[$i+1]; my $confmode = $field[$i+2]; my $ver = $field[$i+3]; + + $ver = 5400 if !$ver && $allowzero; # now check the call over my $node = DXCluster->get_exact($call); diff --git a/perl/DXVars.pm b/perl/DXVars.pm.issue similarity index 100% rename from perl/DXVars.pm rename to perl/DXVars.pm.issue diff --git a/perl/Julian.pm b/perl/Julian.pm index 1316fb42..8b3b74fd 100644 --- a/perl/Julian.pm +++ b/perl/Julian.pm @@ -8,7 +8,6 @@ package Julian; -use DXDebug; use Carp; use strict; diff --git a/perl/Spot.pm b/perl/Spot.pm index 7302193a..cdd7393d 100644 --- a/perl/Spot.pm +++ b/perl/Spot.pm @@ -105,7 +105,7 @@ sub search my $ref; my $i; my $count; - my @today = Julian::unixtoj(time); + my @today = Julian::unixtoj(time()); my @fromdate; my @todate; diff --git a/perl/grepdbg b/perl/grepdbg new file mode 100755 index 00000000..c44fc92b --- /dev/null +++ b/perl/grepdbg @@ -0,0 +1,66 @@ +#!/usr/bin/perl +# +# Program to do a grep with dates and times on the debug +# files +# +# dispdbg [-nnn ...] +# +# the -nnn is the day you what to look at -1 is yesterday -0 is today +# and is optional if there is only one argument +# is the string, a caseless search is done +# +# + +require 5.004; + +# search local then perl directories +BEGIN { + # root of directory tree for this system + $root = "/spider"; + $root = $ENV{'DXSPIDER_ROOT'} if $ENV{'DXSPIDER_ROOT'}; + + unshift @INC, "$root/perl"; # this IS the right way round! + unshift @INC, "$root/local"; +} + +use DXVars; +use DXUtil; +use DXLog; + +use strict; + +use vars qw(@list $fp @today $string); + +$fp = DXLog::new('debug', 'dat', 'd'); +@today = Julian::unixtoj(time()); + +for my $arg (@ARGV) { + if ($arg =~ /^-/) { + $arg =~ s/^-//o; + push @list, $arg; + } else { + $string = $arg; + last; + } +} +die "usage: dispdbg [[-nnn] ..] \n" unless $string; + +push @list, "0" unless @list; +for my $entry (@list) { + my @now = Julian::sub(@today, $entry); + my $fh = $fp->open(@now); + my $line; + if ($fh) { + while (<$fh>) { + my $line = $_; + chomp $line; + if ($line =~ m{\Q$string}io) { + my @line = split '\^', $line; + my $t = shift @line; + print atime($t), ' ', join('^', @line), "\n"; + } + } + $fp->close(); + } +} +exit(0); -- 2.43.0