getnetent(3n)
_________________________________________________________________
getnetent, getnetbyaddr, Network Library Function
getnetbyname, setnetent, endnetent
get network entry
_________________________________________________________________
SYNTAX
#include <netdb.h>
struct netent *getnetent()
struct netent *getnetbyname(name)
char *name;
struct netent *getnetbyaddr(net)
long net;
setnetent(stayopen)
int stayopen
endnetent()
DESCRIPTION
Getnetent, getnetbyname, and getnetbyaddr each return a pointer
to an object with the following structure containing the broken-
out fields of a line in the network database, /etc/networks.
struct netent {
char *n_name; /* official name of net */
char **n_aliases; /* alias list */
int n_addrtype; /* net number type */
long n_net; /* net number */
};
The members of this structure are:
n_name The official name of the network.
n_aliases A zero-terminated list of alternate names for the
network.
n_addrtype The type of the network number returned; currently
only AF_INET.
n_net The network number. Network numbers are returned in
machine byte order.
DG/UX 4.00 Page 1
Licensed material--property of copyright holder(s)
getnetent(3n)
Getnetent reads the next line of the file, opening the file if
necessary.
Setnetent opens and rewinds the file. If the stayopen flag is
non-zero, the net database will not be closed after each call to
getnetent (either directly, or indirectly through one of the
other getnet calls).
Endnetent closes the file.
Getnetbyname and getnetbyaddr sequentially search from the
beginning of the file until a matching net name or net address is
found, or until EOF is encountered. Network numbers are supplied
in host order.
If your system is using the Yellow Pages (YP), you may need to
see Chapter 2 in Using the Network File System on Your DG/UX
System for information on how to update the /etc/networks file.
FILES
/etc/networks
SEE ALSO
networks(4)
DIAGNOSTICS
Null pointer (0) returned on EOF or error.
BUGS
All information is contained in a static area, so you have to
copy it if you want to save it. Only Internet network numbers
are currently supported.
DG/UX 4.00 Page 2
Licensed material--property of copyright holder(s)