--On Monday, December 02, 2002 12:10 PM -0800 Jim Trocki <[EMAIL PROTECTED]> wrote:

On Mon, 2 Dec 2002, David Nolan wrote:


Unfortunately, since my current copy of Mon is HEAVILY patched, vs
0.99.2, just handing out a copy is probably not a good idea.
have you done more than replace the calls to parse_line with calls to
your own routine? if so, just send me a snippet of your routine and an
example of how it's called.

Actually, I took the approach of changing the protocol *slightly* in order to make using split or a simple regexp possible. Basically in both mon and Mon::Client change esc_str to escape spaces in addition to everything it currently escapes. ('<= 32' instead of '< 32').



Then in Mon::Client replace quotewords with split: (Theses diffs, are backwards, but you get the idea...)

*** 1929,1935 ****
}

foreach $o (@op) {
! foreach my $w (split (/\s+/, $o)) {
my ($var, $val) = split (/=/, $w, 2);
$op{$var} = _un_esc_str ($val);
}
--- 1929,1935 ----
}

foreach $o (@op) {
! foreach my $w (quotewords ('\s+', 0, $o)) {
my ($var, $val) = split (/=/, $w, 2);
$op{$var} = _un_esc_str ($val);
}
***************


And in mon, in handle_trap replace parse_line like this: (I replace $l with $line for readability, as the visual similarity of $l and $1 confuses my brain)

*** 3950,3969 ****
# dtl detail
#

! foreach my $line (split (/\n/, $buf))
{
! if ($line =~ /^(\w+)=(.*)/)
{
- my $trap_name = $1;
my $trap_val = $2;
chomp $trap_val;
! $trap_val =~ s/^\'?(.*)\'?\s*$/\1/;!
$trap{$trap_name} = un_esc_str ($trap_val);
}

else
{
! syslog ('err', "unspecified tag in trap: $line");
}
}

--- 3950,3967 ----
# dtl detail
#

! foreach my $l (split (/\n/, $buf))
{
! if ($l =~ /^(\w+)=(.*)/)
{
my $trap_val = $2;
chomp $trap_val;
! $trap{$1} = un_esc_str ((parse_line ('\s+', 0, $trap_val))[0]);
}

else
{
! syslog ('err', "unspecified tag in trap: $l");
}
}

***************


There are a few other usages of parse_line and quotewords in mon, but they haven't been causing me any problems, so I haven't bothered to eliminate them.


releasing a new version based on the patches I've sent him sometime soon,
i'm aiming to utilize some holiday time for getting a new release out
before 1-jan. we'll see how it goes :)

I'm looking forward to it. I've got some more patches to send you (400+ lines of diff, so probably 150 lines of changes), but I want to test some of it a bit better first, and I want to just reconcile these changes against whatever you release, and send you an up-to-date patch.

And I haven't even *started* the true-per-host-status-tracking work yet. I've been working on little stuff first, and on another project. I expect I'll get to start working on that around mid January.

-David

David Nolan <*> [EMAIL PROTECTED]
curses: May you be forced to grep the termcap of an unclean yacc while
a herd of rogue emacs fsck your troff and vgrind your pathalias!
_______________________________________________
mon mailing list
[EMAIL PROTECTED]
http://linux.kernel.org/mailman/listinfo/mon

Reply via email to