getnetpath(3N) getnetpath(3N)
NAME
getnetpath, setnetpath, endnetpath - get /etc/netconfig entry corre-
sponding to NETPATH component
SYNOPSIS
#include <netconfig.h>
void *setnetpath(void);
struct netconfig *getnetpath(void *handlep);
int endnetpath(void *handlep);
DESCRIPTION
The three routines described on this page are part of the UNIX System
V transport system selection component. They provide application
access to the system network configuration database, /etc/netconfig,
as it is "filtered" by the NETPATH environment variable [see
environ(5)]. Network Selection also includes routines that access the
network configuration database directly [see getnetconfig(3N)].
A call to setnetpath() takes or resets the value of the NETPATH vari-
able for the process setnetpath() must be called before the first call
to getnetpath(). It returns a handle that is used by getnetpath.
setnetpath() will fail if the netconfig file is not present. If
NETPATH is unset, setnetpath() returns the number of "visible" trans-
port system in the netconfig file. A transport system is "visible" if
a corresponding flag has been set for it in the /etc/netconfig file.
The set of visible transport systems thus constitutes a default
NETPATH.
When first called, getnetpath() returns a pointer to the netconfig
database entry corresponding to the first valid NETPATH component. The
netconfig entry is formatted as a struct netconfig. On each subsequent
call, getnetpath returns a pointer to the netconfig entry that corre-
sponds to the next valid NETPATH component. getnetpath() can thus be
used to search the netconfig database for all networks included in the
NETPATH variable. When NETPATH has been exhausted, getnetpath()
returns NULL.
getnetpath() silently ignores invalid NETPATH components. A NETPATH
component is invalid if there is no corresponding entry in the
netconfig database.
If the NETPATH variable is unset, getnetpath() behaves as if NETPATH
were set to the sequence of default or "visible" transport systems in
the netconfig database, in the order in which they are listed.
endnetpath() may be called to unset the effect of NETPATH on the sys-
tem environment when processing is complete, and to release memory
allocated by setnetpath() for reuse. endnetpath() returns 0 on success
and -1 on failure (e.g., if setnetpath() was not called previously).
Page 1 Reliant UNIX 5.44 Printed 11/98
getnetpath(3N) getnetpath(3N)
SEE ALSO
getnetconfig(3N), netconfig(4), environ(5).
Page 2 Reliant UNIX 5.44 Printed 11/98