| 78 | } |
| 79 | |
| 80 | static void extract_cmds(struct cmdname_help **p_cmds, uint32_t mask) |
| 81 | { |
| 82 | int i, nr = 0; |
| 83 | struct cmdname_help *cmds; |
| 84 | |
| 85 | if (ARRAY_SIZE(command_list) == 0) |
| 86 | BUG("empty command_list[] is a sign of broken generate-cmdlist.sh"); |
| 87 | |
| 88 | ALLOC_ARRAY(cmds, ARRAY_SIZE(command_list) + 1); |
| 89 | |
| 90 | for (i = 0; i < ARRAY_SIZE(command_list); i++) { |
| 91 | const struct cmdname_help *cmd = command_list + i; |
| 92 | |
| 93 | if (!(cmd->category & mask)) |
| 94 | continue; |
| 95 | |
| 96 | cmds[nr] = *cmd; |
| 97 | cmds[nr].name = drop_prefix(cmd->name, cmd->category); |
| 98 | |
| 99 | nr++; |
| 100 | } |
| 101 | cmds[nr].name = NULL; |
| 102 | *p_cmds = cmds; |
| 103 | } |
| 104 | |
| 105 | static void print_command_list(const struct cmdname_help *cmds, |
| 106 | uint32_t mask, int longest) |
no test coverage detected