getnetconfig(3N)getnetconfig(3N)NAMEgetnetconfig(), setnetconfig(), endnetconfig(), getnetconfigent(),
freenetconfigent(), nc_perror(), nc_sperror() - get network configura‐
tion database entry
SYNOPSISDESCRIPTION
The library routines described on this page are part of the Network
Selection component. They provide the application access to the system
network configuration database, In addition to the routines for access‐
ing the database, Network Selection includes the environment variable
(see environ(5)) and the access routines described in getnetpath(3N).
returns a pointer to the current entry in the database, formatted as a
Successive calls will return successive entries in the database. can
be used to search the entire file. returns NULL at the end of the
file. handlep is the handle obtained through
A call to has the effect of "binding" to or "rewinding" the database.
must be called before the first call to and may be called at any other
time. need not be called before a call to returns a unique handle to
be used by
should be called when processing is complete to release resources for
reuse. handlep is the handle obtained through Programmers should be
aware, however, that the last call to frees all memory allocated by for
the data structure. may not be called before
returns a pointer to the structure corresponding to netid. It returns
NULL if netid is invalid (that is, does not name an entry in the net‐
config database).
frees the structure pointed to by netconfigp (previously returned by
prints a message to the standard error indicating why any of the above
routines failed. The message is prepended with the string msg and a
colon. A NEWLINE is appended at the end of the message.
is similar to but instead of sending the message to the standard error,
will return a pointer to a string that contains the error message.
and can also be used with the access routines defined in getnet‐
path(3N).
MULTITHREAD USAGE
Thread Safe: Yes
Cancel Safe: Yes
Fork Safe: No
Async-cancel Safe: No
Async-signal Safe: No
These functions can be called safely in a multithreaded environment.
They may be cancellation points in that they call functions that are
cancel points.
In a multithreaded environment, these functions are not safe to be
called by a child process after and before These functions should not
be called by a multithreaded application that supports asynchronous
cancellation or asynchronous signals.
RETURN VALUE
returns a unique handle to be used by In the case of an error, returns
NULL and or can be used to print the reason for failure.
returns a pointer to the current entry in the database, formatted as a
returns NULL at the end of the file, or upon failure.
returns on success and on failure (for example, if was not called pre‐
viously).
On success, returns a pointer to the structure corresponding to netid;
otherwise it returns NULL.
returns a pointer to a buffer which contains the error message string.
This buffer is overwritten on each call. In multithreaded applica‐
tions, this buffer is implemented as thread-specific data.
SEE ALSOgetnetpath(3N), netconfig(4), environ(5).
getnetconfig(3N)