From b0fd644dc9bab269bde7b861f0de06b4d38f2ddf Mon Sep 17 00:00:00 2001 From: Brian Norris Date: Wed, 5 Feb 2025 10:21:10 -0800 Subject: [PATCH] pgrep: Complain about invalid options pgrep will silently eat unknown args and treat them as process filters. This is especially confusing for unimplemented options, like "-a". If one needs to filter on a flag-like filter, there's always a "--" separator, like: pgrep -- -process-with-dashes --- toys/posix/ps.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/toys/posix/ps.c b/toys/posix/ps.c index 87dc1af4..3a745321 100644 --- a/toys/posix/ps.c +++ b/toys/posix/ps.c @@ -51,7 +51,7 @@ USE_PS(NEWTOY(ps, "k(sort)*P(ppid)*aAdeflMno*O*p(pid)*s*t*Tu*U*g*G*wZ[!ol][+Ae][ // the default values are different but the flags are in the same order. USE_TOP(NEWTOY(top, ">0O*h" "Hk*o*p*u*s#<1d%<100=3000m#n#<1bq[!oO]", TOYFLAG_USR|TOYFLAG_BIN)) USE_IOTOP(NEWTOY(iotop, ">0AaKO" "Hk*o*p*u*s#<1=7d%<100=3000m#n#<1bq", TOYFLAG_USR|TOYFLAG_BIN|TOYFLAG_STAYROOT)) -USE_PGREP(NEWTOY(pgrep, "?cld:u*U*t*s*P*g*G*fnovxL:[-no]", TOYFLAG_USR|TOYFLAG_BIN)) +USE_PGREP(NEWTOY(pgrep, "cld:u*U*t*s*P*g*G*fnovxL:[-no]", TOYFLAG_USR|TOYFLAG_BIN)) USE_PKILL(NEWTOY(pkill, "?Vu*U*t*s*P*g*G*fnovxl:[-no]", TOYFLAG_USR|TOYFLAG_BIN)) config PS -- 2.39.5