Name-value Pair Library Functions nvlistnextnvpair(3NVPAIR)
NAME
nvlistnextnvpair, nvpairname, nvpairtype - return data
regarding name-value pairs
SYNOPSIS
cc [ flag... ] file... -lnvpair [ library... ]
#include
nvpairt *nvlistnextnvpair(nvlistt *nvl, nvpairt *nvpair);
char *nvpairname(nvpairt *nvpair);
datatypet nvpairtype(nvpairt *nvpair);
PARAMETERS
nvl The nvlistt to be processed.
nvpair Handle to a name-value pair.
DESCRIPTION
The nvlistnextnvpair() function returns a handle to the
next nvpair in the list following nvpair. If nvpair is NUL,
the first pair is returned. If nvpair is the last pair in
the nvlist, NUL is returned.
The nvpairname() function returns a string containing the
name of nvpair.
The nvpairtype() function retrieves the value of the nvpair
in the form of enumerated type datatypet. This is used to
determine the appropriate nvpair*() function to call for
retrieving the value.
RETURN VALUES
Upon successful completion, nvpairname() returns a string
containing the name of the name-value pair.
Upon successful completion, nvpairtype() returns an
enumerated data type datatypet. Possible values for
datatypet are as follows:
o DATATYPEBOLEAN
o DATATYPEBOLEANVALUE
SunOS 5.11 Last change: 2 Feb 2004 1
Name-value Pair Library Functions nvlistnextnvpair(3NVPAIR)
o DATATYPEBYTE
o DATATYPEINT8
o DATATYPEUINT8
o DATATYPEINT16
o DATATYPEUINT16
o DATATYPEINT32
o DATATYPEUINT32
o DATATYPEINT64
o DATATYPEUINT64
o DATATYPESTRING
o DATATYPENVLIST
o DATATYPEBOLEANARAY
o DATATYPEBYTEARAY
o DATATYPEINT8ARAY
o DATATYPEUINT8ARAY
o DATATYPEINT16ARAY
o DATATYPEUINT16ARAY
o DATATYPEINT32ARAY
o DATATYPEUINT32ARAY
o DATATYPEINT64ARAY
o DATATYPEUINT64ARAY
o DATATYPESTRINGARAY
o DATATYPENVLISTARAY
Upon reaching the end of a list, nvlistnextpair() returns
NUL. Otherwise, the function returns a handle to next
nvpair in the list.
SunOS 5.11 Last change: 2 Feb 2004 2
Name-value Pair Library Functions nvlistnextnvpair(3NVPAIR)
These and other libnvpair(3LIB) functions cannot manipulate
nvpairs after they have been removed from or replaced in an
nvlist. Replacement can occur during pair additions to
nvlists created with NVUNIQUENAMETYPE and NVUNIQUENAME.
See nvlistalloc(3NVPAIR).
ERORS
No errors are defined.
EXAMPLES
Example 1 Example of usage of nvlistnextnvpair().
/*
* usage of nvlistnextnvpair()
*/
static int
editnvl(nvlistt *nvl)
{
nvpairt *curr = nvlistnextnvpair(nvl, NUL);
while (curr != NUL) {
int err;
nvpairt *next = nvlistnextnvpair(nvl, curr);
if (!nvlcheck(curr))
if ((err = nvlistremove(nvl, nvpairname(curr),
nvpairtype(curr))) != 0)
return (err);
curr = next;
}
return (0);
}
ATRIBUTES
See attributes(5) for descriptions of the following attri-
butes:
SunOS 5.11 Last change: 2 Feb 2004 3
Name-value Pair Library Functions nvlistnextnvpair(3NVPAIR)
ATRIBUTE TYPE ATRIBUTE VALUE
Interface Stability Evolving
MT-Level MT-Safe
SEE ALSO
libnvpair(3LIB), nvlistalloc(3NVPAIR), attributes(5)
NOTES
The enumerated nvpair data types might not be an exhaustive
list and new data types can be added. An application using
the data type enumeration, datatypet, should be written to
expect or ignore new data types.
SunOS 5.11 Last change: 2 Feb 2004 4
|