1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-11-28 08:02:54 +00:00

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
This commit is contained in:
Mateusz Guzik 2013-06-30 20:27:31 +00:00
parent 71c80b4ea0
commit 214e08782b
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=252428
2 changed files with 11 additions and 4 deletions

View File

@ -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

View File

@ -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);