.\" @(#)sum.1 1.26 95/11/15 SMI; from SVr4
.\" Copyright 1989 AT&T
.\" Copyright (c) 1992, X/Open Company Limited
.\" All Rights Reserved
.\" Portions Copyright (c) 1995, Sun Microsystems, Inc.
.\" All Rights Reserved
.TH sum 1 "7 Nov 1995"
.SH NAME
sum \- print checksum and block count for a file
.SH SYNOPSIS
.B sum
.RB [ \-r ]
.RI [ file\|.\|.\|. ]
.SH AVAILABILITY
.LP
SUNWesu
.SH DESCRIPTION
.IX "sum command" "" "\fLsum\fP \(em print checksum and block count for a file"
.IX "files" "print checksum and block count for a file" "" "print checksum and block count for a file \(em \fLsum\fP"
.IX "block count" "for a file" "" "for a file \(em \fLsum\fP"
The 
.B sum
utility calculates and prints a 16-bit checksum for the named file
and the number of 512-byte blocks in the file.
It is typically used to look for bad spots, or
to validate a file communicated over
some transmission line.
.SH OPTIONS
The following options are supported:
.TP
.B \-r
Use an alternate (machine-dependent) algorithm in computing the checksum.
.SH OPERANDS
The following operands are supported:
.TP
.I file
A path name of a file.  If no files are named, the standard input is used.
.SH ENVIRONMENT
See
.BR environ (5)
for descriptions of the following environment variables that affect the
execution of 
.BR sum :
.BR \s-1LC_CTYPE\s-1 , 
.BR \s-1LC_MESSAGES\s-1 , 
and 
.BR \s-1NLSPATH\s-1 .
.SH "EXIT STATUS"
The following exit values are returned.
.TP 4
.B 0
Successful completion.
.TP
.B >0
An error occurred.
.SH "SEE ALSO"
.BR cksum (1),
.BR sum (1B),
.BR wc (1),
.BR environ (5)
.SH DIAGNOSTICS
\*(lqRead error\*(rq
is indistinguishable from end of file on
most devices; check the block count.
.SH NOTES
Portable applications should use
.BR cksum (1).
.LP
.B sum
and
.B usr/ucb/sum
(see
.BR sum (1B))
return different checksums.
