getnetbyname()

get a network entry, given a name

Synopsis:

#include <netdb.h>

struct netent *getnetbyname( const char *name );

Description:

The getnetbyname() function gets the network entry for the given name. This function returns a pointer to a structure of type netent, which contains the broken-out fields of a line in the network database, /etc/networks.

The setnetent() function opens and rewinds the file. If the stayopen flag is nonzero, the net database won't be closed after each call to getnetbyname() or getnetbyaddr().

The getnetbyaddr() and getnetbyname() functions sequentially search from the beginning of the file until a matching net name or net address and type is found, or until EOF is encountered. Network numbers are supplied in host order.

Returns:

A pointer to a valid netent structure, or NULL if an error occurs.

Files:

/etc/networks
Network name database file.

Classification:

POSIX 1003.1g (draft)

Safety:
Interrupt handler No
Signal handler No
Thread No

See also:

endnetent(), getnetbyaddr(), getnetent(), netent, setnetent()

/etc/networks in the TCP/IP User's Guide