# SUM v1.20 - find sum of integers in text file

#### Revised 23-Aug-97. Copyright (c) 1996-97 by Rune Berg. TextTools Freeware.

Usage - Description - Options - Limitations - Return codes

### USAGE

sum [log logfile] [options] [infile] [to outfile]

### DESCRIPTION

sum sums up numbers in infile until end-of-file or non-integer data is found, and prints a one line result to outfile, e.g.:

            sum is 540

If sum finds no numbers in infile, it will print:

            sum is unknown

If you don't specify infile, sum reads from standard input.
If you don't specify outfile, sum writes to standard output.
If you don't specify logfile, sum writes error messages to standard error.

### OPTIONS

sum recognizes the following command line options:

Option | Function
--- | ---
-a | Print average of numbers in infile.
-s | Print smallest number in infile.
-b | Print biggest number in infile.
-c | Print count of numbers in infile.
-v | Print version banner and usage info to standard error (or logfile, if given), then exit.

### LIMITATIONS

sum only handles integer numbers, in the range -2147483647 .. 2147483647.

sum does not detect underflows and overflows.

### RETURN CODES

sum returns with one of the following codes ("error levels"):

Code | Meaning
--- | ---
0 | Success
2 | Unknown result (sum didn't find any numbers to add up).
102 | Incorrect command line arguments
104 | Error opening file
105 | I/O error
107 | File name clash

##### End of document