1GETNETPATH(3)            BSD Library Functions Manual            GETNETPATH(3)
2

NAME

4     getnetpath, setnetpath, endnetpath — get /etc/netconfig entry correspond‐
5     ing to NETPATH component
6

LIBRARY

8     Standard C Library (libc, -lc)
9

SYNOPSIS

11     #include <netconfig.h>
12
13     struct netconfig *
14     getnetpath(void *handlep);
15
16     void *
17     setnetpath(void);
18
19     int
20     endnetpath(void *handlep);
21

DESCRIPTION

23     The routines described in this page provide the application access to the
24     system network configuration database, /etc/netconfig, as it is
25     “filtered” by the NETPATH environment variable (see environ(7)).  See
26     getnetconfig(3) for other routines that also access the network configu‐
27     ration database directly.  The NETPATH variable is a list of colon-sepa‐
28     rated network identifiers.
29
30     The getnetpath() function returns a pointer to the netconfig database
31     entry corresponding to the first valid NETPATH component.  The netconfig
32     entry is formatted as a struct netconfig.  On each subsequent call,
33     getnetpath() returns a pointer to the netconfig entry that corresponds to
34     the next valid NETPATH component.  The getnetpath() function can thus be
35     used to search the netconfig database for all networks included in the
36     NETPATH variable.  When NETPATH has been exhausted, getnetpath() returns
37     NULL.
38
39     A call to setnetpath() “binds” to or “rewinds” NETPATH.  The setnetpath()
40     function must be called before the first call to getnetpath() and may be
41     called at any other time.  It returns a handle that is used by
42     getnetpath().
43
44     The getnetpath() function silently ignores invalid NETPATH components.  A
45     NETPATH component is invalid if there is no corresponding entry in the
46     netconfig database.
47
48     If the NETPATH variable is unset, getnetpath() behaves as if NETPATH were
49     set to the sequence of “default” or “visible” networks in the netconfig
50     database, in the order in which they are listed.
51
52     The endnetpath() function may be called to “unbind” from NETPATH when
53     processing is complete, releasing resources for reuse.  Programmers
54     should be aware, however, that endnetpath() frees all memory allocated by
55     getnetpath() for the struct netconfig data structure.
56

RETURN VALUES

58     The setnetpath() function returns a handle that is used by getnetpath().
59     In case of an error, setnetpath() returns NULL.
60
61     The endnetpath() function returns 0 on success and -1 on failure (for
62     example, if setnetpath() was not called previously).  The nc_perror() or
63     nc_sperror() function can be used to print out the reason for failure.
64     See getnetconfig(3).
65
66     When first called, getnetpath() returns a pointer to the netconfig data‐
67     base entry corresponding to the first valid NETPATH component.  When
68     NETPATH has been exhausted, getnetpath() returns NULL.
69

SEE ALSO

71     getnetconfig(3), netconfig(5), environ(7)
72
73BSD                             April 22, 2000                             BSD
Impressum