#include <cfg.h> int cfg_read( CFG *cfgp, CFGENT **node );
A successful call to cfg_read()
returns a value of zero
and an unsuccessful call returns the errno
.
cfgp
argument does not refer to an open configuration
space.
node
does not exist.
SYMLOOP_MAX
symbolic links were encountered during
resolution of the cfgpath argument.
PATH_MATH
.
The cfg_read()
function returns a pointer to a CFGENT structure
representing a node in the configuration space to which cfgp
refers. The returned pointer is stored at the location indicated
by the node
argument.
The child nodes of each node in the configuration tree is returned
by cfg_read()
. If a comparison routine was specified to the
cfg_open()
function, the order of return of the child nodes is
as specified by the compar
routine, from least to greatest.
Otherwise, the order of return is unspecified.
Structures referencing nodes with children is returned by the
function cfg_read()
at least twice [unless the application
specifies otherwise with cfg_mark()
]-once immediately before
the structures representing their descendants, are returned
(pre-order), and once immediately after structures representing all
of their descendants, if any, are returned (post-order). The
CFGENT structure returned in post-order (with the exception of the
cfg_info
field) is identical to that returned in pre-order.
Structures referencing nodes of other types is returned at least
once.
The fields of the CFGENT structure contains the following information:
cfg_read()
function for the node that contains
the entry for the current node. A cfg_parent
structure is provided for the node(s) specified by
the pathnames
argument to the cfg_open()
function, but the contents of other than its
cfg_number
, cfg_pointer
, cfg_parent
,
and cfg_parent
, and cfg_level
fields are
unspecified. Its cfg_link
field is unspecified.
cfg_children()
function, the
cfg_link
field points to the next CFGENT structure
in a NULL-terminated linked list of CFGENT structures.
Otherwise, the content of the cfg_link
field is
unspecified.
cfg_read()
represents a node that appears in the cfg_parent
linked list tree, the cfg_cycle
field shall point
to the structure representing that entry from the
cfg_parent
linked list. Otherwise the content of
the cfg_cycle
field is unspecified.
cfg_number
field is provided for use by the
application program. It is initialized to zero for
each new node returned by the cfg_read()
function,
but is not further modified by the configuration space
routines.
cfg_pointer
field is provided for use by the
application program. It is initialized to NULL for
each new node returned by the cfg_read()
function,
but is not further modified by the configuration
space routines.
cfg_open()
routine for this
configuration space. This pathname may be longer than
PATH_MAX
bytes. This pathname is NULL-terminated.
cfg_path
field when returned by cfg_read()
.
cfg_name
field.
cfg_level
field of the cfg_parent
structure for each of the node(s) specified in the
pathnames
argument to the cfg_open()
function
is set to 0, and this number is incremented for each
node level descendant.
cfg_read()
.
The cfg_cycle
field references the structure
previously returned by cfg_read
that is the
same as the returned structure.
cfg_errno
is set to the appropriate value.
cfg_errno
is set to the
appropriate value.
Structures returned by cfg_read()
with a cfg_info
field equal
to CFG_D is accessible until a subsequent call, on the same
configuration traversal stream, to cfg_close()
, or to cfg_read()
after they have been returned by the cfg_read
function in
post-order. Structures returned by cfg_read()
with an
cfg_info
field not equal to CFG_D is accessible until a subsequent
call, on the same configuration traversal stream, to cfg_close()
or cfg_read()
.
The content of the cfg_path
field is specified only for the
structure most recently returned by cfg_read()
.
The specified fields in structures in the list representing nodes for
which structures have previously been returned by cfg_children()
,
is identical to those returned by cfg_children()
, except that
the contents of the cfg_path
and cfg_pathlen
fields are
unspecified.
The _POSIX_CFG
feature flag is defined to indicate
this service is available.
Copyright © 1988-2004 OAR Corporation