77 lines
2.1 KiB
Plaintext
77 lines
2.1 KiB
Plaintext
|
$OpenBSD: patch-pkill_pkill_c,v 1.1.1.1 2003/01/06 18:03:44 lebel Exp $
|
||
|
Support the -V flag.
|
||
|
Fix -signal support.
|
||
|
Fix return values.
|
||
|
--- pkill/pkill.c.orig Tue May 22 06:33:42 2001
|
||
|
+++ pkill/pkill.c Mon Jan 6 23:14:31 2003
|
||
|
@@ -1,5 +1,5 @@
|
||
|
/*
|
||
|
- * pkill [-s <signal>|-<signal>] [-fnvx] [-g <pgrplist>] [-G <gidlist>]
|
||
|
+ * pkill [-s <signal>|-<signal>] [-fnvVx] [-g <pgrplist>] [-G <gidlist>]
|
||
|
* [-P <ppidlist>] [-t <termlist>] [-u <euidlist>]
|
||
|
* [-U <uidlist>] [<pattern>]
|
||
|
*
|
||
|
@@ -14,6 +14,7 @@
|
||
|
* -u <euidlist> : matches effective uids
|
||
|
* -U <uidlist> : matches real uids
|
||
|
* -v : invert match
|
||
|
+ * -V : invert flags but not the pattern
|
||
|
* -x : exact match (default regex)
|
||
|
*
|
||
|
* <pattern> : regex (or exact string if -x) to match
|
||
|
@@ -52,7 +53,7 @@ main(argc, argv)
|
||
|
struct termlist *terml;
|
||
|
struct uidlist *euidl, *uidl;
|
||
|
int ch;
|
||
|
- int fflag, nflag, vflag, xflag;
|
||
|
+ int fflag, nflag, vflag, Vflag, xflag;
|
||
|
int numsig;
|
||
|
size_t len;
|
||
|
char *newarg;
|
||
|
@@ -63,7 +64,7 @@ main(argc, argv)
|
||
|
pgroupl = ppidl = sidl = NULL;
|
||
|
terml = NULL;
|
||
|
euidl = uidl = NULL;
|
||
|
- fflag = xflag = nflag = vflag = FALSE;
|
||
|
+ fflag = xflag = nflag = vflag = Vflag = FALSE;
|
||
|
numsig = SIGTERM;
|
||
|
newarg = NULL;
|
||
|
|
||
|
@@ -79,7 +80,7 @@ main(argc, argv)
|
||
|
len = strlen(*argv) + 3;
|
||
|
if ((newarg = calloc(len, sizeof(char))) == NULL)
|
||
|
err(EX_OSERR, NULL);
|
||
|
- snprintf(newarg, len, "-S%s", *argv);
|
||
|
+ snprintf(newarg, len, "-s%s", *argv);
|
||
|
--*argv;
|
||
|
*argv = newarg;
|
||
|
}
|
||
|
@@ -145,6 +146,9 @@ main(argc, argv)
|
||
|
case 'v':
|
||
|
vflag = TRUE;
|
||
|
break;
|
||
|
+ case 'V':
|
||
|
+ Vflag = TRUE;
|
||
|
+ break;
|
||
|
case 'x':
|
||
|
xflag = TRUE;
|
||
|
break;
|
||
|
@@ -165,7 +169,7 @@ main(argc, argv)
|
||
|
usage();
|
||
|
}
|
||
|
|
||
|
- getProcList (&proclist, euidl, uidl, gidl, ppidl, pgroupl, terml, fflag, nflag, vflag, xflag, ((argc > 0)?argv[0]:NULL));
|
||
|
+ getProcList (&proclist, euidl, uidl, gidl, ppidl, pgroupl, terml, fflag, nflag, vflag, Vflag, xflag, ((argc > 0)?argv[0]:NULL));
|
||
|
|
||
|
temppl = proclist;
|
||
|
while (temppl != NULL) {
|
||
|
@@ -174,7 +178,7 @@ main(argc, argv)
|
||
|
temppl = temppl->next;
|
||
|
}
|
||
|
|
||
|
- exit(EX_OK);
|
||
|
+ return proclist == NULL ? 1 : EX_OK;
|
||
|
}
|
||
|
|
||
|
/*
|