Update manpage to newer version. Use err(3).

This commit is contained in:
Philippe Charnier 1997-06-25 07:02:03 +00:00
parent 9fc081a49e
commit f8a42d82e9
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=26922
2 changed files with 21 additions and 20 deletions

View File

@ -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 .

View File

@ -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");