help.h 781 B

1234567891011121314151617181920212223242526272829
  1. #ifndef __PERF_HELP_H
  2. #define __PERF_HELP_H
  3. struct cmdnames {
  4. size_t alloc;
  5. size_t cnt;
  6. struct cmdname {
  7. size_t len; /* also used for similarity index in help.c */
  8. char name[FLEX_ARRAY];
  9. } **names;
  10. };
  11. static inline void mput_char(char c, unsigned int num)
  12. {
  13. while(num--)
  14. putchar(c);
  15. }
  16. void load_command_list(const char *prefix,
  17. struct cmdnames *main_cmds,
  18. struct cmdnames *other_cmds);
  19. void add_cmdname(struct cmdnames *cmds, const char *name, size_t len);
  20. /* Here we require that excludes is a sorted list. */
  21. void exclude_cmds(struct cmdnames *cmds, struct cmdnames *excludes);
  22. int is_in_cmdlist(struct cmdnames *c, const char *s);
  23. void list_commands(const char *title, struct cmdnames *main_cmds,
  24. struct cmdnames *other_cmds);
  25. #endif /* __PERF_HELP_H */