/* Helper routine for bitmap_scnlistprintf(). Write decimal number or range to buf, suppressing output past buf+buflen, with optional comma-prefix. Return len of what would be written to buf, if it all fit.  */
static int bscnl_emit(char *buf, int buflen, int rbot, int rtop, int len)
/* Helper routine for bitmap_scnlistprintf(). Write decimal number or range to buf, suppressing output past buf+buflen, with optional comma-prefix. Return len of what would be written to buf, if it all fit.  */
static int bscnl_emit(char *buf, int buflen, int rbot, int rtop, int len)
{
	if (len > 0)
		len += scnprintf(buf + len, buflen - len, ",");
	if (rbot == rtop)
		len += scnprintf(buf + len, buflen - len, "%d", rbot);
	else
		len += scnprintf(buf + len, buflen - len, "%d-%d", rbot, rtop);
	return len;
}