From b799cb4c0eebb0762e91e9653d8b9cc9a98440e3 Mon Sep 17 00:00:00 2001 From: Kumar Gala Date: Tue, 23 Sep 2008 10:05:02 -0500 Subject: Expose command table search for sub-commands Sub-command can benefit from using the same table and search functions that top level commands have. Expose this functionality by refactoring find_cmd() and introducing find_cmd_tbl() that sub-command processing can call. Signed-off-by: Kumar Gala --- include/command.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'include/command.h') diff --git a/include/command.h b/include/command.h index f92383d086..78feea5c71 100644 --- a/include/command.h +++ b/include/command.h @@ -62,6 +62,7 @@ extern cmd_tbl_t __u_boot_cmd_end; /* common/command.c */ cmd_tbl_t *find_cmd(const char *cmd); +cmd_tbl_t *find_cmd_tbl (const char *cmd, cmd_tbl_t *table, int table_len); #ifdef CONFIG_AUTO_COMPLETE extern void install_auto_complete(void); @@ -102,11 +103,17 @@ extern int cmd_get_data_size(char* arg, int default_size); #define U_BOOT_CMD(name,maxargs,rep,cmd,usage,help) \ cmd_tbl_t __u_boot_cmd_##name Struct_Section = {#name, maxargs, rep, cmd, usage, help} +#define U_BOOT_CMD_MKENT(name,maxargs,rep,cmd,usage,help) \ +{#name, maxargs, rep, cmd, usage, help} + #else /* no long help info */ #define U_BOOT_CMD(name,maxargs,rep,cmd,usage,help) \ cmd_tbl_t __u_boot_cmd_##name Struct_Section = {#name, maxargs, rep, cmd, usage} +#define U_BOOT_CMD_MKENT(name,maxargs,rep,cmd,usage,help) \ +{#name, maxargs, rep, cmd, usage} + #endif /* CFG_LONGHELP */ #endif /* __COMMAND_H */ -- cgit From 6d0f6bcf337c5261c08fabe12982178c2c489d76 Mon Sep 17 00:00:00 2001 From: Jean-Christophe PLAGNIOL-VILLARD Date: Thu, 16 Oct 2008 15:01:15 +0200 Subject: rename CFG_ macros to CONFIG_SYS Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD --- include/command.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'include/command.h') diff --git a/include/command.h b/include/command.h index 78feea5c71..a8a153cb0f 100644 --- a/include/command.h +++ b/include/command.h @@ -45,7 +45,7 @@ struct cmd_tbl_s { /* Implementation function */ int (*cmd)(struct cmd_tbl_s *, int, int, char *[]); char *usage; /* Usage message (short) */ -#ifdef CFG_LONGHELP +#ifdef CONFIG_SYS_LONGHELP char *help; /* Help message (long) */ #endif #ifdef CONFIG_AUTO_COMPLETE @@ -98,7 +98,7 @@ extern int cmd_get_data_size(char* arg, int default_size); #define Struct_Section __attribute__ ((unused,section (".u_boot_cmd"))) -#ifdef CFG_LONGHELP +#ifdef CONFIG_SYS_LONGHELP #define U_BOOT_CMD(name,maxargs,rep,cmd,usage,help) \ cmd_tbl_t __u_boot_cmd_##name Struct_Section = {#name, maxargs, rep, cmd, usage, help} @@ -114,6 +114,6 @@ cmd_tbl_t __u_boot_cmd_##name Struct_Section = {#name, maxargs, rep, cmd, usage} #define U_BOOT_CMD_MKENT(name,maxargs,rep,cmd,usage,help) \ {#name, maxargs, rep, cmd, usage} -#endif /* CFG_LONGHELP */ +#endif /* CONFIG_SYS_LONGHELP */ #endif /* __COMMAND_H */ -- cgit