MCPcopy Index your code
hub / github.com/F-Stack/f-stack / printb

Function printb

tools/ifconfig/ifconfig.c:1623–1649  ·  view source on GitHub ↗

* Print a value a la the %b format of the kernel's printf */

Source from the content-addressed store, hash-verified

1621 * Print a value a la the %b format of the kernel's printf
1622 */
1623void
1624printb(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
1651void
1652print_vhid(const struct ifaddrs *ifa, const char *s)

Callers 9

ifconfig.cFile · 0.70
regdomain_addchansFunction · 0.70
list_capabilitiesFunction · 0.70
gif_statusFunction · 0.70
ifgre.cFile · 0.70
bridge_interfacesFunction · 0.70
bridge_addressesFunction · 0.70
lagg_statusFunction · 0.70
nd6_statusFunction · 0.70

Calls 2

putcharFunction · 0.85
printfFunction · 0.50

Tested by

no test coverage detected