getprotoent, getprotobynumber, getprotobyname, setprotoent, endprotoent
 
Purpose
 
     Gets protocol entry.
 
Library
 
     Sockets Library (libsock.a)
 
Syntax
 
     #include <netdb.h>
 
     struct protoent *getprotoent ( )          void setprotoent (stayopen)
                                               int stayopen;
     struct protoent *getprotobyname (name)
     char *name;                               void endprotoent ( )
 
     struct protoent *getprotobynumber (proto)
     int proto;
     Description
 
     The  getprotoent,  getprotobyname,  and  getprotobynumber
     subroutines  each return  a pointer  to an  object.  This
     object is a protoent  structure, which contains the field
     of a  line in the  /etc/protocols file (the  network pro-
     tocol data  base).  The protoent structure  is defined in
     the netdb.h  header file,  and it contains  the following
     members:
 
          char    *p_name;        /* official name of protocol */
          char    **p_aliases;    /* alias list                */
          long    p_proto;        /* protocol number           */
 
     The members of the structure are defined below:
 
     p_name      Official name of the protocol.
 
     p_aliases   An  array, terminated  by a  0, of  alternate
                 names for the protocol.
 
     p_proto     The protocol number.
 
     The  getprotoent subroutine  reads the  next line  of the
     file.  If the file is not open, getprotoent opens it.
 
     The setprotoent  subroutine opens  and rewinds  the file.
     If the stayopen parameter is 0, the protocol data base is
     not closed after each call to getprotoent. Otherwise, the
     file is not closed after each call.
 
     The endprotoent subroutine closes the file.
 
     The   getprotobyname  and   getprotobynumber  subroutines
     search  the file  sequentially from  its beginning  until
     finding a  matching protocol name or  protocol number, or
     until encountering the end of the file.
 
     Return Value
 
     A pointer to a protoent structure is returned on success.
 
     Note:  The  return value  points to  static data  that is
     overwritten by subsequent calls.
 
     A NULL pointer (0) is returned  if an error occurs or the
     end of the file is reached.
 
     File
 
     /etc/protocols   Protocol name data base.
 
     Related Information
 
     The discussion of /etc/protocols in Interface Program for
     use with TCP/IP.
 
