Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ gethostbyname(3N) — UTek W2.3

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

hosts(5n)



GETHOSTENT(3N)          COMMAND REFERENCE          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()

     sethostsock(stayopen)
     int stayopen;

     endhostsock()

DESCRIPTION
     Gethostent, gethostbyname, and gethostbyaddr each return a
     pointer to an object with the following structure.

          struct    hostent {
               char *h_name;  /* official name of host */
               char **h_aliases;   /* alias list */
               int  h_addrtype;    /* host 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.

     h_addr      A pointer to the network address for  the  host.



Printed 10/17/86                                                1





GETHOSTENT(3N)          COMMAND REFERENCE          GETHOSTENT(3N)



                 Host  addresses  are  returned  in  network byte
                 order.



     Gethostent reads the next  line  of  the  file,  /etc/hosts,
     opening  the  file if necessary.  The file remains open upon
     completion.

     Gethostbyname and gethostbyaddr open a  UTek  domain  socket
     (/tmp/nameserver)  to the nameserver(8n), if necessary, then
     make a request and get an answer.  The socket is closed upon
     completion.  Host addresses are supplied in network order.

     Sethostent opens and rewinds the file.  If the stayopen flag
     is  nonzero,  the  host  database  will  not  be  closed  by
     subsequent calls to endhostent.

     Endhostent closes the file.

     Sethostsock opens the socket to the nameserver(8n).  If  the
     stayopen flag is nonzero the socket will not be closed until
     endhostsock is called.

     Endhostsock closes the socket.

FILES
     /etc/hosts

DIAGNOSTICS
     Null pointer (0) returned on EOF or error.

CAVEATS
     All information is contained in a static area so it must  be
     copied  if  it  is  to  be saved.  Only the Internet address
     format is currently understood.

SEE ALSO
     hosts(5n).
















Printed 10/17/86                                                2





































































%%index%%
na:72,130;
sy:202,1833;
de:2035,1198;3377,1688;
fi:5065,69;
di:5134,127;
ca:5261,220;
se:5481,94;
%%index%%000000000131

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