HPUX getservbyna[3n]






 getservent(3N)                                               getservent(3N)





 NAME
      getservent(), getservbyport(), getservbyname(), setservent(),
      endservent() - get service entry

 SYNOPSIS
      #include <netdb.h>

      struct servent *getservent(void);

      struct servent *getservbyname(
           const char *name,
           const char *proto);

      struct servent *getservbyport(int port, const char *proto);

      int setservent(int stayopen);

      int endservent(void);

 DESCRIPTION
      getservent(), getservbyname(), and getservbyport() each return a
      pointer to a structure of type servent containing the broken-out
      fields of a line in the network services data base, /etc/services.

      The members of this structure are:

           s_name         The official name of the service.

           s_aliases      A null-terminated list of alternate names for the
                          service.

           s_port         The port number at which the service resides.

           s_proto        The name of the protocol to use when contacting
                          the service.

      Functions behave as follows:

           getservent()             Reads the next line of the file, opening
                                    the file if necessary.

           setservent()             Opens and rewinds the file.  If the
                                    stayopen flag is non-zero, the services
                                    data base is not closed after each call
                                    to getservent() (either directly or
                                    indirectly through one of the other
                                    getserv* calls).

           endservent()             Closes the file.





 Hewlett-Packard Company            - 1 -     HP-UX Release 9.0: August 1992






 getservent(3N)                                               getservent(3N)





           getservbyname()          Sequentially search from the beginning
           getservbyport()          of the file until a matching service
                                    name (among either the official names or
                                    the aliases) or port number is found, or
                                    until EOF is encountered.  If a non-NULL
                                    protocol name is also supplied (such as
                                    tcp or udp), searches must also match
                                    the protocol.

                                    If the system is running Network
                                    Information Service (NFS),
                                    getservbyname() gets the service
                                    information from the NIS server (see
                                    ypserv(1M) and ypfiles(4)).

 RETURN VALUE
      getservent(), getservbyname(), and getservbyport() return a null
      pointer (0) on EOF or when they are unable to open /etc/services.

 WARNINGS
      All information is contained in a static area so it must be copied if
      it is to be saved.

 AUTHOR
      getservent() was developed by the University of California, Berkeley.

 FILES
      /etc/services

 SEE ALSO
      ypserv(1M), services(4), ypfiles(4).























 Hewlett-Packard Company            - 2 -     HP-UX Release 9.0: August 1992