git: e24c5c60d724 - main - renice: support -- as per POSIX.

From: Dag-Erling Smørgrav <des_at_FreeBSD.org>
Date: Thu, 04 Aug 2022 23:52:39 UTC
The branch main has been updated by des:

URL: https://cgit.FreeBSD.org/src/commit/?id=e24c5c60d724120d137f9e5db4e59cf67fd06ba2

commit e24c5c60d724120d137f9e5db4e59cf67fd06ba2
Author:     Dag-Erling Smørgrav <des@FreeBSD.org>
AuthorDate: 2022-08-04 23:50:00 +0000
Commit:     Dag-Erling Smørgrav <des@FreeBSD.org>
CommitDate: 2022-08-04 23:52:02 +0000

    renice: support -- as per POSIX.
    
    Sponsored by:   Klara, Inc.
    MFC after:      1 week
---
 usr.bin/renice/renice.c | 31 +++++++++++++++++++------------
 1 file 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)