DragonOS/user/apps/shell/cmd_help.c

27 lines
534 B
C
Raw Normal View History

2022-05-25 14:50:32 +00:00
#include "cmd_help.h"
#include <libc/stdio.h>
2022-05-30 09:39:45 +00:00
#include <libc/stdlib.h>
2022-05-25 14:50:32 +00:00
struct help_table_item_t
{
void (*func)();
};
struct help_table_item_t help_table[] = {
{shell_help_cd},
};
static const int help_table_num = sizeof(help_table) / sizeof(struct help_table_item_t);
2022-05-30 09:39:45 +00:00
int shell_help(int argc, char **argv)
2022-05-25 14:50:32 +00:00
{
printf("Help:\n");
for (int i = 0; i < help_table_num; ++i)
help_table[i].func();
2022-05-30 09:39:45 +00:00
if(argc > 1)
free(argv);
2022-05-25 14:50:32 +00:00
}
void shell_help_cd()
{
printf("Example of cd: cd [destination]\n");
}