Deleted Added
full compact
gethostbyname.3 (145633) gethostbyname.3 (158477)
1.\" Copyright (c) 1983, 1987, 1991, 1993
2.\" The Regents of the University of California. All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\" notice, this list of conditions and the following disclaimer.

--- 16 unchanged lines hidden (view full) ---

25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30.\" SUCH DAMAGE.
31.\"
32.\" From: @(#)gethostbyname.3 8.4 (Berkeley) 5/25/95
1.\" Copyright (c) 1983, 1987, 1991, 1993
2.\" The Regents of the University of California. All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\" notice, this list of conditions and the following disclaimer.

--- 16 unchanged lines hidden (view full) ---

25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30.\" SUCH DAMAGE.
31.\"
32.\" From: @(#)gethostbyname.3 8.4 (Berkeley) 5/25/95
33.\" $FreeBSD: head/lib/libc/net/gethostbyname.3 145633 2005-04-28 18:03:43Z ume $
33.\" $FreeBSD: head/lib/libc/net/gethostbyname.3 158477 2006-05-12 15:37:23Z ume $
34.\"
35.Dd May 25, 1995
36.Dt GETHOSTBYNAME 3
37.Os
38.Sh NAME
39.Nm gethostbyname ,
40.Nm gethostbyname2 ,
41.Nm gethostbyaddr ,

--- 8 unchanged lines hidden (view full) ---

50.Sh SYNOPSIS
51.In netdb.h
52.Vt extern int h_errno ;
53.Ft struct hostent *
54.Fn gethostbyname "const char *name"
55.Ft struct hostent *
56.Fn gethostbyname2 "const char *name" "int af"
57.Ft struct hostent *
34.\"
35.Dd May 25, 1995
36.Dt GETHOSTBYNAME 3
37.Os
38.Sh NAME
39.Nm gethostbyname ,
40.Nm gethostbyname2 ,
41.Nm gethostbyaddr ,

--- 8 unchanged lines hidden (view full) ---

50.Sh SYNOPSIS
51.In netdb.h
52.Vt extern int h_errno ;
53.Ft struct hostent *
54.Fn gethostbyname "const char *name"
55.Ft struct hostent *
56.Fn gethostbyname2 "const char *name" "int af"
57.Ft struct hostent *
58.Fn gethostbyaddr "const char *addr" "int len" "int type"
58.Fn gethostbyaddr "const void *addr" "socklen_t len" "int type"
59.Ft struct hostent *
60.Fn gethostent void
61.Ft void
62.Fn sethostent "int stayopen"
63.Ft void
64.Fn endhostent void
65.Ft void
66.Fn herror "const char *string"

--- 174 unchanged lines hidden (view full) ---

241.Bd -literal -offset indent
242const char *ipstr = "127.0.0.1";
243struct in_addr ip;
244struct hostent *hp;
245
246if (!inet_aton(ipstr, &ip))
247 errx(1, "can't parse IP address %s", ipstr);
248
59.Ft struct hostent *
60.Fn gethostent void
61.Ft void
62.Fn sethostent "int stayopen"
63.Ft void
64.Fn endhostent void
65.Ft void
66.Fn herror "const char *string"

--- 174 unchanged lines hidden (view full) ---

241.Bd -literal -offset indent
242const char *ipstr = "127.0.0.1";
243struct in_addr ip;
244struct hostent *hp;
245
246if (!inet_aton(ipstr, &ip))
247 errx(1, "can't parse IP address %s", ipstr);
248
249if ((hp = gethostbyaddr((const char *)&ip,
249if ((hp = gethostbyaddr((const void *)&ip,
250 sizeof ip, AF_INET)) == NULL)
251 errx(1, "no name associated with %s", ipstr);
252
253printf("name associated with %s is %s\en", ipstr, hp->h_name);
254.Ed
255.Sh DIAGNOSTICS
256Error return status from
257.Fn gethostbyname ,

--- 122 unchanged lines hidden ---
250 sizeof ip, AF_INET)) == NULL)
251 errx(1, "no name associated with %s", ipstr);
252
253printf("name associated with %s is %s\en", ipstr, hp->h_name);
254.Ed
255.Sh DIAGNOSTICS
256Error return status from
257.Fn gethostbyname ,

--- 122 unchanged lines hidden ---