Lines Matching defs:cmds
7 void add_cmdname(struct cmdnames *cmds, const char *name, size_t len)
15 ALLOC_GROW(cmds->names, cmds->cnt + 1, cmds->alloc);
16 cmds->names[cmds->cnt++] = ent;
19 static void clean_cmdnames(struct cmdnames *cmds)
23 for (i = 0; i < cmds->cnt; ++i)
24 free(cmds->names[i]);
25 free(cmds->names);
26 cmds->cnt = 0;
27 cmds->alloc = 0;
37 static void uniq(struct cmdnames *cmds)
41 if (!cmds->cnt)
44 for (i = j = 1; i < cmds->cnt; i++)
45 if (strcmp(cmds->names[i]->name, cmds->names[i-1]->name))
46 cmds->names[j++] = cmds->names[i];
48 cmds->cnt = j;
51 void exclude_cmds(struct cmdnames *cmds, struct cmdnames *excludes)
57 while (ci < cmds->cnt && ei < excludes->cnt) {
58 cmp = strcmp(cmds->names[ci]->name, excludes->names[ei]->name);
60 cmds->names[cj++] = cmds->names[ci++];
67 while (ci < cmds->cnt)
68 cmds->names[cj++] = cmds->names[ci++];
70 cmds->cnt = cj;
73 static void pretty_print_string_list(struct cmdnames *cmds, int longest)
92 rows = (cmds->cnt + cols - 1) / cols;
101 if (n >= cmds->cnt)
103 if (j == cols-1 || n + rows >= cmds->cnt)
105 printf("%-*s", size, cmds->names[n]->name);
122 static void list_commands_in_dir(struct cmdnames *cmds,
156 add_cmdname(cmds, de->d_name + prefix_len, entlen);
263 static void add_cmd_list(struct cmdnames *cmds, struct cmdnames *old)
267 ALLOC_GROW(cmds->names, cmds->cnt + old->cnt, cmds->alloc);
270 cmds->names[cmds->cnt++] = old->names[i];