mdoc(7) police: polishing.

This commit is contained in:
Ruslan Ermilov 2001-02-10 10:51:39 +00:00
parent 429d919c70
commit c634427cd5

View File

@ -83,7 +83,9 @@ parameter passed to
.Fn gethostbyname
or
.Fn gethostbyname2
should point to a NUL-terminated hostname.
should point to a
.Dv NUL Ns -terminated
hostname.
The
.Fa addr
parameter passed to
@ -92,15 +94,15 @@ should point to an address which is
.Fa len
bytes long,
in binary form
(i.e. not an IP address in human readable ASCII form).
(i.e. not an IP address in human readable
.Tn ASCII
form).
The
.Fa type
parameter specifies the address family
(e.g.
.Dv AF_INET ,
.Dv AF_INET6 ,
etc)
of this address.
(e.g.\&
.Dv AF_INET , AF_INET6 ,
etc.) of this address.
.Pp
The structure returned contains either the information obtained from the name
server,
@ -127,21 +129,25 @@ struct hostent {
.Pp
The members of this structure are:
.Bl -tag -width h_addr_list
.It Fa h_name
.It Va h_name
Official name of the host.
.It Fa h_aliases
A NULL-terminated array of alternate names for the host.
.It Fa h_addrtype
.It Va h_aliases
A
.Dv NULL Ns -terminated
array of alternate names for the host.
.It Va h_addrtype
The type of address being returned; usually
.Dv AF_INET .
.It Fa h_length
.It Va h_length
The length, in bytes, of the address.
.It Fa h_addr_list
A NULL-terminated array of network addresses for the host.
.It Va h_addr_list
A
.Dv NULL Ns -terminated
array of network addresses for the host.
Host addresses are returned in network byte order.
.It Fa h_addr
.It Va h_addr
The first address in
.Fa h_addr_list ;
.Va h_addr_list ;
this is for backward compatibility.
.El
.Pp
@ -200,7 +206,9 @@ The
function writes a message to the diagnostic output consisting of the
string parameter
.Fa s ,
the constant string ": ", and a message corresponding to the value of
the constant string
.Qq Li ":\ " ,
and a message corresponding to the value of
.Va h_errno .
.Pp
The
@ -217,28 +225,29 @@ parameter.
.El
.Sh EXAMPLES
Print out the hostname associated with a specific IP address:
.Pp
.Bd -literal
const char *ipstr = "127.0.0.1";
struct in_addr ip;
struct hostent *hp;
.Bd -literal -offset indent
const char *ipstr = "127.0.0.1";
struct in_addr ip;
struct hostent *hp;
if (!inet_aton(ipstr, &ip))
errx(1, "can't parse IP address %s", ipstr);
if (!inet_aton(ipstr, &ip))
errx(1, "can't parse IP address %s", ipstr);
if ((hp = gethostbyaddr((const char *)&ip,
sizeof ip, AF_INET)) == NULL)
errx(1, "no name associated with %s", ipstr);
if ((hp = gethostbyaddr((const char *)&ip,
sizeof ip, AF_INET)) == NULL)
errx(1, "no name associated with %s", ipstr);
printf("name associated with %s is %s\en", ipstr, hp->h_name);
.Ed -literal
printf("name associated with %s is %s\en", ipstr, hp->h_name);
.Ed
.Sh DIAGNOSTICS
Error return status from
.Fn gethostbyname ,
.Fn gethostbyname2
and
.Fn gethostbyaddr
is indicated by return of a null pointer.
is indicated by return of a
.Dv NULL
pointer.
The external integer
.Va h_errno
may then be checked to see whether this is a temporary failure
@ -249,7 +258,7 @@ can be used to print an error message describing the failure.
If its argument
.Fa string
is
.Pf non Dv -NULL ,
.Pf non- Dv NULL ,
it is printed, followed by a colon and a space.
The error message is printed with a trailing newline.
.Pp
@ -338,7 +347,9 @@ functions appeared in
.Bx 4.2 .
The
.Fn gethostbyname2
function first appeared in bind-4.9.4.
function first appeared in
.Tn BIND
version 4.9.4.
.Sh BUGS
These functions use static data storage;
if the data is needed for future use, it should be