Open System Services Library Calls Reference Manual (G06.28+, H06.05+)
OSS Library Calls (g - h) getservent(3)
NAME
getservent - Gets the next entry from the network services database
LIBRARY
G-series native OSS processes: /G/system/sysnn/zinetsrl
H-series OSS processes: /G/system/zdllnnn/zinetdll
SYNOPSIS
#include <netdb.h>
struct servent *getservent(void);
PARAMETERS
None.
DESCRIPTION
The getservent() (get service entry) function reads the next line of the /etc/services file.
The getservent() function returns a pointer to a servent structure, which contains fields for a line
of information from the /etc/services file. The servent structure is defined in the netdb.h header
file.
NOTES
The getservent() return value points to static data, which is overwritten by any calls to get-
servbyport(), getservbyname( ), tservent(),orsetservent().
RETURN VALUES
Upon successful completion, the getservent() function returns a pointer to a servent structure.
If an error occurs or the end of the file is reached, the getservent() function returns a null pointer.
ERRORS
The getservent() function does not set errno.
FILES
/etc/services The Internet network service name database file. Each record in the file occupies
a single line and has four fields: the official service name, the port number, the
protocol name, and aliases.
RELATED INFORMATION
Functions: getservbyport(3), getservbyname(3), endservent(3), setservent(3).
Files: services(4).
527187-007 Hewlett-Packard Company 3−75