Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ gethostent(3n) — DG/UX 4.00

Media Vault

Software Library

Restoration Projects

Artifacts Sought



                                                           gethostent(3n)



        _________________________________________________________________
        gethostent, gethostbyaddr,               Network Library Function
        gethostbyname, sethostent, endhostent
        get network host entry
        _________________________________________________________________


        SYNTAX

        #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()


        DESCRIPTION

        Gethostent, gethostbyname, and gethostbyaddr each return a
        pointer to an object. The following structure contains the
        broken-out fields of a line in the network host database,
        /etc/hosts.

             struct    hostent {
                  char *h_name;  /* official name of host */
                  char **h_aliases;   /* alias list */
                  int  h_addrtype;    /* address type */
                  int  h_length; /* length of address */
                  char *h_addr;  /* address */
             };

        The members of this structure are:

        h_name      Official name of the host.

        h_aliases   A zero-terminated array of alternate  names  for  the
                    host.

        h_addrtype  The type of address being returned; currently  always
                    AF_INET.

        h_length    The length, in bytes, of the address.



        DG/UX 4.00                                                 Page 1
               Licensed material--property of copyright holder(s)





                                                           gethostent(3n)



        h_addr      A pointer to the network address for the host.   Host
                    addresses are returned in network byte order.

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

        Sethostent opens and rewinds the file.  If the stayopen  flag  is
        non-zero, the host database 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 hostname or host address
        is found, or  until  EOF  is  encountered.   Host  addresses  are
        supplied in network order.

        If your system is using the Yellow Pages (YP), you  may  need  to
        see  Chapter  2  in  Using  the Network File System on Your DG/UX
        System for information on how to update the /etc/hosts file.


        FILES

        /etc/hosts


        SEE ALSO

        hosts(4)


        DIAGNOSTICS

        Null pointer (0) returned on EOF or error.


        BUGS

        All information is in a static area, so you must copy it  if  you
        want  to  save it.  Only the Internet address format is currently
        supported.











        DG/UX 4.00                                                 Page 2
               Licensed material--property of copyright holder(s)



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