Open System Services Library Calls Reference Manual (G06.27+, H06.04+)

getprotobyname(3) OSS Library Calls Reference Manual
NAME
getprotobyname - Gets a protocol entry by name
LIBRARY
G-series native OSS processes: /G/system/sysnn/zinetsrl
H-series OSS processes: /G/system/zdllnnn/zinetdll
SYNOPSIS
#include <netdb.h>
struct protoent *getprotobyname(
const char *name);
PARAMETERS
name Species the protocol name or alias.
DESCRIPTION
The getprotobyname( ) function searches the network protocols database le /etc/protocols
sequentially until a match with name is found.
The getprotobyname( ) function returns a pointer to a structure of type protoent whose members
specify data from the /etc/protocols network protocols database le. The netdb.h header le
denes the protoent structure.
When using the getprotobyname() function, use the endprotoent( ) function to close the proto-
cols le.
NOTES
The getprotobyname( ) return value points to static data, which is overwritten by any subsequent
calls to getprotobyname(), getprotobynumber( ),orgetprotoent().
RETURN VALUES
Upon successful completion, the getprotobyname() function returns a pointer to a protoent
structure if the requested entry is found, and a null pointer if it is not found. If the call to getpro-
tobyname( ) fails, a null pointer is returned.
ERRORS
The getprotobyname( ) function does not set errno.
FILES
/etc/protocols The Internet network protocols database le. Each record in the le occupies a
single line and has three elds: the protocol name, the protocol number, and pro-
tocol aliases.
RELATED INFORMATION
Functions: getprotobynumber(3), getprotoent(3), setprotoent(3), endprotoent(3).
Files: protocols(4).
362 Hewlett-Packard Company 527187-004