Open System Services Library Calls Reference Manual (G06.29+, H06.08+, J06.03+)
getnetent(3) OSS Library Calls Reference Manual
NAME
getnetent - Gets the next entry in the network database
LIBRARY
G-series native OSS processes: /G/system/sysnn/zinetsrl
32-bit H-series and J-series OSS processes: /G/system/zdllnnn/zinetdll |
64-bit H-series and J-series OSS processes: /G/system/zdllnnn/yinetdll |
SYNOPSIS
[#include <sys/socket.h>]
#include <netdb.h>
struct netent *getnetent(void);
DESCRIPTION
The getnetent( ) function retrieves the next entry in the /etc/networks file.
The getnetent( ) function returns a pointer to a netent structure, whose members specify informa-
tion about a network. The netent structure is defined in the netdb.h header file.
Use the endnetent( ) function to close the /etc/networks file.
If multiple threads interleave calls to getnetbyname_r( ), getnetbyaddr_r( ), getnetent_r( ) and
their base versions, the threads enumerate disjoint subsets of the networks database.
NOTES
The getnetent( ) return value points to static data, which is overwritten by subsequent calls to
getnetbyaddr( ), getnetbyname( ),orgetnetent( ).
In a threaded environment, the behavior of the application is undetermined if more than one
thread in application is calling different sequences of the setnetent( ), getnetent( ),
getnetent_r( ), getnetbyaddr( ), getnetbyaddr_r( ), getnetbyname( ), getnetbyname_r( ), or
endnetent( ) functions.
RETURN VALUES
Upon successful completion, the getnetent( ) function returns a pointer to a netent structure if
the next entry was retrieved, and a null pointer if the end of the file was reached. If the call to
getnetent() fails, a null pointer is returned.
ERRORS
The getnetent( ) function does not set errno.
FILES
/etc/networks The Internet network database file. Each record in the file occupies a single line
and has three fields: the network name, the network number, and aliases.
RELATED INFORMATION
Functions: getnetbyaddr(3), getnetbyname(3), setnetent(3), endnetent(3).
Files: networks(4).
3−92 Hewlett-Packard Company 527187-017