examples/info.c
/*
 * Pretty-print a device's capabilities flags and return the result.
 */
Pretty-print a device's capabilities flags and return the result.
Pretty - print a device ' s capabilities flags and return the result .
static void
format_flags(char *ret, size_t retlen, uint8_t flags)
{
	memset(ret, 0, retlen);
	if (flags & FIDO_CAP_WINK) {
		if (strlcat(ret, "wink,", retlen) >= retlen)
			goto toolong;
	} else {
		if (strlcat(ret, "nowink,", retlen) >= retlen)
			goto toolong;
	}
	if (flags & FIDO_CAP_CBOR) {
		if (strlcat(ret, " cbor,", retlen) >= retlen)
			goto toolong;
	} else {
		if (strlcat(ret, " nocbor,", retlen) >= retlen)
			goto toolong;
	}
	if (flags & FIDO_CAP_NMSG) {
		if (strlcat(ret, " nomsg", retlen) >= retlen)
			goto toolong;
	} else {
		if (strlcat(ret, " msg", retlen) >= retlen)
			goto toolong;
	}
	return;
toolong:
	strlcpy(ret, "toolong", retlen);
}
static void format_flags ( char * ret , size_t retlen , uint8_t flags ) { memset ( ret , 0 , retlen ) ; if ( flags & FIDO_CAP_WINK ) { if ( strlcat ( ret , " " , retlen ) >= retlen ) goto toolong ; } else { if ( strlcat ( ret , " " , retlen ) >= retlen ) goto toolong ; } if ( flags & FIDO_CAP_CBOR ) { if ( strlcat ( ret , " " , retlen ) >= retlen ) goto toolong ; } else { if ( strlcat ( ret , " " , retlen ) >= retlen ) goto toolong ; } if ( flags & FIDO_CAP_NMSG ) { if ( strlcat ( ret , " " , retlen ) >= retlen ) goto toolong ; } else { if ( strlcat ( ret , " " , retlen ) >= retlen ) goto toolong ; } return ; toolong : strlcpy ( ret , " " , retlen ) ; }
Pretty-print a device's capabilities flags and return the result.
Pretty - print a device ' s capabilities flags and return the result .