.\" Copyright (c) 1983 Regents of the University of California.
.\" All rights reserved. The Berkeley software License Agreement
.\" specifies the terms and conditions for redistribution.
.\" @(#)gethostbyname.3 6.1 (Berkeley) %G%
gethostent, gethostbyaddr, gethostbyname, sethostent, endhostent, sethostfile \- get network host entry
.B "struct hostent *gethostent()
.B "struct hostent *gethostbyname(name)
.B "struct hostent *gethostbyaddr(addr, len, type)
.B "char *addr; int len, type;
each return a pointer to an object with the
containing the broken-out
fields of a line in the network host data base,
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:
Official name of the host.
A zero terminated array of alternate names for the host.
The type of address being returned; currently always AF_INET.
The length, in bytes, of the address.
A pointer to the network address for the host.
Host addresses are returned
reads the next line of the file, opening the file if necessary.
opens and rewinds the file. If the
the host data base will not be closed after each call to
(either directly, or indirectly through one of the other
\*(lqgethost\*(rq calls).
changes the default host table file to
thus allowing these routines to be used with alternate host tables.
should be called prior to it.
sequentially search from the beginning
of the file until a matching
or until EOF is encountered.
Host addresses are supplied in network order.
(0) returned on EOF or error.
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.