Project

General

Profile

kill-dash-t.patch

lkurusa, 12/05/2018 02:45 PM

View differences:

usr.bin/pkill/pkill.1
54 54
.Op Fl u Ar euid
55 55
.Ar pattern ...
56 56
.Nm pkill
57
.Op Fl Ar signal
58
.Op Fl ILafilnovx
57
.Op Fl ATr signal
58
.Op Fl ITLafilnovx
59 59
.Op Fl F Ar pidfile
60 60
.Op Fl G Ar gid
61 61
.Op Fl M Ar core
......
198 198
A single dash
199 199
.Pq Ql -
200 200
matches processes not associated with a terminal.
201
.It Fl T
202
Restrict matches to processes associated with the current terminal.
201 203
.It Fl u Ar euid
202 204
Restrict matches to processes with an effective user ID in the
203 205
comma-separated list
usr.bin/pkill/pkill.c
127 127
int
128 128
main(int argc, char **argv)
129 129
{
130
	char buf[_POSIX2_LINE_MAX], *mstr, **pargv, *p, *q, *pidfile;
130
	char buf[_POSIX2_LINE_MAX], *mstr, **pargv, *p, *q, *pidfile, *this_tty;
131 131
	const char *execf, *coref;
132 132
	int ancestors, debug_opt, did_action;
133 133
	int i, ch, bestidx, rv, criteria, pidfromfile, pidfilelock;
......
180 180
	execf = NULL;
181 181
	coref = _PATH_DEVNULL;
182 182

  
183
	while ((ch = getopt(argc, argv, "DF:G:ILM:N:P:SU:ac:d:fg:ij:lnoqs:t:u:vx")) != -1)
183
	while ((ch = getopt(argc, argv, "DF:G:ILM:N:P:STU:ac:d:fg:ij:lnoqs:t:u:vx")) != -1)
184 184
		switch (ch) {
185 185
		case 'D':
186 186
			debug_opt++;
......
270 270
			makelist(&tdevlist, LT_TTY, optarg);
271 271
			criteria = 1;
272 272
			break;
273
		case 'T':
274
			this_tty = ttyname(0) + sizeof(_PATH_DEV) - 1;
275
			makelist(&tdevlist, LT_TTY, this_tty);
276
			break;
273 277
		case 'u':
274 278
			makelist(&euidlist, LT_USER, optarg);
275 279
			criteria = 1;
......
579 583
	fprintf(stderr,
580 584
		"usage: %s %s [-F pidfile] [-G gid] [-M core] [-N system]\n"
581 585
		"             [-P ppid] [-U uid] [-c class] [-g pgrp] [-j jid]\n"
582
		"             [-s sid] [-t tty] [-u euid] pattern ...\n",
586
		"             [-s sid] [-T] [-t tty] [-u euid] pattern ...\n",
583 587
		getprogname(), ustr);
584 588

  
585 589
	exit(STATUS_BADUSAGE);
586
-