From owner-dev-commits-src-all@freebsd.org Sun Oct 3 05:20:53 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C36656B1299; Sun, 3 Oct 2021 05:20:53 +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 4HMXHn4mR5z4Ryn; Sun, 3 Oct 2021 05:20:53 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 81416205EF; Sun, 3 Oct 2021 05:20:53 +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 1935KrAB020849; Sun, 3 Oct 2021 05:20:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1935KrAW020848; Sun, 3 Oct 2021 05:20:53 GMT (envelope-from git) Date: Sun, 3 Oct 2021 05:20:53 GMT Message-Id: <202110030520.1935KrAW020848@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kyle Evans Subject: git: ca052baa603a - stable/12 - cmp(1): Add EXAMPLES section 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/stable/12 X-Git-Reftype: branch X-Git-Commit: ca052baa603aa5743c616d89c2fb2dfdb6fcd4ea Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Oct 2021 05:20:53 -0000 The branch stable/12 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=ca052baa603aa5743c616d89c2fb2dfdb6fcd4ea commit ca052baa603aa5743c616d89c2fb2dfdb6fcd4ea Author: Fernando ApesteguĂ­a AuthorDate: 2020-06-20 11:20:16 +0000 Commit: Kyle Evans CommitDate: 2021-10-03 05:19:56 +0000 cmp(1): Add EXAMPLES section Add a small number of examples depicting the use of -l, -z and byte offsets (cherry picked from commit 1831993577db18d193e94269e337f6286536814e) --- usr.bin/cmp/cmp.1 | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/usr.bin/cmp/cmp.1 b/usr.bin/cmp/cmp.1 index 094509dda08b..fc05fb893147 100644 --- a/usr.bin/cmp/cmp.1 +++ b/usr.bin/cmp/cmp.1 @@ -31,7 +31,7 @@ .\" @(#)cmp.1 8.1 (Berkeley) 6/6/93 .\" $FreeBSD$ .\" -.Dd June 16, 2020 +.Dd June 20, 2020 .Dt CMP 1 .Os .Sh NAME @@ -107,26 +107,33 @@ file (before any differences were found). An error occurred. .El .Sh EXAMPLES -Assuming a file named example.txt with the following contents: +Assuming a file named +.Pa example.txt +with the following contents: .Bd -literal -offset indent a b c .Ed .Pp -Compare stdin with example.txt: +Compare stdin with +.Pa example.txt : .Bd -literal -offset indent $ echo -e "a\\nb\\nc" | cmp - example.txt .Ed .Pp -Same as above but introducing a change in byte three in stdin. +Same as above but introducing a change in the third byte of stdin. Show the byte number (decimal) and differing byte (octal): .Bd -literal -offset indent $ echo -e "a\\nR\\nc" | cmp -l - example.txt 3 122 142 .Ed .Pp -Compare example.txt and /boot/loader.conf exiting if size differs. +Compare file sizes of +.Pa example.txt +and +.Pa /boot/loader.conf +and return 1 if they are not equal. Note that .Fl z can only be used with regular files: @@ -135,8 +142,10 @@ $ cmp -z example.txt /boot/loader.conf example.txt /boot/loader.conf differ: size .Ed .Pp -Compare stdin with file example.txt omitting the 4 first bytes from stdin and -the 2 first bytes from example.txt: +Compare stdin with +.Pa example.txt +omitting the first 4 bytes from stdin and the first 2 bytes from +.Pa example.txt : .Bd -literal -offset indent $ echo -e "a\\nR\\nb\\nc" | cmp - example.txt 4 2 .Ed