Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ gethostbyname.(3N) — A/UX 2.0

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

hosts(4N)




gethostbyaddr(3N) gethostbyaddr(3N)
NAME gethostbyaddr, gethostbyname - get network host entry SYNOPSIS #include <netdb.h> struct hostent *gethostbyname(name) char *name; struct hostent *gethostbyaddr(addr, len, type) char *addr; int len, type; DESCRIPTION gethostbyaddr and gethostbyname each return a pointer to an object with the following structure containing the broken- out fields of a line in the network host data base, /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_list; /*address list*/ }; #define h_addr h_addr_list[0] /* backward compatibility */ 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. Host addresses are returned in network byte order. gethostbyname and gethostbyaddr sequentially search from the beginning of the file until a matching host name or host ad- dress is found, or until EOF is encountered. Host addresses are supplied in network order. RETURN VALUE NULL pointer (0) returned on EOF or error. April, 1990 1



gethostbyaddr(3N) gethostbyaddr(3N)
FILES /etc/hosts SEE ALSO hosts(4N). BUGS All information is contained in a static area, so it must be copied if it is to be saved. Only the Internet address for- mat is currently understood. 2 April, 1990

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