[hackers] [sbase] Update cmp(1) manpage to new style and do not allow both -l and -s to be set || sin

From: <git_AT_suckless.org>
Date: Fri, 21 Nov 2014 13:04:14 +0100

commit 2d685482afbb89570f0b62b0e0a6006228fe5d27
Author: sin <sin_AT_2f30.org>
Date: Fri Nov 21 12:03:27 2014 +0000

    Update cmp(1) manpage to new style and do not allow both -l and -s to be set

diff --git a/cmp.1 b/cmp.1
index 02b5631..dc345d9 100644
--- a/cmp.1
+++ b/cmp.1
_AT_@ -1,25 +1,36 @@
-.TH CMP 1 sbase\-VERSION
-.SH NAME
-cmp \- compare two files
-.SH SYNOPSIS
-.B cmp
-.RB [ \-ls ]
-.RI file1
-.RI file2
-.SH DESCRIPTION
-.B cmp
-compares two files byte by byte. If the files differ, cmp prints the byte and
+.Dd November 21, 2014
+.Dt CMP 1 sbase\-VERSION
+.Os
+.Sh NAME
+.Nm cmp
+.Nd compare two files
+.Sh SYNOPSIS
+.Nm cmp
+.Op Fl l | Fl s
+.Ar file1 file2
+.Sh DESCRIPTION
+.Nm
+compares two files byte by byte. If the files differ,
+.Nm
+prints the byte and
 line number at which the difference occurred.
-.P
-The status code is 0 if the files are identical, and 1 if not. If an error
-occurred the status code is 2.
-.SH OPTIONS
-.TP
-.B \-l
-prints the byte number, and the differing bytes (in octal), for each difference.
-.TP
-.B \-s
-prints nothing, only returns status.
-.SH SEE ALSO
-.IR comm (1),
-.IR diff (1)
+.Pp
+.Sh OPTIONS
+.Bl -tag -width Ds
+.It Fl l
+Prints the byte number, and the differing bytes (in octal), for each difference.
+.It Fl s
+Prints nothing, only returns status.
+.El
+.Sh EXIT STATUS
+.Bl -tag -width Ds
+.It 0
+The files are identical.
+.It 1
+The files are different.
+.It >1
+An error occured.
+.El
+.Sh SEE ALSO
+.Xr comm 1 ,
+.Xr diff 1
diff --git a/cmp.c b/cmp.c
index 976bc00..a11538e 100644
--- a/cmp.c
+++ b/cmp.c
_AT_@ -10,7 +10,7 @@ enum { Same = 0, Diff = 1, Error = 2 };
 static void
 usage(void)
 {
- enprintf(Error, "usage: %s [-ls] file1 file2\n", argv0);
+ enprintf(Error, "usage: %s [-l | -s] file1 file2\n", argv0);
 }
 
 int
_AT_@ -34,7 +34,7 @@ main(int argc, char *argv[])
                 usage();
         } ARGEND;
 
- if (argc != 2)
+ if (argc != 2 || (lflag && sflag))
                 usage();
 
         if (argv[0][0] == '-' && !argv[0][1])
Received on Fri Nov 21 2014 - 13:04:14 CET

This archive was generated by hypermail 2.3.0 : Fri Nov 21 2014 - 13:12:09 CET