Verifies that attribute values are within range.
#include <cf.h>
#include <sys/cfgodm.h>
#include <sys/cfgdb.h>
int attrval (uniquetype, pattr, errattr)
char * uniquetype;
char * pattr;
char ** errattr;
Item | Description |
---|---|
uniquetype | Identifies the predefined device object, which is a pointer to a character string of the form class/subclass/type. |
pattr | Points to a character string containing the attribute-value pairs to be validated, in the form attr1=val1 attr2=val2. |
errattr | Points a pointer to a null-terminated character string. On return from the attrval subroutine, this string will contain the names of invalid attributes, if any are found. Each attribute name is separated by spaces. |
The attrval subroutine is used to validate each of a list of input attribute values against the legal range. If no illegal values are found, this subroutine returns a value of 0. Otherwise, it returns the number of incorrect attributes.
If any attribute values are invalid, a pointer to a string containing a list of invalid attribute names is returned in the errattr parameter. These attributes are separated by spaces.
Allocation of the error buffer is done in the attrval subroutine. However, a character pointer (for example, char *errorb;) must be declared in the calling routine. Thereafter, the address of that pointer is passed to the attrval subroutine (for example, attrval(...,&errorb);) as one of the parameters.
Item | Description |
---|---|
0 | Indicates that all values are valid. |
Nonzero | Indicates the number of erroneous attributes. |
Item | Description |
---|---|
/usr/lib/libcfg.a | Archive of device configuration subroutines. |