Previous: keyval_perror, Up: KeyVal   [Contents]


5.3 keyval_cmp

compare KeyVal structures, alphabetically

Synopsis

#include <suplib/keyval.h>

int keyval_cmp(
  const void *v1,
  const void *v2
);

Parameters

const void *v1

pointer to first KeyVal structure

const void *v2

pointer to second KeyVal structure

Description

keyval_cmp is an alphabetical comparison routine for KeyVal structures intended for use by bsearch or qsort.

Returns

It returns ‘-1’ if the first structure is lexically earlier than the second, ‘0’ if they are the same, and ‘1’ if the first is lexically after the second.

Author

Diab Jerius