diff options
author | pjd <pjd@FreeBSD.org> | 2005-03-20 11:12:13 +0000 |
---|---|---|
committer | pjd <pjd@FreeBSD.org> | 2005-03-20 11:12:13 +0000 |
commit | d88f375460502913d2655524ce30c0c3fa8946fc (patch) | |
tree | 22ff5c4f83fcb41e3ae6cef01cc5023dd97e1753 /usr.bin/pkill | |
parent | 3f98083e5729a733be36d0b5388d62ee85e2ad8f (diff) | |
download | FreeBSD-src-d88f375460502913d2655524ce30c0c3fa8946fc.zip FreeBSD-src-d88f375460502913d2655524ce30c0c3fa8946fc.tar.gz |
Add a -i option to ignore case in the process match.
Obtained from: NetBSD
Reviewed by: gad
MFC after: 3 days
Diffstat (limited to 'usr.bin/pkill')
-rw-r--r-- | usr.bin/pkill/pkill.1 | 6 | ||||
-rw-r--r-- | usr.bin/pkill/pkill.c | 12 |
2 files changed, 12 insertions, 6 deletions
diff --git a/usr.bin/pkill/pkill.1 b/usr.bin/pkill/pkill.1 index 795aff5..e3b68e4 100644 --- a/usr.bin/pkill/pkill.1 +++ b/usr.bin/pkill/pkill.1 @@ -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 diff --git a/usr.bin/pkill/pkill.c b/usr.bin/pkill/pkill.c index fd8a332..07eb1a2 100644 --- a/usr.bin/pkill/pkill.c +++ b/usr.bin/pkill/pkill.c @@ -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" |