1 #include "cmd_help.h"
2 #include <libc/src/stdio.h>
3 #include <libc/src/stdlib.h>
4 struct help_table_item_t
5 {
6     void (*func)();
7 };
8 struct help_table_item_t help_table[] = {
9     {shell_help_cd},
10 };
11 
12 static const int help_table_num = sizeof(help_table) / sizeof(struct help_table_item_t);
13 
shell_help(int argc,char ** argv)14 int shell_help(int argc, char **argv)
15 {
16     printf("Help:\n");
17     for (int i = 0; i < help_table_num; ++i)
18         help_table[i].func();
19 
20     if (argc > 1)
21         free(argv);
22     return 0;
23 }
24 
shell_help_cd()25 void shell_help_cd()
26 {
27     printf("Example of cd: cd [destination]\n");
28 }