summaryrefslogtreecommitdiffstats
path: root/usr.bin/cksum
diff options
context:
space:
mode:
authorcharnier <charnier@FreeBSD.org>1999-12-05 20:03:22 +0000
committercharnier <charnier@FreeBSD.org>1999-12-05 20:03:22 +0000
commitf585d4fa84ca5e1ad268e6d90704357091bf7416 (patch)
treec99f666bbacc0df65011d6ec87e51e58a6b9b8df /usr.bin/cksum
parentc32cda93bb0a38fcd29308dd4bfc8c21cc56270e (diff)
downloadFreeBSD-src-f585d4fa84ca5e1ad268e6d90704357091bf7416.zip
FreeBSD-src-f585d4fa84ca5e1ad268e6d90704357091bf7416.tar.gz
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.
Diffstat (limited to 'usr.bin/cksum')
-rw-r--r--usr.bin/cksum/cksum.122
-rw-r--r--usr.bin/cksum/cksum.c7
-rw-r--r--usr.bin/cksum/crc.c6
-rw-r--r--usr.bin/cksum/crc32.c5
-rw-r--r--usr.bin/cksum/print.c6
-rw-r--r--usr.bin/cksum/sum1.c6
-rw-r--r--usr.bin/cksum/sum2.c6
7 files changed, 38 insertions, 20 deletions
diff --git a/usr.bin/cksum/cksum.1 b/usr.bin/cksum/cksum.1
index 66a1d18..1b36ef8 100644
--- a/usr.bin/cksum/cksum.1
+++ b/usr.bin/cksum/cksum.1
@@ -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 .
diff --git a/usr.bin/cksum/cksum.c b/usr.bin/cksum/cksum.c
index 01a7165..1411abe 100644
--- a/usr.bin/cksum/cksum.c
+++ b/usr.bin/cksum/cksum.c
@@ -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);
}
diff --git a/usr.bin/cksum/crc.c b/usr.bin/cksum/crc.c
index 0dde11d..1dc0293 100644
--- a/usr.bin/cksum/crc.c
+++ b/usr.bin/cksum/crc.c
@@ -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>
diff --git a/usr.bin/cksum/crc32.c b/usr.bin/cksum/crc32.c
index 6938ba6..ae49a83 100644
--- a/usr.bin/cksum/crc32.c
+++ b/usr.bin/cksum/crc32.c
@@ -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])
diff --git a/usr.bin/cksum/print.c b/usr.bin/cksum/print.c
index b3a92d3..d3b8ce4 100644
--- a/usr.bin/cksum/print.c
+++ b/usr.bin/cksum/print.c
@@ -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>
diff --git a/usr.bin/cksum/sum1.c b/usr.bin/cksum/sum1.c
index a46a575..bcdeb30 100644
--- a/usr.bin/cksum/sum1.c
+++ b/usr.bin/cksum/sum1.c
@@ -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>
diff --git a/usr.bin/cksum/sum2.c b/usr.bin/cksum/sum2.c
index 11abb2c..4ce83f6 100644
--- a/usr.bin/cksum/sum2.c
+++ b/usr.bin/cksum/sum2.c
@@ -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>
OpenPOWER on IntegriCloud