Update manpage to newer version. Use err(3).
This commit is contained in:
parent
8a89f6079c
commit
a7f2d3da85
@ -32,22 +32,22 @@
|
||||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.\" @(#)cksum.1 8.1 (Berkeley) 6/29/93
|
||||
.\" $Id: cksum.1,v 1.2 1997/04/27 08:45:43 jmg Exp $
|
||||
.\" @(#)cksum.1 8.2 (Berkeley) 4/28/95
|
||||
.\" $Id: cksum.1,v 1.3 1997/04/29 08:41:26 jmg Exp $
|
||||
.\"
|
||||
.Dd June 29, 1993
|
||||
.Dd April 28, 1995
|
||||
.Dt CKSUM 1
|
||||
.Os BSD 4.4
|
||||
.Sh NAME
|
||||
.Nm cksum
|
||||
.Nd display file checksums and block counts
|
||||
.Sh SYNOPSIS
|
||||
.Nm
|
||||
.Op Fl o Op \&1 \&| \&2
|
||||
.Nm cksum
|
||||
.Op Fl o Ar \&1 No \&| Ar \&2
|
||||
.Op Ar file ...
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Nm
|
||||
.Nm cksum
|
||||
utility writes to the standard output three whitespace separated
|
||||
fields for each input file.
|
||||
These fields are a checksum
|
||||
@ -158,10 +158,11 @@ article.
|
||||
.Re
|
||||
.Sh STANDARDS
|
||||
The
|
||||
.Nm
|
||||
utility is expected to be POSIX 1003.2 compatible.
|
||||
.Nm cksum
|
||||
utility is expected to conform to
|
||||
.St -p1003.2-92 .
|
||||
.Sh HISTORY
|
||||
The
|
||||
.Nm
|
||||
.Nm cksum
|
||||
utility appeared in
|
||||
.Bx 4.4 .
|
||||
|
@ -32,6 +32,8 @@
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
@ -46,15 +48,16 @@ static char sccsid[] = "@(#)cksum.c 8.1 (Berkeley) 6/6/93";
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#include <sys/types.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
#include <err.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include "extern.h"
|
||||
|
||||
void usage __P((void));
|
||||
static void usage __P((void));
|
||||
|
||||
int
|
||||
main(argc, argv)
|
||||
@ -80,8 +83,7 @@ main(argc, argv)
|
||||
cfncn = csum2;
|
||||
pfncn = psum2;
|
||||
} else {
|
||||
(void)fprintf(stderr,
|
||||
"cksum: illegal argument to -o option\n");
|
||||
warnx("illegal argument to -o option");
|
||||
usage();
|
||||
}
|
||||
break;
|
||||
@ -99,15 +101,13 @@ main(argc, argv)
|
||||
if (*argv) {
|
||||
fn = *argv++;
|
||||
if ((fd = open(fn, O_RDONLY, 0)) < 0) {
|
||||
(void)fprintf(stderr, "cksum: %s: %s\n",
|
||||
fn, strerror(errno));
|
||||
warn("%s", fn);
|
||||
rval = 1;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (cfncn(fd, &val, &len)) {
|
||||
(void)fprintf(stderr, "cksum: %s: %s\n",
|
||||
fn ? fn : "stdin", strerror(errno));
|
||||
warn("%s", fn ? fn : "stdin");
|
||||
rval = 1;
|
||||
} else
|
||||
pfncn(fn, val, len);
|
||||
@ -116,7 +116,7 @@ main(argc, argv)
|
||||
exit(rval);
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
usage()
|
||||
{
|
||||
(void)fprintf(stderr, "usage: cksum [-o 1 | 2] [file ...]\n");
|
||||
|
Loading…
Reference in New Issue
Block a user