1GENDERS_TESTATTR(3)               LIBGENDERS               GENDERS_TESTATTR(3)
2
3
4

NAME

6       genders_testattr - test if a node has an attribute
7

SYNOPSIS

9       #include <genders.h>
10
11       int  genders_testattr(genders_t  handle,  const  char *node, const char
12       *attr, char *val, int len);
13
14       int genders_testattrval(genders_t handle, const char *node, const  char
15       *attr, const char *val);
16

DESCRIPTION

18       genders_testattr()  tests  if  the node pointed to by node contains the
19       attribute pointed to by attr.  If node is NULL,  the  current  node  is
20       tested.   If  the attribute is found, its value is stored in the buffer
21       pointed to by val.  len should indicate the length of the  buffer.   If
22       the attribute value is not needed, val can be set to NULL.
23
24       To  avoid passing in an attribute value buffer that is not large enough
25       to store the attribute value, genders_getmaxvallen(3) should be used to
26       determine the minimum buffer size that should be used.
27
28       genders_testattrval() tests if the node pointed to by node contains the
29       attribute pointed to by attr and if that  attribute  is  equal  to  the
30       attribute  value pointed to by val.  If val is NULL, only the attribute
31       is tested.
32

RETURN VALUES

34       For genders_testattr(), if  the  node  contains  the  attribute,  1  is
35       returned.  0 is returned if the node does not contain the attribute.
36
37       For genders_testattrval(), if the node contains the attribute and it is
38       equal to the attribute value, 1 is returned.  0 is returned if the node
39       does not contain the attribute, or if the attribute is not equal to the
40       attribute value.
41
42       For both genders_testattr() and genders_testattrval(), -1  is  returned
43       on  error, and an error code is returned in handle.  The error code can
44       be retrieved via genders_errnum(3) , and a  description  of  the  error
45       code can be retrieved via genders_strerror(3).  Error codes are defined
46       in genders.h.
47

ERRORS

49       GENDERS_ERR_NULLHANDLE
50              The handle parameter is NULL.  The genders handle must  be  cre‐
51              ated with genders_handle_create(3).
52
53       GENDERS_ERR_NOTLOADED
54              genders_load_data(3) has not been called to load genders data.
55
56       GENDERS_ERR_OVERFLOW
57              The  buffer  pointed  to by val is not large enough to store the
58              attribute value.
59
60       GENDERS_ERR_PARAMETERS
61              An incorrect parameter has been passed in.
62
63       GENDERS_ERR_NOTFOUND
64              The node pointed to by node cannot be found in the genders  file
65              or if node=NULL, the machine genders is running on is not listed
66              in the genders database.
67
68       GENDERS_ERR_MAGIC
69              handle has an incorrect magic number.  handle does not point  to
70              a  genders  handle  or handle has been destroyed by genders_han‐
71              dle_destroy(3).
72

FILES

74       /usr/include/genders.h
75

SEE ALSO

77       libgenders(3),  genders_handle_create(3),  genders_load_data(3),   gen‐
78       ders_getmaxvallen(3), genders_errnum(3), genders_strerror(3)
79
80
81
82LLNL                              August 2003              GENDERS_TESTATTR(3)
Impressum