PURPOSE

Fcmp, Fcmp32 - compare two fielded buffers

SYNOPSIS

#include <stdio.h>
#include "fml.h"
int
Fcmp(FBFR *fbfr1, FBFR *fbfr2)
#include "fml32.h"
int
Fcmp32(FBFR32 *fbfr1, FBFR32 *fbfr2)

DESCRIPTION

Fcmp() compares the field identifiers and then the field values of two FML buffers. fbfr1 and fbfr2 are pointers to the fielded buffers to be compared.

Fcmp32 is used with 32-bit FML.

RETURN VALUES

The function returns a 0 if the two buffers are identical. It returns a -1 on any of the following conditions:

1. The fieldid of a fbfr1 field is less than the fieldid of the corresponding field of fbfr2.
 
2. The value of a field in fbfr1 is less than the value of the corresponding field of fbfr2.
 
3. fbfr1 has fewer fields or field occurrences than fbfr2.

Fcmp() returns a 1 if any of the reverse set of conditions is true, for example, the fieldid of a fbfr1 field is greater than the fieldid of the corresponding field of fbfr2. The actual sizes of the buffers (that is, the sizes passed to Falloc()) are not considered; only the data in the buffers. This function returns -2 on error and sets Ferror to indicate the error condition.

ERRORS

Under the following conditions, Fcmp() 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),
Fadd(3fml),
Fchg(3fml)