From 441c691c0964f07d90f667fd83e3baa2a3b03966 Mon Sep 17 00:00:00 2001 From: Moe Jette <jette1@llnl.gov> Date: Tue, 30 Jun 2009 22:29:07 +0000 Subject: [PATCH] modify bit_fmt to use brackets whenever there is more than one bit set rather than one _set of_ consecutive bits. For example "1-3" is now printed as "[1-3]" and "3" stays the same, and "[1-3,5-6]" also stays the same --- src/common/bitstring.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/common/bitstring.c b/src/common/bitstring.c index 78449e3f04f..abaa7ab96e4 100644 --- a/src/common/bitstring.c +++ b/src/common/bitstring.c @@ -920,8 +920,10 @@ bit_fmt(char *str, int len, bitstr_t *b) if (bit_test(b, bit)) { count++; start = bit; - while (bit+1 < _bitstr_bits(b) && bit_test(b, bit+1)) + while (bit+1 < _bitstr_bits(b) && bit_test(b, bit+1)) { bit++; + count++; + } if (bit == start) /* add single bit position */ ret = snprintf(str+strlen(str), len-strlen(str), -- GitLab