Change examples to be consistent with what style(9) says.
Approved by: joel (mentor) MFC After: 2 weeks
This commit is contained in:
parent
4eca904fe7
commit
8e06979521
@ -18,7 +18,7 @@
|
|||||||
.\"
|
.\"
|
||||||
.\" $FreeBSD$
|
.\" $FreeBSD$
|
||||||
.\"
|
.\"
|
||||||
.Dd January 6, 2009
|
.Dd February 14, 2013
|
||||||
.Dt GETADDRINFO 3
|
.Dt GETADDRINFO 3
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
@ -339,7 +339,7 @@ hints.ai_socktype = SOCK_STREAM;
|
|||||||
error = getaddrinfo("www.kame.net", "http", &hints, &res0);
|
error = getaddrinfo("www.kame.net", "http", &hints, &res0);
|
||||||
if (error) {
|
if (error) {
|
||||||
errx(1, "%s", gai_strerror(error));
|
errx(1, "%s", gai_strerror(error));
|
||||||
/*NOTREACHED*/
|
/* NOTREACHED */
|
||||||
}
|
}
|
||||||
s = -1;
|
s = -1;
|
||||||
for (res = res0; res; res = res->ai_next) {
|
for (res = res0; res; res = res->ai_next) {
|
||||||
@ -361,7 +361,7 @@ for (res = res0; res; res = res->ai_next) {
|
|||||||
}
|
}
|
||||||
if (s < 0) {
|
if (s < 0) {
|
||||||
err(1, "%s", cause);
|
err(1, "%s", cause);
|
||||||
/*NOTREACHED*/
|
/* NOTREACHED */
|
||||||
}
|
}
|
||||||
freeaddrinfo(res0);
|
freeaddrinfo(res0);
|
||||||
.Ed
|
.Ed
|
||||||
@ -383,7 +383,7 @@ hints.ai_flags = AI_PASSIVE;
|
|||||||
error = getaddrinfo(NULL, "http", &hints, &res0);
|
error = getaddrinfo(NULL, "http", &hints, &res0);
|
||||||
if (error) {
|
if (error) {
|
||||||
errx(1, "%s", gai_strerror(error));
|
errx(1, "%s", gai_strerror(error));
|
||||||
/*NOTREACHED*/
|
/* NOTREACHED */
|
||||||
}
|
}
|
||||||
nsock = 0;
|
nsock = 0;
|
||||||
for (res = res0; res && nsock < MAXSOCK; res = res->ai_next) {
|
for (res = res0; res && nsock < MAXSOCK; res = res->ai_next) {
|
||||||
@ -405,7 +405,7 @@ for (res = res0; res && nsock < MAXSOCK; res = res->ai_next) {
|
|||||||
}
|
}
|
||||||
if (nsock == 0) {
|
if (nsock == 0) {
|
||||||
err(1, "%s", cause);
|
err(1, "%s", cause);
|
||||||
/*NOTREACHED*/
|
/* NOTREACHED */
|
||||||
}
|
}
|
||||||
freeaddrinfo(res0);
|
freeaddrinfo(res0);
|
||||||
.Ed
|
.Ed
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
.\"
|
.\"
|
||||||
.\" $FreeBSD$
|
.\" $FreeBSD$
|
||||||
.\"
|
.\"
|
||||||
.Dd February 28, 2007
|
.Dd February 14, 2013
|
||||||
.Dt GETNAMEINFO 3
|
.Dt GETNAMEINFO 3
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
@ -157,7 +157,7 @@ char hbuf[NI_MAXHOST], sbuf[NI_MAXSERV];
|
|||||||
if (getnameinfo(sa, sa->sa_len, hbuf, sizeof(hbuf), sbuf,
|
if (getnameinfo(sa, sa->sa_len, hbuf, sizeof(hbuf), sbuf,
|
||||||
sizeof(sbuf), NI_NUMERICHOST | NI_NUMERICSERV)) {
|
sizeof(sbuf), NI_NUMERICHOST | NI_NUMERICSERV)) {
|
||||||
errx(1, "could not get numeric hostname");
|
errx(1, "could not get numeric hostname");
|
||||||
/*NOTREACHED*/
|
/* NOTREACHED */
|
||||||
}
|
}
|
||||||
printf("host=%s, serv=%s\en", hbuf, sbuf);
|
printf("host=%s, serv=%s\en", hbuf, sbuf);
|
||||||
.Ed
|
.Ed
|
||||||
@ -170,7 +170,7 @@ char hbuf[NI_MAXHOST];
|
|||||||
if (getnameinfo(sa, sa->sa_len, hbuf, sizeof(hbuf), NULL, 0,
|
if (getnameinfo(sa, sa->sa_len, hbuf, sizeof(hbuf), NULL, 0,
|
||||||
NI_NAMEREQD)) {
|
NI_NAMEREQD)) {
|
||||||
errx(1, "could not resolve hostname");
|
errx(1, "could not resolve hostname");
|
||||||
/*NOTREACHED*/
|
/* NOTREACHED */
|
||||||
}
|
}
|
||||||
printf("host=%s\en", hbuf);
|
printf("host=%s\en", hbuf);
|
||||||
.Ed
|
.Ed
|
||||||
|
Loading…
Reference in New Issue
Block a user