Minimal use of .Ar and .Nm.
Add section number to .Xr reference. Add DIAGNOSTICS section name. Remove unused #includes. Be consistant in the parsing of flags and add missing option in usage string. Add rcsid.
This commit is contained in:
parent
c32cda93bb
commit
f585d4fa84
@ -52,12 +52,12 @@
|
||||
.Ar \&3
|
||||
.Xc
|
||||
.Oc
|
||||
.Op Ar file ...
|
||||
.Op Ar
|
||||
.Nm sum
|
||||
.Op Ar file ...
|
||||
.Op Ar
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Nm cksum
|
||||
.Nm
|
||||
utility writes to the standard output three whitespace separated
|
||||
fields for each input file.
|
||||
These fields are a checksum
|
||||
@ -69,7 +69,7 @@ is written.
|
||||
The
|
||||
.Nm sum
|
||||
utility is identical to the
|
||||
.Nm cksum
|
||||
.Nm
|
||||
utility, except that it defaults to using historic algorithm 1, as
|
||||
described below.
|
||||
It is provided for compatibility only.
|
||||
@ -86,7 +86,7 @@ systems as the
|
||||
algorithm and by historic
|
||||
.At V
|
||||
systems as the
|
||||
.Xr sum
|
||||
.Xr sum 1
|
||||
algorithm when using the
|
||||
.Fl r
|
||||
option.
|
||||
@ -97,7 +97,7 @@ Algorithm 2 is the algorithm used by historic
|
||||
.At V
|
||||
systems as the
|
||||
default
|
||||
.Xr sum
|
||||
.Xr sum 1
|
||||
algorithm.
|
||||
This is a 32-bit checksum, and is defined as follows:
|
||||
.Bd -unfilled -offset indent
|
||||
@ -125,7 +125,7 @@ used is based on the polynomial used for
|
||||
.Tn CRC
|
||||
error checking
|
||||
in the networking standard
|
||||
.St -iso8802-3
|
||||
.St -iso8802-3 .
|
||||
The
|
||||
.Tn CRC
|
||||
checksum encoding is defined by the generating polynomial:
|
||||
@ -162,9 +162,9 @@ The coefficients of R(x) are considered to be a 32-bit sequence.
|
||||
.Pp
|
||||
The bit sequence is complemented and the result is the CRC.
|
||||
.Ed
|
||||
.Pp
|
||||
.Sh DIAGNOSTICS
|
||||
The
|
||||
.Nm cksum
|
||||
.Nm
|
||||
and
|
||||
.Nm sum
|
||||
utilities exit 0 on success, and >0 if an error occurs.
|
||||
@ -183,11 +183,11 @@ article.
|
||||
.Re
|
||||
.Sh STANDARDS
|
||||
The
|
||||
.Nm cksum
|
||||
.Nm
|
||||
utility is expected to conform to
|
||||
.St -p1003.2-92 .
|
||||
.Sh HISTORY
|
||||
The
|
||||
.Nm cksum
|
||||
.Nm
|
||||
utility appeared in
|
||||
.Bx 4.4 .
|
||||
|
@ -48,14 +48,11 @@ static const char rcsid[] =
|
||||
"$FreeBSD$";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <err.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
@ -95,7 +92,7 @@ main(argc, argv)
|
||||
} else if (!strcmp(optarg, "2")) {
|
||||
cfncn = csum2;
|
||||
pfncn = psum2;
|
||||
} else if (*optarg == '3') {
|
||||
} else if (!strcmp(optarg, "3")) {
|
||||
cfncn = crc32;
|
||||
pfncn = pcrc;
|
||||
} else {
|
||||
@ -136,7 +133,7 @@ main(argc, argv)
|
||||
static void
|
||||
usage()
|
||||
{
|
||||
(void)fprintf(stderr, "usage: cksum [-o 1 | 2] [file ...]\n");
|
||||
(void)fprintf(stderr, "usage: cksum [-o 1 | 2 | 3] [file ...]\n");
|
||||
(void)fprintf(stderr, " sum [file ...]\n");
|
||||
exit(1);
|
||||
}
|
||||
|
@ -35,7 +35,11 @@
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static const char sccsid[] = "@(#)crc.c 8.1 (Berkeley) 6/17/93";
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)crc.c 8.1 (Berkeley) 6/17/93";
|
||||
#endif
|
||||
static const char rcsid[] =
|
||||
"$FreeBSD$";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/types.h>
|
||||
|
@ -11,6 +11,11 @@
|
||||
* Spencer Garrett <srg@quick.com>
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"$FreeBSD$";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#define CRC(crc, ch) (crc = (crc >> 8) ^ crctab[(crc ^ (ch)) & 0xff])
|
||||
|
@ -32,7 +32,11 @@
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static const char sccsid[] = "@(#)print.c 8.1 (Berkeley) 6/6/93";
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)print.c 8.1 (Berkeley) 6/6/93";
|
||||
#endif
|
||||
static const char rcsid[] =
|
||||
"$FreeBSD$";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/types.h>
|
||||
|
@ -32,7 +32,11 @@
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static const char sccsid[] = "@(#)sum1.c 8.1 (Berkeley) 6/6/93";
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)sum1.c 8.1 (Berkeley) 6/6/93";
|
||||
#endif
|
||||
static const char rcsid[] =
|
||||
"$FreeBSD$";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/types.h>
|
||||
|
@ -32,7 +32,11 @@
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static const char sccsid[] = "@(#)sum2.c 8.1 (Berkeley) 6/6/93";
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)sum2.c 8.1 (Berkeley) 6/6/93";
|
||||
#endif
|
||||
static const char rcsid[] =
|
||||
"$FreeBSD$";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/types.h>
|
||||
|
Loading…
Reference in New Issue
Block a user