*** UNIX MANUAL PAGE BROWSER ***

A Nergahak database for man pages research.

Navigation

Directory Browser

1Browse 4.4BSD4.4BSD
1Browse Digital UNIXDigital UNIX 4.0e
1Browse FreeBSDFreeBSD 14.3
1Browse MINIXMINIX 3.4.0rc6-d5e4fc0
1Browse NetBSDNetBSD 10.1
1Browse OpenBSDOpenBSD 7.7
1Browse UNIX v7Version 7 UNIX
1Browse UNIX v10Version 10 UNIX

Manual Page Search

Manual Page Result

0 Command: gethostbyname_r | Section: 3 | Source: Digital UNIX | File: gethostbyname_r.3.gz
gethostbyname(3) Library Functions Manual gethostbyname(3) NAME gethostbyname, gethostbyname_r - Get a network host entry by name LIBRARY Standard C Library (libc.so, libc.a) SYNOPSIS #include <netdb.h> struct hostent *gethostbyname( const char *name); [Digital] The following function is supported in order to maintain backward compatibility with previous versions of the operating system. You should not use it in new designs. int gethostbyname_r( const char *name, struct hostent *hptr, struct hostent_data *hdptr); STANDARDS Interfaces documented on this reference page conform to industry stan- dards as follows: gethostbyname(): XPG4-UNIX Refer to the standards(5) reference page for more information about in- dustry standards and associated tags. PARAMETERS Specifies the official network name or alias. [Digital] For gethost- byname_r() only, this points to the hostent structure. The netdb.h header file defines hostent structure. [Digital] For gethostby- name_r() only, this is data for hosts database. The netdb.h header file defines hostent_data structure. DESCRIPTION The gethostbyname() function returns a pointer to a structure of type hostent. Its members specify data obtained from either the local /etc/hosts file or one of the files distributed by BIND or NIS. To de- termine which file or files to search, and in which order, the system uses the switches in the /etc/svc.conf file. The netdb.h header file defines the hostent structure. If using BIND, the information is obtained from a name server specified in the /etc/resolv.conf file. If the name parameter does not contain a dot "." and you are using BIND, the gethostbyname() function checks whether the environment vari- able HOSTALIASES is set. If set, it first searches the file named by HOSTALIASES for an alias matching the name parameter. The alias file has the following format: name1 name2 The alias name. This name cannot include dots. The host name used by BIND to look up the host informa- tion. The hosts database must be distributed by BIND. NOTES The gethostbyname() function returns a pointer to thread-specific data. Subsequent calls to this or a related function from the same thread overwrite this data. [Digital] The gethostbyname_r() function is an obsolete reentrant ver- sion of the gethostbyname() function. It is supported in order to maintain backward compatibility with previous versions of the operating system and should not be used in new designs. Note that you must zero- fill the hdptr structure before its first access by the gethostby- name_r() function. RETURN VALUES Upon successful completion, the gethostbyname() function returns a pointer to a hostent structure. If it reaches the end of the network hostname database, it returns a null pointer. [Digital] Upon successful completion, the gethostbyname_r() function stores the hostent structure in the location pointed to by hptr, and returns a value of 0 (zero). Upon failure, it returns a value of -1. ERRORS If the gethostbyname() or gethostbyname_r() function call fails, h_er- rno is set to one of the following the values: The name you have used is not an official hostname or alias; this is not a soft error, another type of name server request may be successful. The requested name is valid but does not have an Internet address at the name server. This is a nonrecoverable error. This is a soft error that indicates that the local server did not receive a response from an authoritative server. A retry at some later time may be successful. [Digital] If any of the following conditions occurs, the gethost- byaddr_r() function sets errno to the corresponding value: The name, hptr, or hdptr is invalid. FILES The DARPA Internet network hostname database. Each record in the file occupies a single line and has three fields consisting of the host ad- dress, official hostname, and aliases. The resolver configuration file. The database service selection configuration file. RELATED INFORMATION Functions: endhostent(3), gethostbyaddr(3), sethostent(3) Files: hostname(5), resolv.conf(4), svc.conf(4) Networks: bind_intro(7), nis_intro(7) Standards: standards(5) delim off gethostbyname(3)

Navigation Options