diff options
author | Gleb Smirnoff <glebius@FreeBSD.org> | 2025-02-04 19:52:35 +0000 |
---|---|---|
committer | Gleb Smirnoff <glebius@FreeBSD.org> | 2025-02-04 19:52:35 +0000 |
commit | d2e6eb6046560a848cf5627b4353a6fef1421ed4 (patch) | |
tree | b1240f0171f53a67bf9a39cf7d6dcfff8713bfc1 | |
parent | 753a4acd09e45d84cd863355943dbb2ccbcda77b (diff) |
genl: fix printing of a command with zero capabilities
-rw-r--r-- | usr.bin/genl/genl.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/usr.bin/genl/genl.c b/usr.bin/genl/genl.c index 51d2dfaa6364..4d2c252dab98 100644 --- a/usr.bin/genl/genl.c +++ b/usr.bin/genl/genl.c @@ -214,13 +214,19 @@ dump_operations(struct genl_ctrl_ops *ops) return; printf("\tsupported operations: \n"); for (uint32_t i = 0; i < ops->num_ops; i++) { - printf("\t - ID: %#02x, Capabilities: %#02x (", + bool p = true; + + printf("\t - ID: %#02x, Capabilities: %#02x", ops->ops[i]->id, ops->ops[i]->flags); for (size_t j = 0; j < nitems(op_caps); j++) - if ((ops->ops[i]->flags & op_caps[j].flag) == op_caps[j].flag) - printf("%s; ", op_caps[j].str); - printf("\b\b)\n"); + if ((ops->ops[i]->flags & op_caps[j].flag) == + op_caps[j].flag) { + printf("%s%s", p ? " (" : "; ", + op_caps[j].str); + p = false; + } + printf("%s\n", p ? "" : ")"); } } |