Lines Matching refs:cmds

8 void add_cmdname(struct cmdnames *cmds, const char *name, size_t len)  in add_cmdname()  argument
16 ALLOC_GROW(cmds->names, cmds->cnt + 1, cmds->alloc); in add_cmdname()
17 cmds->names[cmds->cnt++] = ent; in add_cmdname()
20 static void clean_cmdnames(struct cmdnames *cmds) in clean_cmdnames() argument
24 for (i = 0; i < cmds->cnt; ++i) in clean_cmdnames()
25 zfree(&cmds->names[i]); in clean_cmdnames()
26 zfree(&cmds->names); in clean_cmdnames()
27 cmds->cnt = 0; in clean_cmdnames()
28 cmds->alloc = 0; in clean_cmdnames()
38 static void uniq(struct cmdnames *cmds) in uniq() argument
42 if (!cmds->cnt) in uniq()
45 for (i = j = 1; i < cmds->cnt; i++) in uniq()
46 if (strcmp(cmds->names[i]->name, cmds->names[i-1]->name)) in uniq()
47 cmds->names[j++] = cmds->names[i]; in uniq()
49 cmds->cnt = j; in uniq()
52 void exclude_cmds(struct cmdnames *cmds, struct cmdnames *excludes) in exclude_cmds() argument
58 while (ci < cmds->cnt && ei < excludes->cnt) { in exclude_cmds()
59 cmp = strcmp(cmds->names[ci]->name, excludes->names[ei]->name); in exclude_cmds()
61 cmds->names[cj++] = cmds->names[ci++]; in exclude_cmds()
68 while (ci < cmds->cnt) in exclude_cmds()
69 cmds->names[cj++] = cmds->names[ci++]; in exclude_cmds()
71 cmds->cnt = cj; in exclude_cmds()
74 static void pretty_print_string_list(struct cmdnames *cmds, int longest) in pretty_print_string_list() argument
87 rows = (cmds->cnt + cols - 1) / cols; in pretty_print_string_list()
96 if (n >= cmds->cnt) in pretty_print_string_list()
98 if (j == cols-1 || n + rows >= cmds->cnt) in pretty_print_string_list()
100 printf("%-*s", size, cmds->names[n]->name); in pretty_print_string_list()
117 static void list_commands_in_dir(struct cmdnames *cmds, in list_commands_in_dir() argument
151 add_cmdname(cmds, de->d_name + prefix_len, entlen); in list_commands_in_dir()
258 static void add_cmd_list(struct cmdnames *cmds, struct cmdnames *old) in add_cmd_list() argument
262 ALLOC_GROW(cmds->names, cmds->cnt + old->cnt, cmds->alloc); in add_cmd_list()
265 cmds->names[cmds->cnt++] = old->names[i]; in add_cmd_list()