summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorderaadt <>1999-05-21 18:18:09 +0000
committerderaadt <>1999-05-21 18:18:09 +0000
commit1abc8be4fa63f568a83ba3d03fda54416a6206ff (patch)
treefa46e74e1aecc260d25d7a3761eb81dc8fb99ded /src
parent6c16a185dbe509e06e420da000b1d0526c17bea4 (diff)
downloadopenbsd-1abc8be4fa63f568a83ba3d03fda54416a6206ff.tar.gz
openbsd-1abc8be4fa63f568a83ba3d03fda54416a6206ff.tar.bz2
openbsd-1abc8be4fa63f568a83ba3d03fda54416a6206ff.zip
improve. pushed by bengt@softwell.se
Diffstat (limited to 'src')
-rw-r--r--src/lib/libc/net/gethostbyname.356
1 files changed, 34 insertions, 22 deletions
diff --git a/src/lib/libc/net/gethostbyname.3 b/src/lib/libc/net/gethostbyname.3
index e28fed361c..a71048779b 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.10 1999/02/27 21:55:27 deraadt Exp $ 1.\" $OpenBSD: gethostbyname.3,v 1.11 1999/05/21 18:18:09 deraadt 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.
@@ -52,7 +52,7 @@
52.Ft struct hostent * 52.Ft struct hostent *
53.Fn gethostbyname2 "const char *name" "int af" 53.Fn gethostbyname2 "const char *name" "int af"
54.Ft struct hostent * 54.Ft struct hostent *
55.Fn gethostbyaddr "const char *addr" "int len" "int type" 55.Fn gethostbyaddr "const char *addr" "int len" "int af"
56.Ft struct hostent * 56.Ft struct hostent *
57.Fn gethostent void 57.Fn gethostent void
58.Ft void 58.Ft void
@@ -72,15 +72,17 @@ functions
72each return a pointer to an object with the 72each return a pointer to an object with the
73following structure describing an internet host 73following structure describing an internet host
74referenced by name or by address, respectively. 74referenced by name or by address, respectively.
75This structure contains either the information obtained from the name server, 75This structure contains either information obtained from the name server (ie.
76.Xr named 8 , 76.Xr resolver 3
77and
78.Xr named 8 ), Ns
77broken-out fields from a line in 79broken-out fields from a line in
78.Pa /etc/hosts , 80.Pa /etc/hosts ,
79or database entries supplied by the 81or database entries supplied by the
80.Xr yp 8 82.Xr yp 8
81system . 83system.
82If the local name server is not running these routines do a lookup in 84.Xr resolv.conf 5
83.Pa /etc/hosts . 85describes how the particular database is chosen.
84.Bd -literal 86.Bd -literal
85struct hostent { 87struct hostent {
86 char *h_name; /* official name of host */ 88 char *h_name; /* official name of host */
@@ -111,17 +113,13 @@ The first address in
111this is for backward compatibility. 113this is for backward compatibility.
112.El 114.El
113.Pp 115.Pp
114When using the nameserver, 116The function
115.Fn gethostbyname 117.Fn gethostbyname
116will search for the named host in the current domain and its parents 118will search for the named host in the current domain and its parents
117unless the name ends in a dot. 119using the search lookup semantics detailed in
118If the name contains no dot, and if the environment variable 120.Xr resolv.conf 5
119.Dq Ev HOSTALIASES 121and
120contains the name of an alias file, the alias file will first be searched 122.Xr hostname 7 .
121for an alias matching the input name.
122See
123.Xr hostname 7
124for the domain search procedure and the alias file format.
125.Pp 123.Pp
126.Fn gethostbyname2 124.Fn gethostbyname2
127is an advanced form of 125is an advanced form of
@@ -132,6 +130,15 @@ for example
132.Dv AF_INET6 . 130.Dv AF_INET6 .
133.Pp 131.Pp
134The 132The
133.Fn gethostbyaddr
134function will search for the specified address of length
135.Dv len
136in the address family
137.Dv af .
138The only address family currently supported is
139.Dv AF_INET .
140.Pp
141The
135.Fn sethostent 142.Fn sethostent
136function 143function
137may be used to request the use of a connected 144may be used to request the use of a connected
@@ -170,8 +177,9 @@ The contents of the error message is the same as that returned by
170with argument 177with argument
171.Fa h_errno . 178.Fa h_errno .
172.Sh FILES 179.Sh FILES
173.Bl -tag -width /etc/hosts -compact 180.Bl -tag -width /etc/resolv.conf -compact
174.It Pa /etc/hosts 181.It Pa /etc/hosts
182.It Pa /etc/resolv.conf
175.El 183.El
176.Sh DIAGNOSTICS 184.Sh DIAGNOSTICS
177Error return status from 185Error return status from
@@ -211,15 +219,19 @@ for example, a mail-forwarder may be registered for this domain.
211.Sh SEE ALSO 219.Sh SEE ALSO
212.Xr resolver 3 , 220.Xr resolver 3 ,
213.Xr hosts 5 , 221.Xr hosts 5 ,
222.Xr resolv.conf 5 ,
214.Xr hostname 7 , 223.Xr hostname 7 ,
215.Xr named 8 224.Xr named 8
216.Sh CAVEAT 225.Sh CAVEAT
217The 226If the search routines in
227.Xr resolv.conf 5
228decide to read the
229.Pa /etc/hosts
230file,
218.Fn gethostent 231.Fn gethostent
219function 232and other functions will
220reads the next line of 233read the next line of the file,
221.Pa /etc/hosts , 234re-opening the file if necessary.
222opening the file if necessary.
223.Pp 235.Pp
224The 236The
225.Fn sethostent 237.Fn sethostent