Skip to contentSkip to conversation

info: change dbm format string

PATCH New Alexander Aring 1 participant 1 message May 20, 2015 IEEE 802.15.4

lore
Share & tools
lore

Alexander Aring

author maintainer
#0 lore raw

PATCH 1/1 info: change dbm format string

This patch changes the dbm format string to %.3g instead %.2g. The reason is that it shows not well for a 3-digit number like "-100" is shown as "-1e+02". A format string of %.3g will fix that.

---
 src/info.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
src/info.c +2 -2
index c749866..b74442d 100644
@@ -163,7 +163,7 @@ static int print_phy_handler(struct nl_msg *msg, void *arg)
 
 			printf("\ttx_powers: ");
 			nla_for_each_nested(nl_pwrs, tb_caps[NL802154_CAP_ATTR_TX_POWERS], rem_pwrs)
-				printf("%.2g,", MBM_TO_DBM(nla_get_s32(nl_pwrs)));
+				printf("%.3g,", MBM_TO_DBM(nla_get_s32(nl_pwrs)));
 			/* TODO */
 			printf("\b \n");
 		}
@@ -174,7 +174,7 @@ static int print_phy_handler(struct nl_msg *msg, void *arg)
 
 			printf("\tcca_ed_levels: ");
 			nla_for_each_nested(nl_levels, tb_caps[NL802154_CAP_ATTR_CCA_ED_LEVELS], rem_levels)
-				printf("%.2g,", MBM_TO_DBM(nla_get_s32(nl_levels)));
+				printf("%.3g,", MBM_TO_DBM(nla_get_s32(nl_levels)));
 			/* TODO */
 			printf("\b \n");
 		}
Signature · 1 line
2.3.7