* Print a value a la the %b format of the kernel's printf */
| 1621 | * Print a value a la the %b format of the kernel's printf |
| 1622 | */ |
| 1623 | void |
| 1624 | printb(const char *s, unsigned v, const char *bits) |
| 1625 | { |
| 1626 | int i, any = 0; |
| 1627 | char c; |
| 1628 | |
| 1629 | if (bits && *bits == 8) |
| 1630 | printf("%s=%o", s, v); |
| 1631 | else |
| 1632 | printf("%s=%x", s, v); |
| 1633 | if (bits) { |
| 1634 | bits++; |
| 1635 | putchar('<'); |
| 1636 | while ((i = *bits++) != '\0') { |
| 1637 | if (v & (1 << (i-1))) { |
| 1638 | if (any) |
| 1639 | putchar(','); |
| 1640 | any = 1; |
| 1641 | for (; (c = *bits) > 32; bits++) |
| 1642 | putchar(c); |
| 1643 | } else |
| 1644 | for (; *bits > 32; bits++) |
| 1645 | ; |
| 1646 | } |
| 1647 | putchar('>'); |
| 1648 | } |
| 1649 | } |
| 1650 | |
| 1651 | void |
| 1652 | print_vhid(const struct ifaddrs *ifa, const char *s) |
no test coverage detected