From nobody Thu Aug 04 23:52:39 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4LzQWq5LFGz4YKs5; Thu, 4 Aug 2022 23:52:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4LzQWq4cvsz45gr; Thu, 4 Aug 2022 23:52:39 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1659657159; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Pre7mIeNiWDLYSqIhPEMR96kJLKTa6JNUrp9VbNPj5s=; b=sU28iaNH0JgefqmrGTYTsfGTP+sAORDWjqu5hrCLotU/fNM535CFWL03GdH7GsXUUrfoaV 9nJVbNpNJ9u1SPcLy/HHPOM8Hh0HnjP//bgNSqy3oeIEl4c9wva3O4mt+GRj7CoTzVgFVE 0NFUOfPyChZfOCEYLGtIaHsESOlMlC2hEHD/tP5WxrpJPbzl88B78SEelY7HNzawNOG84Y XTb6qLYPOOEldfLkB4IHLNQIRZEptpeEePtviopJyfr29tg3IUlDB6v+Nq3/QgUHMBeXIp b35KwApkGO3AOTZZHd2KAuGGLU9gmxaPXrmOOYAj2jWfN8Pmm/YtWhcLe9s1rw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4LzQWq3f2fzYmM; Thu, 4 Aug 2022 23:52:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 274NqddX071151; Thu, 4 Aug 2022 23:52:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 274Nqd5h071150; Thu, 4 Aug 2022 23:52:39 GMT (envelope-from git) Date: Thu, 4 Aug 2022 23:52:39 GMT Message-Id: <202208042352.274Nqd5h071150@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: =?utf-8?Q?Dag-Erling=20Sm=C3=B8rgrav?= Subject: git: e24c5c60d724 - main - renice: support -- as per POSIX. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: des X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e24c5c60d724120d137f9e5db4e59cf67fd06ba2 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1659657159; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Pre7mIeNiWDLYSqIhPEMR96kJLKTa6JNUrp9VbNPj5s=; b=Epg5t0ZD67yft4uT9bD+bVkvML8IM0Z6rqShBeD+ZUSJ8OzT6T2QXIyaNTWJ/BksHyEB+X eR7IXiPComCrIhMsTylGxDhpFjN6xZ0VSRou0e0Z84tj3ZQyPc2q1tDx2h5/LA+Wh+bCft H0Su+EYWBZR/ur30CN6lsfHSE9kJ3bdpZyk1WD9lovRA0CPiiFPdako3ysmAPLtRLZ7RMK 2Ao2M6REzf6oGSQwKwT+bsi0oKajpDjWxjo04J/mtqNXyuz9jUUgVRq6xrwDDF/Hn0Q6S+ /eQsCJ15xCgxhHFnGhtwK5oNoWRKVRwNqgAlvKZ+iew5eSckZtpebE0Lc3RFvA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1659657159; a=rsa-sha256; cv=none; b=lUR3jCgJaj/Cpq8r9zbJzKYR4grwGFqMyJAE6GvikfQfUIq89i8vzJCP48IJ78YQVgXZI/ yKeZ6CAhmQJiF6dheP8nqf8DOWPoHbzgZyiIDR5QJrNeoM7mxFR83AW/+EB2/v9l04ZJ3Z 3DUFy0VhdvylWter3jNsW1zvJLFSo5zymlDwXxfWyYAGT/HV6bsZoQ9AYh02naNp5Vq2N2 un3IdSZRlKZ9pILhQxYDXdhMcvjZOaU6KQhfxmn5bjtMZkscsrW5QP4RwL5zk9qNXZdx9p DZ4Ek2Yg9LVWb2WdHWH27A3sRkym0UloXHtLs8m2jouyjB/xKe5jJwzZ6mRlFA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=e24c5c60d724120d137f9e5db4e59cf67fd06ba2 commit e24c5c60d724120d137f9e5db4e59cf67fd06ba2 Author: Dag-Erling Smørgrav AuthorDate: 2022-08-04 23:50:00 +0000 Commit: Dag-Erling Smørgrav 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)