#include <cfg.h> int cfg_open( const char *pathnames[], int options, int (*compar)(const CFGENT **f1, const CFGENT **f2), CFG **cfgstream );
A successful call to cfg_open()
returns a value of zero
and an unsuccessful call returns the errno
.
PATH_MAX
, or a pathname
component is longer than NAME_MAX
while _POSIX_NO_TRUNC
CFG_LOGICAL
and CFG_PHYSICAL
are
specified by the options
argument
SYMLOOP_MAX
symbolic links were encountered during
resolution of the pathnames
argument.
pathnames
argument, the length of
the substituted pathname string exceeded PATH_MAX
.
The cfg_open()
function opens a configuration traversal stream
rooted in the configuration nodes name by the pathnames
argument.
It stores a pointer to a CFG object that represents that stream at
the location identified the cfgstream
pointer. The pathnames
argument is an array of character pointers to NULL-terminated strings.
The last member of this array is a NULL pointer.
The value of options
is the bitwise inclusive OR of values from the
following lists. Applications supply exactly one of the first two values
below in options
.
cfg_info
field of the returned CFGENT structure describes the
target node pointed to by the link instead of the
link itself, unless the target node does not exist.
If the target node has children, the pre-order return,
followed by the return of structures referencing all of
its descendants, followed by a post-order return, is done.
cfg_info
field is used to describe the symbolic
link.
Any combination of the remaining flags can be specified in the value of
options
pathnames
argument, the
cfg_info
field of the returned CFGENT structure
describes the target node pointed to by the link
instead of the link itself, unless the target node does
not exist. If the target node has children, the
pre-order return, followed by the return of structures
referencing all its descendants, followed by a post-order
return, is done.
pathnames
argument.
The cfg_open()
argument compar
is either a NULL or point
to a function that is called with two pointers to pointers to CFGENT
structures that returns less than, equal to , or greater than zero if
the node referenced by the first argument is considered to be respectively
less than, equal to, or greater than the node referenced by the second.
The CFGENT structure fields provided to the comparison routine is as
described with the exception that the contents of the cfg_path
and
cfg_pathlen
fields are unspecified.
This comparison routine is used to determine the order in which nodes in
directories encountered during the traversal are returned, and the order
of traversal when more than one node is specified in the pathnames
argument to cfg_open()
. If a comparison routine is specified, the
order of traversal is from the least to the greatest. If the compar
argument is NULL, the order of traversal shall is listed in the
pathnames
argument.
The _POSIX_CFG
feature flag is defined to indicate
this service is available.
Copyright © 1988-2004 OAR Corporation