ccanlint: print coverage amount when -vv
[ccan] / ccan / net / _info
index 0b38c440061fd77776091e8813c26e10f14c4937..a9c57206af368f1c7964fe50e0b41301738dcf99 100644 (file)
@@ -14,6 +14,7 @@
  *     #include <ccan/net/net.h>
  *     #include <sys/types.h>
  *     #include <sys/socket.h>
+ *     #include <netinet/in.h>
  *     #include <stdio.h>
  *     #include <err.h>
  *
  *             struct addrinfo *addr;
  *             const char *dest, *port;
  *             int fd;
- *             struct sockaddr saddr;
- *             socklen_t slen = sizeof(saddr);
+ *             union {
+ *                     struct sockaddr s;
+ *                     struct sockaddr_in v4;
+ *                     struct sockaddr_in6 v6;
+ *             } u;
+ *             socklen_t slen = sizeof(u);
  *     
  *             if (argc == 2) {
  *                     dest = argv[1];
  *             if (fd < 0)
  *                     err(1, "Failed to connect to %s", dest);
  *     
- *             if (getsockname(fd, &saddr, &slen) == 0)
+ *             if (getsockname(fd, &u.s, &slen) == 0)
  *                     printf("Connected via %s\n",
- *                            saddr.sa_family == AF_INET6 ? "IPv6"
- *                            : saddr.sa_family == AF_INET ? "IPv4"
+ *                            u.s.sa_family == AF_INET6 ? "IPv6"
+ *                            : u.s.sa_family == AF_INET ? "IPv4"
  *                            : "UNKNOWN??");
  *             else
  *                     err(1, "Failed to get socket type for connection");
@@ -59,7 +64,6 @@ int main(int argc, char *argv[])
                return 1;
 
        if (strcmp(argv[1], "depends") == 0) {
-               printf("ccan/noerr\n");
                return 0;
        }