summaryrefslogtreecommitdiffstats
path: root/usr.bin/killall
diff options
context:
space:
mode:
authormjg <mjg@FreeBSD.org>2013-06-30 20:27:31 +0000
committermjg <mjg@FreeBSD.org>2013-06-30 20:27:31 +0000
commitfdd0a4cf934b0c544c97ceba0888463d2819c2f2 (patch)
tree4cc73e8595d8b21596ba1a120dfe4f755922cc37 /usr.bin/killall
parent1baf66368b5a2b6c89ed6036adbe81fec42e57a8 (diff)
downloadFreeBSD-src-fdd0a4cf934b0c544c97ceba0888463d2819c2f2.zip
FreeBSD-src-fdd0a4cf934b0c544c97ceba0888463d2819c2f2.tar.gz
killall: add -q flag to suppress error message when no processes are matched
Man-page text provided by wblock. PR: bin/30542 Submitted by: Tony Finch <dot@dotat.at> (original version) MFC after: 1 week
Diffstat (limited to 'usr.bin/killall')
-rw-r--r--usr.bin/killall/killall.14
-rw-r--r--usr.bin/killall/killall.c11
2 files changed, 11 insertions, 4 deletions
diff --git a/usr.bin/killall/killall.1 b/usr.bin/killall/killall.1
index 7beaadb..be813f7 100644
--- a/usr.bin/killall/killall.1
+++ b/usr.bin/killall/killall.1
@@ -24,7 +24,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd June 27, 2012
+.Dd June 30, 2013
.Dt KILLALL 1
.Os
.Sh NAME
@@ -110,6 +110,8 @@ the specified
Limit potentially matching processes to those matching
the specified
.Ar procname .
+.It Fl q
+Suppress error message if no processes are matched.
.It Fl z
Do not skip zombies.
This should not have any effect except to print a few error messages
diff --git a/usr.bin/killall/killall.c b/usr.bin/killall/killall.c
index 83e829a..dd22a83 100644
--- a/usr.bin/killall/killall.c
+++ b/usr.bin/killall/killall.c
@@ -53,7 +53,7 @@ static void __dead2
usage(void)
{
- fprintf(stderr, "usage: killall [-delmsvz] [-help] [-I] [-j jail]\n");
+ fprintf(stderr, "usage: killall [-delmsqvz] [-help] [-I] [-j jail]\n");
fprintf(stderr,
" [-u user] [-t tty] [-c cmd] [-SIGNAL] [cmd]...\n");
fprintf(stderr, "At least one option or argument to specify processes must be given.\n");
@@ -101,6 +101,7 @@ main(int ac, char **av)
char *user = NULL;
char *tty = NULL;
char *cmd = NULL;
+ int qflag = 0;
int vflag = 0;
int sflag = 0;
int dflag = 0;
@@ -191,6 +192,9 @@ main(int ac, char **av)
errx(1, "must specify procname");
cmd = *av;
break;
+ case 'q':
+ qflag++;
+ break;
case 'v':
vflag++;
break;
@@ -417,8 +421,9 @@ main(int ac, char **av)
}
}
if (killed == 0) {
- fprintf(stderr, "No matching processes %swere found\n",
- getuid() != 0 ? "belonging to you " : "");
+ if (!qflag)
+ fprintf(stderr, "No matching processes %swere found\n",
+ getuid() != 0 ? "belonging to you " : "");
errors = 1;
}
exit(errors);
OpenPOWER on IntegriCloud