Submit #3163 ยป kill-dash-t.patch
| usr.bin/pkill/pkill.1 | ||
|---|---|---|
| .Op Fl u Ar euid | ||
| .Ar pattern ... | ||
| .Nm pkill | ||
| .Op Fl Ar signal | ||
| .Op Fl ILafilnovx | ||
| .Op Fl ATr signal | ||
| .Op Fl ITLafilnovx | ||
| .Op Fl F Ar pidfile | ||
| .Op Fl G Ar gid | ||
| .Op Fl M Ar core | ||
| ... | ... | |
| A single dash | ||
| .Pq Ql - | ||
| matches processes not associated with a terminal. | ||
| .It Fl T | ||
| Restrict matches to processes associated with the current terminal. | ||
| .It Fl u Ar euid | ||
| Restrict matches to processes with an effective user ID in the | ||
| comma-separated list | ||
| usr.bin/pkill/pkill.c | ||
|---|---|---|
| int | ||
| main(int argc, char **argv) | ||
| { | ||
| 	char buf[_POSIX2_LINE_MAX], *mstr, **pargv, *p, *q, *pidfile; | ||
| 	char buf[_POSIX2_LINE_MAX], *mstr, **pargv, *p, *q, *pidfile, *this_tty; | ||
| 	const char *execf, *coref; | ||
| 	int ancestors, debug_opt, did_action; | ||
| 	int i, ch, bestidx, rv, criteria, pidfromfile, pidfilelock; | ||
| ... | ... | |
| 	execf = NULL; | ||
| 	coref = _PATH_DEVNULL; | ||
| 	while ((ch = getopt(argc, argv, "DF:G:ILM:N:P:SU:ac:d:fg:ij:lnoqs:t:u:vx")) != -1) | ||
| 	while ((ch = getopt(argc, argv, "DF:G:ILM:N:P:STU:ac:d:fg:ij:lnoqs:t:u:vx")) != -1) | ||
| 		switch (ch) { | ||
| 		case 'D': | ||
| 			debug_opt++; | ||
| ... | ... | |
| 			makelist(&tdevlist, LT_TTY, optarg); | ||
| 			criteria = 1; | ||
| 			break; | ||
| 		case 'T': | ||
| 			this_tty = ttyname(0) + sizeof(_PATH_DEV) - 1; | ||
| 			makelist(&tdevlist, LT_TTY, this_tty); | ||
| 			break; | ||
| 		case 'u': | ||
| 			makelist(&euidlist, LT_USER, optarg); | ||
| 			criteria = 1; | ||
| ... | ... | |
| 	fprintf(stderr, | ||
| 		"usage: %s %s [-F pidfile] [-G gid] [-M core] [-N system]\n" | ||
| 		"             [-P ppid] [-U uid] [-c class] [-g pgrp] [-j jid]\n" | ||
| 		"             [-s sid] [-t tty] [-u euid] pattern ...\n", | ||
| 		"             [-s sid] [-T] [-t tty] [-u euid] pattern ...\n", | ||
| 		getprogname(), ustr); | ||
| 	exit(STATUS_BADUSAGE); | ||