Other Alias
cmp_set_offset, cmp_struct, cmp_char, cmp_short, cmp_int, cmp_long, cmp_float, cmp_double, cmp_long_double, cmp_schar, cmp_uchar, cmp_ushort, cmp_uint, cmp_ulong, cmp_charptrSYNOPSIS
#include <cmp.h>
void cmp_set_offset(size_t offset, int (*)(const void *, const void *));
int cmp_struct(const void *, const void *);
int cmp_char(const void *, const void *);
int cmp_short(const void *, const void *);
int cmp_int(const void *, const void *);
int cmp_long(const void *, const void *);
int cmp_float(const void *, const void *);
int cmp_double(const void *, const void *);
int cmp_long_double(const void *, const void *);
int cmp_schar(const void *, const void *);
int cmp_uchar(const void *, const void *);
int cmp_ushort(const void *, const void *);
int cmp_uint(const void *, const void *);
int cmp_ulong(const void *, const void *);
int cmp_charptr(const void *, const void *);
int cmp_chararr(const void *, const void *);
DESCRIPTION
The functions declared above, with the exception of cmp_set_offset, compare two array elements of the indicated type when given pointers to them. The functions are designed to work with qsort(3), bsearch(3), and a number of other library functions which all need the same type of comparison function. They all return negative if the value indicated by the first argument is less than the second, 0 if they are the same, and positive otherwise.cmp_struct compares elements of a structure. It needs to know the offset of the element, and a comparison function suitable for the type of the element. These are set with cmp_set_offset, which should be called before qsort(3). The settings stay in effect until changed.