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

Этот коммит содержится в:
sin
2014-11-21 12:03:27 +00:00
родитель 2b39f20675
Коммит 2d685482af
2 изменённых файлов: 37 добавлений и 26 удалений
+35 -24
Просмотреть файл
@@ -1,25 +1,36 @@
.TH CMP 1 sbase\-VERSION .Dd November 21, 2014
.SH NAME .Dt CMP 1 sbase\-VERSION
cmp \- compare two files .Os
.SH SYNOPSIS .Sh NAME
.B cmp .Nm cmp
.RB [ \-ls ] .Nd compare two files
.RI file1 .Sh SYNOPSIS
.RI file2 .Nm cmp
.SH DESCRIPTION .Op Fl l | Fl s
.B cmp .Ar file1 file2
compares two files byte by byte. If the files differ, cmp prints the byte and .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. line number at which the difference occurred.
.P .Pp
The status code is 0 if the files are identical, and 1 if not. If an error .Sh OPTIONS
occurred the status code is 2. .Bl -tag -width Ds
.SH OPTIONS .It Fl l
.TP Prints the byte number, and the differing bytes (in octal), for each difference.
.B \-l .It Fl s
prints the byte number, and the differing bytes (in octal), for each difference. Prints nothing, only returns status.
.TP .El
.B \-s .Sh EXIT STATUS
prints nothing, only returns status. .Bl -tag -width Ds
.SH SEE ALSO .It 0
.IR comm (1), The files are identical.
.IR diff (1) .It 1
The files are different.
.It >1
An error occured.
.El
.Sh SEE ALSO
.Xr comm 1 ,
.Xr diff 1
+2 -2
Просмотреть файл
@@ -10,7 +10,7 @@ enum { Same = 0, Diff = 1, Error = 2 };
static void static void
usage(void) usage(void)
{ {
enprintf(Error, "usage: %s [-ls] file1 file2\n", argv0); enprintf(Error, "usage: %s [-l | -s] file1 file2\n", argv0);
} }
int int
@@ -34,7 +34,7 @@ main(int argc, char *argv[])
usage(); usage();
} ARGEND; } ARGEND;
if (argc != 2) if (argc != 2 || (lflag && sflag))
usage(); usage();
if (argv[0][0] == '-' && !argv[0][1]) if (argv[0][0] == '-' && !argv[0][1])