From c5a41c1d2673b53c38d649ad90feee12ad1e286d Mon Sep 17 00:00:00 2001 From: minima Date: Fri, 8 Nov 2002 16:28:29 +0000 Subject: [PATCH] made some small changes --- Changes | 2 ++ perl/grepdbg | 12 +++++++++--- perl/spot2csv.pl | 25 +++++++++++++++++++------ 3 files changed, 30 insertions(+), 9 deletions(-) diff --git a/Changes b/Changes index 0de167b1..48118ace 100644 --- a/Changes +++ b/Changes @@ -1,3 +1,5 @@ +08Nov02======================================================================= +1. made some small mods to grepdbg and spot2csv.pl 07Nov02======================================================================= 1. allow three digit longitudes 2. make a small change to see if messages now stay in place. diff --git a/perl/grepdbg b/perl/grepdbg index 5ab380f6..3d1526f8 100755 --- a/perl/grepdbg +++ b/perl/grepdbg @@ -3,11 +3,17 @@ # Program to do a grep with dates and times on the debug # files # -# dispdbg [-nnn ...] +# grepdbg [nn] [-mm] # -# the -nnn is the day you what to look at -1 is yesterday -0 is today + +# nn - 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 +# +# -mmm - print the mmm lines before the match. So -10 will print +# ten lines including the line matching the regular expression. +# +# is the regular expression you are searching for, +# a caseless search is done # # diff --git a/perl/spot2csv.pl b/perl/spot2csv.pl index 100a8d3a..c6506dd0 100755 --- a/perl/spot2csv.pl +++ b/perl/spot2csv.pl @@ -8,14 +8,27 @@ # # $Id$ # - # make sure that modules are searched in the order local then perl -use DXUtil; - use strict; +BEGIN { + # root of directory tree for this system + use vars qw($root $is_win); + $root = "/spider"; + $root = $ENV{'DXSPIDER_ROOT'} if $ENV{'DXSPIDER_ROOT'}; + + unshift @INC, "$root/perl"; # this IS the right way round! + unshift @INC, "$root/local"; + + $is_win = ($^O =~ /^MS/ || $^O =~ /^OS-2/) ? 1 : 0; # is it Windows? +} + +use DXUtil; + die "usage: spot2csv.pl ....\n" unless @ARGV; +my $crnl = $is_win ? "\015\012" : "\012"; + for (@ARGV) { unless (open IN, $_) { print STDERR "cannot open $_ $!\n"; @@ -25,11 +38,11 @@ for (@ARGV) { chomp; s/([\%\"\'\x00-\x1f\x7f-\xff])/sprintf("%%%02X", ord($1))/eg; my @spot = split '\^'; - my $date = cldate($spot[2]); - my $time = ztime($spot[2], 1); + my $date = unpad cldate($spot[2]); + my $time = unpad ztime($spot[2], 1); print "$spot[0]\t\"$spot[1]\"\t\"$date\"\t$time\t"; print $spot[3] ? "\"$spot[3]\"\t" : "\t"; - print "\"$spot[4]\"\t$spot[5]\t$spot[6]\t\"$spot[7]\"\r\n"; + print "\"$spot[4]\"\t$spot[5]\t$spot[6]\t\"$spot[7]\"$crnl"; } close IN; } -- 2.43.0