summaryrefslogtreecommitdiff
path: root/src/lib/libc/net/gethostbyname.3
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libc/net/gethostbyname.3')
-rw-r--r--src/lib/libc/net/gethostbyname.348
1 files changed, 26 insertions, 22 deletions
diff --git a/src/lib/libc/net/gethostbyname.3 b/src/lib/libc/net/gethostbyname.3
index 8dfdb88cf0..1394fa3467 100644
--- a/src/lib/libc/net/gethostbyname.3
+++ b/src/lib/libc/net/gethostbyname.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: gethostbyname.3,v 1.3 1996/08/19 08:28:38 tholo Exp $ 1.\" $OpenBSD: gethostbyname.3,v 1.4 1997/03/13 19:07:23 downsj Exp $
2.\" 2.\"
3.\" Copyright (c) 1983, 1987, 1991, 1993 3.\" Copyright (c) 1983, 1987, 1991, 1993
4.\" The Regents of the University of California. All rights reserved. 4.\" The Regents of the University of California. All rights reserved.
@@ -31,11 +31,12 @@
31.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32.\" SUCH DAMAGE. 32.\" SUCH DAMAGE.
33.\" 33.\"
34.Dd April 19, 1994 34.Dd March 13, 1997
35.Dt GETHOSTBYNAME 3 35.Dt GETHOSTBYNAME 3
36.Os BSD 4.2 36.Os
37.Sh NAME 37.Sh NAME
38.Nm gethostbyname , 38.Nm gethostbyname ,
39.Nm gethostbyname2 ,
39.Nm gethostbyaddr , 40.Nm gethostbyaddr ,
40.Nm gethostent , 41.Nm gethostent ,
41.Nm sethostent , 42.Nm sethostent ,
@@ -48,6 +49,8 @@
48.Ft struct hostent * 49.Ft struct hostent *
49.Fn gethostbyname "const char *name" 50.Fn gethostbyname "const char *name"
50.Ft struct hostent * 51.Ft struct hostent *
52.Fn gethostbyname2 "const char *name" "int af"
53.Ft struct hostent *
51.Fn gethostbyaddr "const char *addr" "int len" "int type" 54.Fn gethostbyaddr "const char *addr" "int len" "int type"
52.Ft struct hostent * 55.Ft struct hostent *
53.Fn gethostent void 56.Fn gethostent void
@@ -93,8 +96,7 @@ Official name of the host.
93.It Fa h_aliases 96.It Fa h_aliases
94A zero terminated array of alternate names for the host. 97A zero terminated array of alternate names for the host.
95.It Fa h_addrtype 98.It Fa h_addrtype
96The type of address being returned; currently always 99The type of address being returned.
97.Dv AF_INET .
98.It Fa h_length 100.It Fa h_length
99The length, in bytes, of the address. 101The length, in bytes, of the address.
100.It Fa h_addr_list 102.It Fa h_addr_list
@@ -104,6 +106,7 @@ Host addresses are returned in network byte order.
104The first address in 106The first address in
105.Fa h_addr_list ; 107.Fa h_addr_list ;
106this is for backward compatibility. 108this is for backward compatibility.
109.El
107.Pp 110.Pp
108When using the nameserver, 111When using the nameserver,
109.Fn gethostbyname 112.Fn gethostbyname
@@ -117,6 +120,14 @@ See
117.Xr hostname 7 120.Xr hostname 7
118for the domain search procedure and the alias file format. 121for the domain search procedure and the alias file format.
119.Pp 122.Pp
123.Fn Gethostbyname2
124is an advanced form of
125.Fn gethostbyname
126which allows lookups in address families other than
127.Dv AF_INET ,
128for example
129.Dv AF_INET6 .
130.Pp
120The 131The
121.Fn sethostent 132.Fn sethostent
122function 133function
@@ -148,7 +159,8 @@ connection.
148.El 159.El
149.Sh DIAGNOSTICS 160.Sh DIAGNOSTICS
150Error return status from 161Error return status from
151.Fn gethostbyname 162.Fn gethostbyname ,
163.Fn gethostbyname2 ,
152and 164and
153.Fn gethostbyaddr 165.Fn gethostbyaddr
154is indicated by return of a null pointer. 166is indicated by return of a null pointer.
@@ -198,20 +210,6 @@ for example, a mail-forwarder may be registered for this domain.
198The 210The
199.Fn gethostent 211.Fn gethostent
200function 212function
201is defined, and
202.Fn sethostent
203and
204.Fn endhostent
205are redefined,
206when
207.Xr libc 3
208is built to use only the routines to lookup in
209.Pa /etc/hosts
210and not the name server.
211.Pp
212The
213.Fn gethostent
214function
215reads the next line of 213reads the next line of
216.Pa /etc/hosts , 214.Pa /etc/hosts ,
217opening the file if necessary. 215opening the file if necessary.
@@ -225,7 +223,8 @@ If the
225.Fa stayopen 223.Fa stayopen
226argument is non-zero, 224argument is non-zero,
227the file will not be closed after each call to 225the file will not be closed after each call to
228.Fn gethostbyname 226.Fn gethostbyname ,
227.Fn gethostbyname2 ,
229or 228or
230.Fn gethostbyaddr . 229.Fn gethostbyaddr .
231.Pp 230.Pp
@@ -252,4 +251,9 @@ These functions use static data storage;
252if the data is needed for future use, it should be 251if the data is needed for future use, it should be
253copied before any subsequent calls overwrite it. 252copied before any subsequent calls overwrite it.
254Only the Internet 253Only the Internet
255address format is currently understood. 254address formats are currently understood.
255.Pp
256YP does not support any address families other than
257.Dv AF_INET
258and uses
259the traditional database format.