git: 14c7492637ec - main - sdiff.1: Document exit status and --help

From: Mateusz Piotrowski <0mp_at_FreeBSD.org>
Date: Wed, 23 Sep 2026 14:42:41 UTC
The branch main has been updated by 0mp:

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

commit 14c7492637ec0644b5bb88da114e8cc76b9bf629
Author:     Mateusz Piotrowski <0mp@FreeBSD.org>
AuthorDate: 2026-09-23 14:19:05 +0000
Commit:     Mateusz Piotrowski <0mp@FreeBSD.org>
CommitDate: 2026-09-23 14:41:57 +0000

    sdiff.1: Document exit status and --help
    
    MFC after:      3 days
    Approved by:    bnovkov (mentor)
    Sponsored by:   fme AG
    Differential Revision:  https://reviews.freebsd.org/D59927
---
 usr.bin/sdiff/sdiff.1 | 23 ++++++++++++++++++++++-
 usr.bin/sdiff/sdiff.c |  1 +
 2 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/usr.bin/sdiff/sdiff.1 b/usr.bin/sdiff/sdiff.1
index e228ece64331..ced741eec31e 100644
--- a/usr.bin/sdiff/sdiff.1
+++ b/usr.bin/sdiff/sdiff.1
@@ -3,7 +3,7 @@
 .\" Written by Raymond Lai <ray@cyth.net>.
 .\" Public domain.
 .\"
-.Dd February 16, 2024
+.Dd September 23, 2026
 .Dt SDIFF 1
 .Os
 .Sh NAME
@@ -17,6 +17,8 @@
 .Op Fl w Ar width
 .Ar file1
 .Ar file2
+.Nm sdiff
+.Fl -help
 .Sh DESCRIPTION
 .Nm
 displays two files side by side,
@@ -85,6 +87,8 @@ Print a maximum of
 .Ar width
 characters on each line.
 The default is 130 characters.
+.It Fl -help
+Print the usage message and exit.
 .El
 .Pp
 Options passed to
@@ -153,6 +157,23 @@ Specifies a directory for temporary files to be created.
 The default is
 .Pa /tmp .
 .El
+.Sh EXIT STATUS
+The
+.Nm
+utility exits with one of the following values:
+.Pp
+.Bl -tag -width Ds -offset indent -compact
+.It 0
+No differences were found.
+.It 1
+Differences were found.
+.It >1
+An error occurred.
+.El
+.Pp
+The
+.Fl -help
+option exits with a status of 0.
 .Sh SEE ALSO
 .Xr cmp 1 ,
 .Xr diff 1 ,
diff --git a/usr.bin/sdiff/sdiff.c b/usr.bin/sdiff/sdiff.c
index b796bb4224a8..628e6cde46d9 100644
--- a/usr.bin/sdiff/sdiff.c
+++ b/usr.bin/sdiff/sdiff.c
@@ -117,6 +117,7 @@ static struct option longopts[] = {
 
 static const char *help_msg[] = {
 	"usage: sdiff [-abdilstW] [-I regexp] [-o outfile] [-w width] file1 file2\n",
+	"       sdiff --help\n",
 	"-l, --left-column: only print the left column for identical lines.",
 	"-o OUTFILE, --output=OUTFILE: interactively merge file1 and file2 into outfile.",
 	"-s, --suppress-common-lines: skip identical lines.",