PURPOSE

Fchksum, Fchksum32 - compute checksum for fielded buffer

SYNOPSIS

#include <stdio.h>
#include "fml.h"
long
Fchksum(FBFR *fbfr)
#include "fml32.h"
long
Fchksum32(FBFR32 *fbfr)

DESCRIPTION

For extra-reliable I/O, a checksum may be calculated using Fchksum() and stored in a fielded buffer being written out. fbfr is a pointer to a fielded buffer. The stored checksum may be inspected by the receiving process to verify that the entire buffer was received.

Fchksum32 is used with 32-bit FML.

RETURN VALUES

On success, Fchksum returns the check sum. This function returns -1 on error and sets Ferror to indicate the error condition.

ERRORS

Under the following conditions, Fchksum() fails and sets Ferror to:

[FALIGNERR]
"fielded buffer not aligned"
The buffer does not begin on the proper boundary.
 
[FNOTFLD]
"buffer not fielded"
The buffer is not a fielded buffer or has not been initialized by Finit().

SEE ALSO

Fintro(3fml),
Fread(3fml),
Fwrite(3fml)