http://perforce.freebsd.org/chv.cgi?CH=72892 Change 72892 by pjd@pjd_anger on 2005/03/11 12:33:34 Implement '-i' option which allows to ignore case distinctions in both the process table and the supplied pattern. Obtained from: Jonathan Perkin Affected files ... .. //depot/user/pjd/pkill/usr.bin/pkill/pkill.1#4 edit .. //depot/user/pjd/pkill/usr.bin/pkill/pkill.c#4 edit Differences ... ==== //depot/user/pjd/pkill/usr.bin/pkill/pkill.1#4 (text+ko) ==== @@ -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 @@ -59,7 +59,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 @@ -125,6 +125,8 @@ or .Nm pkill command. +.It Fl i +Ignore case distinctions in both the process table and the supplied pattern. .It Fl l Long output. Print the process name in addition to the process ID for each matching ==== //depot/user/pjd/pkill/usr.bin/pkill/pkill.c#4 (text+ko) ==== @@ -102,6 +102,7 @@ int longfmt; int matchargs; int fullmatch; +int cflags = REG_EXTENDED; kvm_t *kd; pid_t mypid; @@ -173,7 +174,7 @@ pidfromfile = -1; execf = coref = _PATH_DEVNULL; - while ((ch = getopt(argc, argv, "DF:G:M:N:P:U:d:fg:lns:t:u:vx")) != -1) + while ((ch = getopt(argc, argv, "DF:G:M:N:P:U:d:fg:ilns:t:u:vx")) != -1) switch (ch) { case 'D': debug_opt++; @@ -212,6 +213,9 @@ makelist(&pgrplist, LT_PGRP, optarg); criteria = 1; break; + case 'i': + cflags |= REG_ICASE; + break; case 'l': if (!pgrep) usage(); @@ -280,7 +284,7 @@ * 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); } @@ -459,7 +463,7 @@ const char *ustr; if (pgrep) - ustr = "[-flnvx] [-d delim]"; + ustr = "[-filnvx] [-d delim]"; else ustr = "[-signal] [-fnvx]";