summaryrefslogtreecommitdiffstats
path: root/src/freebsd
diff options
context:
space:
mode:
authorSteffen <steffen.winter@proton.me>2024-03-20 15:21:22 +0100
committerSteffen Winter <steffen.winter@proton.me>2024-04-30 17:09:15 +0200
commit255b77756305cf807a6d2b040ab71788f0139f0f (patch)
tree3b92ceaeadf7d18c76868ffcfed18d3fda9b045e /src/freebsd
parent8c1a8ab4fac34b9439ba225544e463c61bef7b24 (diff)
Add regex filtering
Filters starting with '!' will try to match processes pid, name, cmd and user with extended regex as defined by the C++ standard. A single '!' will not filter.
Diffstat (limited to 'src/freebsd')
-rw-r--r--src/freebsd/btop_collect.cpp17
1 files changed, 6 insertions, 11 deletions
diff --git a/src/freebsd/btop_collect.cpp b/src/freebsd/btop_collect.cpp
index a99f8df..b4034c7 100644
--- a/src/freebsd/btop_collect.cpp
+++ b/src/freebsd/btop_collect.cpp
@@ -1239,18 +1239,13 @@ namespace Proc {
filter_found = 0;
for (auto& p : current_procs) {
if (not tree and not filter.empty()) {
- if (not s_contains_ic(to_string(p.pid), filter)
- and not s_contains_ic(p.name, filter)
- and not s_contains_ic(p.cmd, filter)
- and not s_contains_ic(p.user, filter)) {
- p.filtered = true;
- filter_found++;
- }
- else {
- p.filtered = false;
- }
+ if (!matches_filter(p, filter)) {
+ p.filtered = true;
+ filter_found++;
+ } else {
+ p.filtered = false;
}
- else {
+ } else {
p.filtered = false;
}
}