Add a -i option to ignore case in the process match.
Obtained from: NetBSD Reviewed by: gad MFC after: 3 days
This commit is contained in:
parent
3f98083e57
commit
d88f375460
@ -44,7 +44,7 @@
|
||||
.Nd find or signal processes by name
|
||||
.Sh SYNOPSIS
|
||||
.Nm pgrep
|
||||
.Op Fl flnvx
|
||||
.Op Fl filnvx
|
||||
.Op Fl F Ar pidfile
|
||||
.Op Fl G Ar gid
|
||||
.Op Fl M Ar core
|
||||
@ -60,7 +60,7 @@
|
||||
.Ar pattern ...
|
||||
.Nm pkill
|
||||
.Op Fl Ar signal
|
||||
.Op Fl fnvx
|
||||
.Op Fl finvx
|
||||
.Op Fl F Ar pidfile
|
||||
.Op Fl G Ar gid
|
||||
.Op Fl M Ar core
|
||||
@ -127,6 +127,8 @@ The value zero is taken to mean the process group ID of the running
|
||||
or
|
||||
.Nm pkill
|
||||
command.
|
||||
.It Fl i
|
||||
Ignore case distinctions in both the process table and the supplied pattern.
|
||||
.It Fl j Ar jid
|
||||
Restrict matches to processes inside jails with a jail ID in the comma-separated
|
||||
list
|
||||
|
@ -102,6 +102,7 @@ int inverse;
|
||||
int longfmt;
|
||||
int matchargs;
|
||||
int fullmatch;
|
||||
int cflags = REG_EXTENDED;
|
||||
kvm_t *kd;
|
||||
pid_t mypid;
|
||||
|
||||
@ -174,7 +175,7 @@ main(int argc, char **argv)
|
||||
pidfromfile = -1;
|
||||
execf = coref = _PATH_DEVNULL;
|
||||
|
||||
while ((ch = getopt(argc, argv, "DF:G:M:N:P:U:d:fg:j:lns:t:u:vx")) != -1)
|
||||
while ((ch = getopt(argc, argv, "DF:G:M:N:P:U:d:fg:ij:lns:t:u:vx")) != -1)
|
||||
switch (ch) {
|
||||
case 'D':
|
||||
debug_opt++;
|
||||
@ -213,6 +214,9 @@ main(int argc, char **argv)
|
||||
makelist(&pgrplist, LT_PGRP, optarg);
|
||||
criteria = 1;
|
||||
break;
|
||||
case 'i':
|
||||
cflags |= REG_ICASE;
|
||||
break;
|
||||
case 'j':
|
||||
makelist(&jidlist, LT_GENERIC, optarg);
|
||||
criteria = 1;
|
||||
@ -285,7 +289,7 @@ main(int argc, char **argv)
|
||||
* Refine the selection.
|
||||
*/
|
||||
for (; *argv != NULL; argv++) {
|
||||
if ((rv = regcomp(®, *argv, REG_EXTENDED)) != 0) {
|
||||
if ((rv = regcomp(®, *argv, cflags)) != 0) {
|
||||
regerror(rv, ®, buf, sizeof(buf));
|
||||
errx(STATUS_BADUSAGE, "bad expression: %s", buf);
|
||||
}
|
||||
@ -477,9 +481,9 @@ usage(void)
|
||||
const char *ustr;
|
||||
|
||||
if (pgrep)
|
||||
ustr = "[-flnvx] [-d delim]";
|
||||
ustr = "[-filnvx] [-d delim]";
|
||||
else
|
||||
ustr = "[-signal] [-fnvx]";
|
||||
ustr = "[-signal] [-finvx]";
|
||||
|
||||
fprintf(stderr,
|
||||
"usage: %s %s [-F pidfile] [-G gid] [-M core] [-N system]\n"
|
||||
|
Loading…
Reference in New Issue
Block a user