summaryrefslogtreecommitdiffstats
path: root/share/man/man4/ip6.4
diff options
context:
space:
mode:
authorpjd <pjd@FreeBSD.org>2012-09-22 17:46:53 +0000
committerpjd <pjd@FreeBSD.org>2012-09-22 17:46:53 +0000
commit23996dabfa90b6706533b1052e49dfb7951ab8d6 (patch)
tree630d6a16be7496c842c4c3f49ad8e74df866a981 /share/man/man4/ip6.4
parent02934e110a785a9a3f85509757c2a164e02801f6 (diff)
downloadFreeBSD-src-23996dabfa90b6706533b1052e49dfb7951ab8d6.zip
FreeBSD-src-23996dabfa90b6706533b1052e49dfb7951ab8d6.tar.gz
Make the example a bit more pretty.
Diffstat (limited to 'share/man/man4/ip6.4')
-rw-r--r--share/man/man4/ip6.411
1 files changed, 6 insertions, 5 deletions
diff --git a/share/man/man4/ip6.4 b/share/man/man4/ip6.4
index fdbb956..fcd396c 100644
--- a/share/man/man4/ip6.4
+++ b/share/man/man4/ip6.4
@@ -570,7 +570,8 @@ struct iovec iov[2];
u_char buf[BUFSIZ];
struct cmsghdr *cm;
struct msghdr m;
-int found, optval;
+int optval;
+bool found;
u_char data[2048];
/* Create socket. */
@@ -597,8 +598,8 @@ if (setsockopt(s, IPPROTO_IPV6, IPV6_HOPLIMIT, &optval,
sizeof(optval)) == -1)
err(1, "setsockopt");
-found = 0;
-while (!found) {
+found = false;
+do {
if (recvmsg(s, &m, 0) == -1)
err(1, "recvmsg");
for (cm = CMSG_FIRSTHDR(&m); cm != NULL;
@@ -606,13 +607,13 @@ while (!found) {
if (cm->cmsg_level == IPPROTO_IPV6 &&
cm->cmsg_type == IPV6_HOPLIMIT &&
cm->cmsg_len == CMSG_LEN(sizeof(int))) {
- found = 1;
+ found = true;
(void)printf("hop limit: %d\en",
*(int *)CMSG_DATA(cm));
break;
}
}
-}
+} while (!found);
.Ed
.Sh DIAGNOSTICS
A socket operation may fail with one of the following errors returned:
OpenPOWER on IntegriCloud