From nobody Mon Dec 09 19:45:19 2024 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 4Y6XQS0X2lz5ghvl; Mon, 09 Dec 2024 19:45:20 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Y6XQS00DVz44P7; Mon, 9 Dec 2024 19:45:20 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733773520; 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=hpvqOedn8wu42Bkm5DRVoosyXFUX4QcYvtAQ3QhRBIg=; b=OiOZclX16RFgHGwoqbjlReJrSffsjgldtl4nA93nKPuVfqE7hlE8kGyGn99B/BJrvMtORq 6tAd6dypxG8j5BKna8y3MROR8nqHxJ1Z2nBHqbFom1+aUOI7qx6l1Ttwf8E1bpTbLC4p7B CaFpmfqm+98JICtdlOcTlBwutGGCVRU3IEN3yAaf0oKxqzjg+RQsJHlhC4DFFVZ1xHbHIl X+AQgOWefSWb2ABBfmxPijypK/UpUQO/V9Oo6dbZOT+f+b4g3Plv3DfXfFGXQ7ZA95wsGF jN8s2ALsJ6WXh7FgV/TCDGpYxQLD18RVfnlwgFBu7OJ+KBGLVjXQe0UiwoLAGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733773520; 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=hpvqOedn8wu42Bkm5DRVoosyXFUX4QcYvtAQ3QhRBIg=; b=SelYICUzu3qB5LtwVQ+F4nOjOJPwMzdmFvoFFJqHlZRRvgN05qWadK5xxh+CgtZOmfMxKV ABZB4YWnMmYrwvd9iMD2ytaJwIezneYEXPHvZMQNjzNjKBZoCbG8oX/PEmGxTLpKScSLmr wwjKz9YQrq+fhNRynu14PlZ0JwOK5x1MuslMvMlg2jnqokXeICvdLG5aVRKbGk6dzUm0B7 uao3B89KK/rY5iVjDW9SCqhIxTaW7m0e/DN0cywCSEMDfFPcwLTtI/2yYwY3VF6OUTi39a 392/H404vAqxjuV9Cw+CkFo8cMMHvVoBA76/SoVep+ZkJtKEl22K/ednQLSbxA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1733773520; a=rsa-sha256; cv=none; b=jYbXQlHj3a4YIwDCBhxoDddYbetDBsrG6R+ZVaeRLhGP72buqg8kLFEGIBAehAbfIi0LEm cY6f/Ibu2dYgKZx5KjH2+OO+I7+3k3mLMXc/W2uSprUBpXQ5vuFxthNc6rI6XLWHE8hUEa zABHihfMaVLKIhilWsbF36axWBxlTZfa5ytLNtdEALmTvdpuJsp5xxGz4NwWBMCNH1QkcR AzxlrwJ5gABTPJsLrHYs5aPkNLD5jgY+gNxKPh/+L7NEpambtFm7EkFnQBxdm+OJNXg7c9 KbKC2F4hdQnkIIl7NYFlp8/JOy5vpKvBaUg1noDIVHdzIh6QX6CYEBPbCat5JA== 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 4Y6XQR6QkQzqy3; Mon, 9 Dec 2024 19:45:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 4B9JjJlQ009429; Mon, 9 Dec 2024 19:45:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4B9JjJZj009426; Mon, 9 Dec 2024 19:45:19 GMT (envelope-from git) Date: Mon, 9 Dec 2024 19:45:19 GMT Message-Id: <202412091945.4B9JjJZj009426@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dag-Erling =?utf-8?Q?Sm=C3=B8rgrav?= Subject: git: b93791f5e7b0 - main - uniq: Correctly document the -D option. 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: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@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: b93791f5e7b0246b121dd98c10d6563298d6b2b0 Auto-Submitted: auto-generated The branch main has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=b93791f5e7b0246b121dd98c10d6563298d6b2b0 commit b93791f5e7b0246b121dd98c10d6563298d6b2b0 Author: Dag-Erling Smørgrav AuthorDate: 2024-12-09 19:44:34 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2024-12-09 19:44:34 +0000 uniq: Correctly document the -D option. The -D option takes an optional argument; modify the usage message and the manual page's synopsis to correctly reflect this. Also update the tests to exercise -D with and without an argument. MFC after: 1 week Sponsored by: Klara, Inc. Reviewed by: asomers Differential Revision: https://reviews.freebsd.org/D47999 --- usr.bin/uniq/tests/uniq_test.sh | 13 +++++++++++++ usr.bin/uniq/uniq.1 | 6 +++--- usr.bin/uniq/uniq.c | 4 ++-- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/usr.bin/uniq/tests/uniq_test.sh b/usr.bin/uniq/tests/uniq_test.sh index 9d37245dee4e..fa37c1959a77 100755 --- a/usr.bin/uniq/tests/uniq_test.sh +++ b/usr.bin/uniq/tests/uniq_test.sh @@ -53,7 +53,12 @@ count_repeated_head() { count_repeated_body() { printf "a\na\nb\nb\na\n" >input printf " 2 a\n 2 b\n" >expected + atf_check_uniq -cd + atf_check_uniq -c -d + atf_check_uniq -dc + atf_check_uniq -d -c atf_check_uniq --count --repeated + atf_check_uniq --repeated --count } atf_test_case all_repeated @@ -64,7 +69,15 @@ all_repeated_body() { printf "a\na\nb\na\na\n" >input printf "a\na\na\na\n" >expected atf_check_uniq -D + atf_check_uniq -Dnone atf_check_uniq --all-repeated + atf_check_uniq --all-repeated=none + printf "\na\na\n\na\na\n" >expected + atf_check_uniq -Dprepend + atf_check_uniq --all-repeated=prepend + printf "a\na\n\na\na\n" >expected + atf_check_uniq -Dseparate + atf_check_uniq --all-repeated=separate } atf_test_case skip_fields diff --git a/usr.bin/uniq/uniq.1 b/usr.bin/uniq/uniq.1 index 30dee856d772..0918420e2229 100644 --- a/usr.bin/uniq/uniq.1 +++ b/usr.bin/uniq/uniq.1 @@ -28,7 +28,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd January 12, 2024 +.Dd December 9, 2024 .Dt UNIQ 1 .Os .Sh NAME @@ -36,8 +36,8 @@ .Nd report or filter out repeated lines in a file .Sh SYNOPSIS .Nm -.Op Fl c | Fl d | Fl D | Fl u -.Op Fl i +.Op Fl cdiu +.Op Fl D Ns Op Ar septype .Op Fl f Ar num .Op Fl s Ar chars .Oo diff --git a/usr.bin/uniq/uniq.c b/usr.bin/uniq/uniq.c index 9978c4996dc7..1c022e633cf3 100644 --- a/usr.bin/uniq/uniq.c +++ b/usr.bin/uniq/uniq.c @@ -366,7 +366,7 @@ obsolete(char *argv[]) static void usage(void) { - (void)fprintf(stderr, -"usage: uniq [-c | -d | -D | -u] [-i] [-f fields] [-s chars] [input [output]]\n"); + (void)fprintf(stderr, "usage: uniq [-cdiu] [-D[septype]] " + "[-f fields] [-s chars] [input [output]]\n"); exit(1); }