The getservbyname() function returns a servent structure for the line from /etc/services that matches the service name using protocol proto.
The servent structure is defined in <netdb.h> as follows:
char *s_name; /* official service name */
char **s_aliases; /* alias list */
int s_port; /* port number */
char *s_proto; /* protocol to use */
}