Date: Sat, 22 Sep 2012 17:46:53 +0000 (UTC) From: Pawel Jakub Dawidek <pjd@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r240832 - head/share/man/man4 Message-ID: <201209221746.q8MHkrCh011728@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: pjd Date: Sat Sep 22 17:46:53 2012 New Revision: 240832 URL: http://svn.freebsd.org/changeset/base/240832 Log: Make the example a bit more pretty. Modified: head/share/man/man4/ip6.4 Modified: head/share/man/man4/ip6.4 ============================================================================== --- head/share/man/man4/ip6.4 Sat Sep 22 17:42:53 2012 (r240831) +++ head/share/man/man4/ip6.4 Sat Sep 22 17:46:53 2012 (r240832) @@ -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_HOP 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:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201209221746.q8MHkrCh011728>