The Single UNIX ® Specification, Version 2
Copyright © 1997 The Open Group

 NAME

sum - print checksum and block count of a file (LEGACY)

 SYNOPSIS



sum [-r][file...]

 DESCRIPTION

The sum utility calculates and writes a checksum for the named file to standard output and also writes the space used by the file, in 512-byte units.

 OPTIONS

The sum utility supports the XBD specification, Utility Syntax Guidelines  . The following options are supported:

-r
Use an alternative algorithm in computing the checksum.

 OPERANDS

The following operands are supported:
file
A pathname of a file. If no files are named, the standard input is read.

 STDIN

The standard input is any type of file, used only if no file operands are specified.

 INPUT FILES

The input files are of any file type.

 ENVIRONMENT VARIABLES

The following environment variables may affect the execution of sum:
LANG
Provide a default value for the internationalisation variables that are unset or null. If LANG is unset or null, the corresponding value from the implementation-dependent default locale will be used. If any of the internationalisation variables contains an invalid setting, the utility will behave as if none of the variables had been defined.
LC_ALL
If set to a non-empty string value, override the values of all the other internationalisation variables.
LC_CTYPE
Determine the locale for the interpretation of sequences of bytes of text data as characters (for example, single- as opposed to multi-byte characters in arguments).
LC_MESSAGES
Determine the locale that should be used to affect the format and contents of diagnostic messages written to standard error.
NLSPATH
Determine the location of message catalogues for the processing of LC_MESSAGES .

 ASYNCHRONOUS EVENTS

Default.

 STDOUT

For each file processed successfully, sum writes a line of the following format:

"%u %d %s\n", <checksum>, <number of 512-byte units>, <pathname>

If the standard input is used for input, the pathname is omitted.

 STDERR

Used only for diagnostic messages.

 OUTPUT FILES

None.

 EXTENDED DESCRIPTION

None.

 EXIT STATUS

The following exit values are returned:
0
Successful completion.
>0
An error occurred.

 CONSEQUENCES OF ERRORS

Default.

 APPLICATION USAGE

It is not clear that the algorithms used in typical implementations are portable, that is, the same checksum might not be produced for the same input on different systems. Portable applications should use cksum.

 EXAMPLES

None.

 FUTURE DIRECTIONS

None.

 SEE ALSO

cksum.

UNIX ® is a registered Trademark of The Open Group.
Copyright © 1997 The Open Group
[ Main Index | XSH | XCU | XBD | XCURSES | XNS ]