diff options
author | deraadt <> | 1999-05-21 18:18:09 +0000 |
---|---|---|
committer | deraadt <> | 1999-05-21 18:18:09 +0000 |
commit | 1abc8be4fa63f568a83ba3d03fda54416a6206ff (patch) | |
tree | fa46e74e1aecc260d25d7a3761eb81dc8fb99ded /src | |
parent | 6c16a185dbe509e06e420da000b1d0526c17bea4 (diff) | |
download | openbsd-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.3 | 56 |
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 | |||
72 | each return a pointer to an object with the | 72 | each return a pointer to an object with the |
73 | following structure describing an internet host | 73 | following structure describing an internet host |
74 | referenced by name or by address, respectively. | 74 | referenced by name or by address, respectively. |
75 | This structure contains either the information obtained from the name server, | 75 | This structure contains either information obtained from the name server (ie. |
76 | .Xr named 8 , | 76 | .Xr resolver 3 |
77 | and | ||
78 | .Xr named 8 ), Ns | ||
77 | broken-out fields from a line in | 79 | broken-out fields from a line in |
78 | .Pa /etc/hosts , | 80 | .Pa /etc/hosts , |
79 | or database entries supplied by the | 81 | or database entries supplied by the |
80 | .Xr yp 8 | 82 | .Xr yp 8 |
81 | system . | 83 | system. |
82 | If the local name server is not running these routines do a lookup in | 84 | .Xr resolv.conf 5 |
83 | .Pa /etc/hosts . | 85 | describes how the particular database is chosen. |
84 | .Bd -literal | 86 | .Bd -literal |
85 | struct hostent { | 87 | struct 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 | |||
111 | this is for backward compatibility. | 113 | this is for backward compatibility. |
112 | .El | 114 | .El |
113 | .Pp | 115 | .Pp |
114 | When using the nameserver, | 116 | The function |
115 | .Fn gethostbyname | 117 | .Fn gethostbyname |
116 | will search for the named host in the current domain and its parents | 118 | will search for the named host in the current domain and its parents |
117 | unless the name ends in a dot. | 119 | using the search lookup semantics detailed in |
118 | If the name contains no dot, and if the environment variable | 120 | .Xr resolv.conf 5 |
119 | .Dq Ev HOSTALIASES | 121 | and |
120 | contains the name of an alias file, the alias file will first be searched | 122 | .Xr hostname 7 . |
121 | for an alias matching the input name. | ||
122 | See | ||
123 | .Xr hostname 7 | ||
124 | for the domain search procedure and the alias file format. | ||
125 | .Pp | 123 | .Pp |
126 | .Fn gethostbyname2 | 124 | .Fn gethostbyname2 |
127 | is an advanced form of | 125 | is an advanced form of |
@@ -132,6 +130,15 @@ for example | |||
132 | .Dv AF_INET6 . | 130 | .Dv AF_INET6 . |
133 | .Pp | 131 | .Pp |
134 | The | 132 | The |
133 | .Fn gethostbyaddr | ||
134 | function will search for the specified address of length | ||
135 | .Dv len | ||
136 | in the address family | ||
137 | .Dv af . | ||
138 | The only address family currently supported is | ||
139 | .Dv AF_INET . | ||
140 | .Pp | ||
141 | The | ||
135 | .Fn sethostent | 142 | .Fn sethostent |
136 | function | 143 | function |
137 | may be used to request the use of a connected | 144 | may 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 | |||
170 | with argument | 177 | with 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 |
177 | Error return status from | 185 | Error 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 |
217 | The | 226 | If the search routines in |
227 | .Xr resolv.conf 5 | ||
228 | decide to read the | ||
229 | .Pa /etc/hosts | ||
230 | file, | ||
218 | .Fn gethostent | 231 | .Fn gethostent |
219 | function | 232 | and other functions will |
220 | reads the next line of | 233 | read the next line of the file, |
221 | .Pa /etc/hosts , | 234 | re-opening the file if necessary. |
222 | opening the file if necessary. | ||
223 | .Pp | 235 | .Pp |
224 | The | 236 | The |
225 | .Fn sethostent | 237 | .Fn sethostent |