Correct use of .Nm. Spelling. Add rcsid, remove unused #includes, use err(3).
This commit is contained in:
parent
b50d7fae67
commit
23b5892f5e
@ -5,12 +5,12 @@
|
||||
.Nm md5
|
||||
.Nd calculate a message-digest fingerprint (checksum) for a file
|
||||
.Sh SYNOPSIS
|
||||
.Nm
|
||||
.Nm md5
|
||||
.Op Fl ptx
|
||||
.Op Fl s Ar string
|
||||
.Op Ar file ...
|
||||
.Sh DESCRIPTION
|
||||
.Nm
|
||||
.Nm Md5
|
||||
takes as input a message of arbitrary length and produces
|
||||
as output a 128-bit
|
||||
.Dq fingerprint
|
||||
@ -31,16 +31,16 @@ The following four options may be used in any combination and must
|
||||
precede any files named on the command line. The MD5
|
||||
sum of each file listed on the command line is printed after the options
|
||||
are processed.
|
||||
.Bl -tag -width Fl
|
||||
.Bl -tag -width indent
|
||||
.It Fl s Ar string
|
||||
prints a checksum of the given
|
||||
Print a checksum of the given
|
||||
.Ar string .
|
||||
.It Fl p
|
||||
echos stdin to stdout and appends the MD5 sum to stdout.
|
||||
Echo stdin to stdout and appends the MD5 sum to stdout.
|
||||
.It Fl t
|
||||
runs a built-in time trial.
|
||||
Run a built-in time trial.
|
||||
.It Fl x
|
||||
runs a built-in test script.
|
||||
Run a built-in test script.
|
||||
.El
|
||||
.Sh SEE ALSO
|
||||
.Xr cksum 1
|
||||
@ -49,6 +49,6 @@ runs a built-in test script.
|
||||
.%T The MD5 Message-Digest Algorithm
|
||||
.%O RFC1321
|
||||
.Re
|
||||
.Sh ACKNOWLEDGEMENTS
|
||||
.Sh ACKNOWLEDGMENTS
|
||||
This program is placed in the public domain for free general use by
|
||||
RSA Data Security.
|
||||
|
@ -1,10 +1,6 @@
|
||||
/*
|
||||
* $Id: md5.c,v 1.11 1997/12/29 03:40:37 steve Exp $
|
||||
*
|
||||
* Derived from:
|
||||
*/
|
||||
|
||||
/*
|
||||
*
|
||||
* MDDRIVER.C - test driver for MD2, MD4 and MD5
|
||||
*/
|
||||
|
||||
@ -21,11 +17,15 @@
|
||||
* documentation and/or software.
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <md5.h>
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"$Id$";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <err.h>
|
||||
#include <md5.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
@ -83,7 +83,7 @@ main(argc, argv)
|
||||
while (optind < argc) {
|
||||
p = MD5File(argv[optind], buf);
|
||||
if (!p)
|
||||
perror(argv[optind]);
|
||||
warn("%s", argv[optind]);
|
||||
else
|
||||
printf("MD5 (%s) = %s\n", argv[optind], p);
|
||||
optind++;
|
||||
@ -181,10 +181,8 @@ MDFilter(pipe)
|
||||
|
||||
MD5Init(&context);
|
||||
while ((len = fread(buffer, 1, BUFSIZ, stdin))) {
|
||||
if(pipe && (len != fwrite(buffer, 1, len, stdout))) {
|
||||
perror("stdout");
|
||||
exit(1);
|
||||
}
|
||||
if(pipe && (len != fwrite(buffer, 1, len, stdout)))
|
||||
err(1, "stdout");
|
||||
MD5Update(&context, buffer, len);
|
||||
}
|
||||
printf("%s\n", MD5End(&context,buf));
|
||||
|
Loading…
Reference in New Issue
Block a user