aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDag-Erling Smørgrav <des@FreeBSD.org>2022-08-04 23:50:00 +0000
committerDag-Erling Smørgrav <des@FreeBSD.org>2022-08-04 23:52:02 +0000
commite24c5c60d724120d137f9e5db4e59cf67fd06ba2 (patch)
treeaa1d11379d7098d766086c09512b04554d40805c
parent23c8b19c1d13b8fbd10c5941de0f2618f59db1c9 (diff)
downloadsrc-e24c5c60d724120d137f9e5db4e59cf67fd06ba2.tar.gz
src-e24c5c60d724120d137f9e5db4e59cf67fd06ba2.zip
renice: support -- as per POSIX.
Sponsored by: Klara, Inc. MFC after: 1 week
-rw-r--r--usr.bin/renice/renice.c31
1 files changed, 19 insertions, 12 deletions
diff --git a/usr.bin/renice/renice.c b/usr.bin/renice/renice.c
index 67917f96e1f8..fd442b425897 100644
--- a/usr.bin/renice/renice.c
+++ b/usr.bin/renice/renice.c
@@ -69,8 +69,9 @@ int
main(int argc, char *argv[])
{
struct passwd *pwd;
- int errs, incr, prio, which, who;
+ int delim, errs, incr, prio, which, who;
+ delim = 0;
errs = 0;
incr = 0;
which = PRIO_PROCESS;
@@ -88,17 +89,23 @@ main(int argc, char *argv[])
return (1);
argc--, argv++;
for (; argc > 0; argc--, argv++) {
- if (strcmp(*argv, "-g") == 0) {
- which = PRIO_PGRP;
- continue;
- }
- if (strcmp(*argv, "-u") == 0) {
- which = PRIO_USER;
- continue;
- }
- if (strcmp(*argv, "-p") == 0) {
- which = PRIO_PROCESS;
- continue;
+ if (!delim) {
+ if (strcmp(*argv, "-g") == 0) {
+ which = PRIO_PGRP;
+ continue;
+ }
+ if (strcmp(*argv, "-u") == 0) {
+ which = PRIO_USER;
+ continue;
+ }
+ if (strcmp(*argv, "-p") == 0) {
+ which = PRIO_PROCESS;
+ continue;
+ }
+ if (strcmp(*argv, "--") == 0) {
+ delim = 1;
+ continue;
+ }
}
if (which == PRIO_USER) {
if ((pwd = getpwnam(*argv)) != NULL)