MDEV-34604 mytop - fix specifying filters in .mytop

Specifying filters (filter_status, filter_user, etc) in the mytop config
previously wouldn't work, because any filter specified here was added to
the config hash as a literal string.

This change fixes that - if filter_* is defined in the config and matches
an existing filter_* key, then run the value through StringOrRegex() and
assign to the config hash.
This commit is contained in:
PinkFreud 2024-03-07 19:09:39 -05:00 committed by Daniel Black
parent 03a350378a
commit 49dff5a4b6

View file

@ -147,7 +147,12 @@ if (-e $config)
if (/(\S+)\s*=\s*(.*\S)/)
{
$config{lc $1} = $2 if exists $config{lc $1};
my ($k, $v) = ($1, $2);
if ($k =~ /^filter_/i) {
$config{lc $k} = StringOrRegex($v) if exists $config{lc $k};
} else {
$config{lc $k} = $v if exists $config{lc $k};
}
}
}
close CFG;