Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ gethostent(3N) — HP-UX 5.50

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

hosts(5)

     GETHOSTENT(3N)           Series 300 Only           GETHOSTENT(3N)

     NAME
          gethostent,   gethostbyaddr,   gethostbyname,    sethostent,
          endhostent - get network host entry

     SYNOPSIS
          #include <netdb.h>

          struct hostent *gethostent()

          struct hostent *gethostbyname(name)
          char *name;

          struct hostent *gethostbyaddr(addr, len, type)
          char *addr; int len, type;

          sethostent(stayopen)
          int stayopen

          endhostent()

     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).

          Gethostent, gethostbyname, and gethostbyaddr each  return  a
          pointer  to  a  structure  of  type  hostent  containing the
          broken-out fields of a line in the network host  data  base,
          /etc/hosts.

          The members of this structure are:

          h_name      Official name of the host.

          h_aliases   A null terminated array of alternate  names  for
                      the host.

          h_addrtype  The  type  of  address  being  returned;  always
                      AF_INET.

          h_length    The length, in bytes, of the address.

          h_addr      A pointer to the network address for the host.

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

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

     GETHOSTENT(3N)           Series 300 Only           GETHOSTENT(3N)

          Sethostent opens and rewinds the file.  If the stayopen flag
          is  non-zero,  the  host  data base will not be closed after
          each call to  gethostent  (either  directly,  or  indirectly
          through one of the other gethost calls).

          Endhostent closes the file.
          Gethostbyname and gethostbyaddr sequentially search from the
          beginning  of  the  file  until  a matching host name (among
          either the official names or the aliases) or host address is
          found,  or  until  EOF  is  encountered.  Host addresses are
          supplied in network order; see byteorder(3N).

     FILES
          /etc/hosts

     SEE ALSO
          hosts(5).

     RETURN VALUE
          Gethostent, gethostbyname and gethostbyaddr  return  a  null
          pointer  (0)  on  EOF  or  when  they  are  unable  to  open
          /etc/hosts.

     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