@comment The start of a comment is indicated by the following comment. This @comment syntax is used by the script funcstxh.sh: @comment function @comment function getservbyname @node getservbyname, resolver @findex getservbyname @c This file was originally a Linux man page - see the copyright below. It @c was modified for use in libsocket by Richard Dawe . @c Copyright 1993 David Metcalfe (david@prism.demon.co.uk) @c @c Permission is granted to make and distribute verbatim copies of this @c manual provided the copyright notice and this permission notice are @c preserved on all copies. @c @c Permission is granted to copy and distribute modified versions of this @c manual under the conditions for verbatim copying, provided that the @c entire resulting derived work is distributed under the terms of a @c permission notice identical to this one @c @c Since the Linux kernel and libraries are constantly changing, this @c manual page may be incorrect or out-of-date. The author(s) assume no @c responsibility for errors or omissions, or for damages resulting from @c the use of the information contained herein. The author(s) may not @c have taken the same level of care in the production of this manual, @c which is licensed free of charge, as they might when working @c professionally. @c @c Formatted or processed versions of this manual, if unaccompanied by @c the source, must acknowledge the copyright and authors of this work. @c @c References consulted: @c Linux libc source code @c Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991) @c 386BSD man pages @c Modified Sat Jul 24 19:19:11 1993 by Rik Faith (faith@cs.unc.edu) @c Modified Wed Oct 18 20:23:54 1995 by Martin Schulze @c Modified Mon Apr 22 01:50:54 1996 by Martin Schulze @c @subheading Syntax @example #include struct servent *getservbyname (const char *name, const char *proto); @end example @subheading Description The @code{getservbyname()} function returns a @samp{servent} structure for the line from @samp{services} (@pxref{services}) that matches the service @var{name} using protocol @var{proto}. The @samp{servent} structure is defined in @samp{} as follows: @example struct servent @{ char *s_name; /* official service name */ char **s_aliases; /* alias list */ int s_port; /* port number */ char *s_proto; /* protocol to use */ @} @end example The members of the @samp{servent} structure are: @table @samp @item s_name The official name of the service. @item s_aliases A zero terminated list of alternative names for the service. @item s_port The port number for the service given in network byte order. @item s_proto The name of the protocol to use with this service. @end table @subheading Return Values The @code{getservbyname()} function return the @samp{servent} structure, or a NULL pointer if an error occurs or the end of the file is reached. @subheading Portability @portability unix98 @subheading Example @example @end example