Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ getservent(3N) — HP-UX 5.50

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

services(5)

     GETSERVENT(3N)           Series 300 Only           GETSERVENT(3N)

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

     SYNOPSIS
          #include <netdb.h>

          struct servent *getservent()

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

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

          setservent(stayopen)
          int stayopen

          endservent()

     HP-UX COMPATIBILITY
          Level:    HP-UX/NON-STANDARD

          Origin:   UCB

          Remarks:  Implemented on the Series 300 only.

     DESCRIPTION
          These libraries can  be  accessed  by  giving  the  -lbsdipc
          option to ld(1).

          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.

          Getservent reads the next line of the file, opening the file
          if necessary.

          Setservent opens and rewinds the file.  If the stayopen flag

     Hewlett-Packard               - 1 -             (printed 7/16/86)

     GETSERVENT(3N)           Series 300 Only           GETSERVENT(3N)

          is non-zero, the net data base will not be closed after each
          call to getservent (either directly, or  indirectly  through
          one of the other getserv calls).

          Endservent closes the file.

          Getservbyname and getservbyport sequentially search from the
          beginning  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 protocol name is
          also supplied  (non-NULL),  searches  must  also  match  the
          protocol.

     FILES
          /etc/services

     SEE ALSO
          services(5).

     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.

     Hewlett-Packard               - 2 -             (printed 7/16/86)

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026