2015-12-15 15:39:40 +00:00
|
|
|
#ifndef __SUBCMD_HELP_H
|
|
|
|
#define __SUBCMD_HELP_H
|
2009-04-20 13:00:56 +00:00
|
|
|
|
2015-12-15 15:39:38 +00:00
|
|
|
#include <sys/types.h>
|
|
|
|
|
2009-04-20 13:00:56 +00:00
|
|
|
struct cmdnames {
|
2009-07-01 10:37:06 +00:00
|
|
|
size_t alloc;
|
|
|
|
size_t cnt;
|
2009-04-20 13:00:56 +00:00
|
|
|
struct cmdname {
|
|
|
|
size_t len; /* also used for similarity index in help.c */
|
2015-12-15 15:39:38 +00:00
|
|
|
char name[];
|
2009-04-20 13:00:56 +00:00
|
|
|
} **names;
|
|
|
|
};
|
|
|
|
|
|
|
|
static inline void mput_char(char c, unsigned int num)
|
|
|
|
{
|
|
|
|
while(num--)
|
|
|
|
putchar(c);
|
|
|
|
}
|
|
|
|
|
|
|
|
void load_command_list(const char *prefix,
|
|
|
|
struct cmdnames *main_cmds,
|
|
|
|
struct cmdnames *other_cmds);
|
2009-07-01 10:37:06 +00:00
|
|
|
void add_cmdname(struct cmdnames *cmds, const char *name, size_t len);
|
2015-12-14 04:18:09 +00:00
|
|
|
void clean_cmdnames(struct cmdnames *cmds);
|
|
|
|
int cmdname_compare(const void *a, const void *b);
|
|
|
|
void uniq(struct cmdnames *cmds);
|
2009-04-20 13:00:56 +00:00
|
|
|
/* Here we require that excludes is a sorted list. */
|
|
|
|
void exclude_cmds(struct cmdnames *cmds, struct cmdnames *excludes);
|
|
|
|
int is_in_cmdlist(struct cmdnames *c, const char *s);
|
|
|
|
void list_commands(const char *title, struct cmdnames *main_cmds,
|
|
|
|
struct cmdnames *other_cmds);
|
|
|
|
|
2015-12-15 15:39:40 +00:00
|
|
|
#endif /* __SUBCMD_HELP_H */
|