NAME

catear_findnext - find specific UARs

SYNOPSIS

#include <cat/cat.h>

int catear_findnext(catpac_ear *ep, catear_ear **ee, ...);

DESCRIPTION

This function searches through the UARs located by catpac_openears() trying to find a more specific match. The variable arguments are in groups of four, where each argument in a group represents a variable to be matched.

[char *var, char *val, int vallen, int flag, ..., NULL]

The first argument, var, is the name of the variable; the second argument, val, is the value to be matched exactly; the third argument, vallen, is the length of the value; and the fourth argument, flag, should be either CATEAR_MUST_MATCH when each variable specified is to be matched, or CATEAR_NEED_NOT_EXIST, which ignores a variable that is not set in the UAR.

The last argument must always be NULL. The ee argument, which should not be modified, points to each UAR found.

When there are no more matching arguments before the NULL, the next UAR will be returned sequentially.

The function returns 0 if successful, or a negative code otherwise.

NOTES

Alternative interfaces to this function are available as follows:

catear_vfindnext(catpac_ear *ep, catear_ear *ep, va_list ap);

Works in the same way as catear_findnext(), but takes a va_list pointer instead of a variable number of arguments.

catear_afindnext(catpac_ear *ep, catear_ear **ee, const catear_finddata *vec, int veclen);

Works in the same way as catear_findnext(), but takes an array of catear_finddata structures, defined as follows:

  typedef struct catear_finddata {
      char *name;
      char *val;
      int vallen;
      int flag;
  } catear_finddata;

SEE ALSO

catpac