cmd_help.c 447 B

1234567891011121314151617181920212223
  1. #include "cmd_help.h"
  2. #include <libc/stdio.h>
  3. struct help_table_item_t
  4. {
  5. void (*func)();
  6. };
  7. struct help_table_item_t help_table[] = {
  8. {shell_help_cd},
  9. };
  10. static const int help_table_num = sizeof(help_table) / sizeof(struct help_table_item_t);
  11. void shell_help()
  12. {
  13. printf("Help:\n");
  14. for (int i = 0; i < help_table_num; ++i)
  15. help_table[i].func();
  16. }
  17. void shell_help_cd()
  18. {
  19. printf("Example of cd: cd [destination]\n");
  20. }