From nobody Mon Oct 31 03:56:02 2022 X-Original-To: dev-commits-src-main@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 4N0zpV4Kb7z4gVgw; Mon, 31 Oct 2022 03:56:02 +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 4N0zpV3q3Rz3f5Z; Mon, 31 Oct 2022 03:56:02 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1667188562; 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=gWb1pjCbVDY+9BrCZsoPMYkgfJ1lkDYWh88AXWmHUK0=; b=Rg2+Ir2qpy3nvd/V53QSWOzVFZ9vT1ZNBmHUdDtsYsiIZyPduEfQWZnBCuAEyDZPzSQAWW V+mxeknosswVviag9GNEU2CBJT9Z+QGNAJxxYHQgWngimbJYW0/Ggh/OuDbItuCxZJCTjr rLxO6LUgRBmrTxkP5RY1cpqyWXhJ1+GqYj7/UoTWBQ5ZDQ8mTlDjwR7WreggV7XXMjW4+a PJ5NERRqCnqudIMu5EkxeLiKBqQiEXypAoDWx/cvD9w6iPp2e9wprhguY0649Om/3dxI4b KPoZ7E3fWqZa7VeqdNOc01JRMp+E2ugesleRj8Golc70U8mAL/3EbcBVcNzbtA== 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 4N0zpV2rc0zMw9; Mon, 31 Oct 2022 03:56:02 +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 29V3u2f8075266; Mon, 31 Oct 2022 03:56:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 29V3u2xQ075265; Mon, 31 Oct 2022 03:56:02 GMT (envelope-from git) Date: Mon, 31 Oct 2022 03:56:02 GMT Message-Id: <202210310356.29V3u2xQ075265@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: cfc57d7dbe5b - main - mktemp: add some GNU-compatible long options List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: cfc57d7dbe5bff175ef6d508fecd6779c0a0d656 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1667188562; 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=gWb1pjCbVDY+9BrCZsoPMYkgfJ1lkDYWh88AXWmHUK0=; b=nkGoe2+Drrtgj7g/4ccTnaAs7Vqt0c/5clwSC0EXy7iDZfax/52KYx1iGJwZ/jWsHjKF8j JEFYnrRdCjZgkuQZ0WtLxizZOVa7LmOQYpWfjbzTeoIC3IrPQnlaJajOUP126XuSqwtvfG DiGcefm8/lrgcyKSdP/AD5Ql/0uaZozoKsDoyBwGd811S+iKyUpxEpRpcLUyBww4jisAnZ IY7RdcEaxdvnj3Kr7UdyPqKSw0kErf00HK7LF/vwVWgr2lLwwbC93XEMpLgRRx9si1qc0i XcASvvzqsHiv23+r24aXvJ5c5+m5+EJIeHKh0XF2s7ud5rbAHkem12GQMYX7Gw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1667188562; a=rsa-sha256; cv=none; b=APjYVBQRgu5AEz6ysrHeojMb2Dc6UkxOyi5yFMuDzNYSRv0hMs3MMgFtYbCB55zvIc5CTZ N/u0NHjfIb3GFZlPwMcmzwb2Q8So/KsykDJVi3Co7OuG2AjfL1nuBN4wRCk1wUp0jslfs9 ebA3cNqViMYEZltEB7bw9INQO2xloWi+W5QNWe9xfaNBj+hA2B+73IeXAmUx3ZmZBqJzv3 SSWLGBnV/MABUCn8LKLV2L+gw/HHE/wHRkt9gj+6fA3Co0MG3psrektQVCRf2K6hdy05B3 i3f9EuoQG4o1fun+OGfy0wr7q+6fi9BX60i7UfeMxL57wQw/3ZMPH9+qdRjvQg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=cfc57d7dbe5bff175ef6d508fecd6779c0a0d656 commit cfc57d7dbe5bff175ef6d508fecd6779c0a0d656 Author: Kyle Evans AuthorDate: 2022-10-31 03:55:46 +0000 Commit: Kyle Evans CommitDate: 2022-10-31 03:55:46 +0000 mktemp: add some GNU-compatible long options GNU maketemp has long options for -d, -q, and -u, so let's add these now for compatibility. Reviewed by: emaste, imp, wosch Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D37120 --- usr.bin/mktemp/mktemp.1 | 8 ++++---- usr.bin/mktemp/mktemp.c | 10 +++++++++- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/usr.bin/mktemp/mktemp.1 b/usr.bin/mktemp/mktemp.1 index c8d7f6232632..469d4f6097d0 100644 --- a/usr.bin/mktemp/mktemp.1 +++ b/usr.bin/mktemp/mktemp.1 @@ -28,7 +28,7 @@ .\" From: $OpenBSD: mktemp.1,v 1.8 1998/03/19 06:13:37 millert Exp $ .\" $FreeBSD$ .\" -.Dd December 30, 2005 +.Dd August 4, 2022 .Dt MKTEMP 1 .Os .Sh NAME @@ -132,9 +132,9 @@ be used instead. .Sh OPTIONS The available options are as follows: .Bl -tag -width indent -.It Fl d +.It Fl d , Fl -directory Make a directory instead of a file. -.It Fl q +.It Fl q , Fl -quiet Fail silently if an error occurs. This is useful if a script does not want error output to go to standard error. @@ -144,7 +144,7 @@ Generate a template (using the supplied and .Ev TMPDIR if set) to create a filename template. -.It Fl u +.It Fl u , Fl -dry-run Operate in .Dq unsafe mode. diff --git a/usr.bin/mktemp/mktemp.c b/usr.bin/mktemp/mktemp.c index 754cc8da7e4e..9240197e9129 100644 --- a/usr.bin/mktemp/mktemp.c +++ b/usr.bin/mktemp/mktemp.c @@ -37,6 +37,7 @@ */ #include +#include #include #include #include @@ -50,6 +51,13 @@ static const char rcsid[] = static void usage(void); +static const struct option long_opts[] = { + {"directory", no_argument, NULL, 'd'}, + {"quiet", no_argument, NULL, 'q'}, + {"dry-run", no_argument, NULL, 'u'}, + {NULL, no_argument, NULL, 0}, +}; + int main(int argc, char **argv) { @@ -63,7 +71,7 @@ main(int argc, char **argv) prefix = "mktemp"; name = NULL; - while ((c = getopt(argc, argv, "dqt:u")) != -1) + while ((c = getopt_long(argc, argv, "dqt:u", long_opts, NULL)) != -1) switch (c) { case 'd': dflag++;