summaryrefslogtreecommitdiffstats
path: root/include/command.h
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2007-07-05 18:01:52 +0200
committerSascha Hauer <sha@octopus.labnet.pengutronix.de>2007-07-05 18:01:52 +0200
commite694adc6a4716fc589693eb8eb8e67bbf54e8edc (patch)
treef8af4d37d05c8f628ecc3abbe8c8d48a43794482 /include/command.h
parent2692aaeb76f66cc8fe2f1196697d9a75b06c4522 (diff)
downloadbarebox-e694adc6a4716fc589693eb8eb8e67bbf54e8edc.tar.gz
barebox-e694adc6a4716fc589693eb8eb8e67bbf54e8edc.tar.xz
svn_rev_420
- do more POSIX: - use DIR instead of struct dirent - use (struct dirent)->d_name instead of (struct dirent)->name - switch to a new layout for U_BOOT_CMD: - use C99 initializers to be able to add more fields to the command struct - add aliases for commands (needed mainly for help -> ? and test -> [ - This is not done for all commands yet, but the compiler will tell you ;)
Diffstat (limited to 'include/command.h')
-rw-r--r--include/command.h22
1 files changed, 12 insertions, 10 deletions
diff --git a/include/command.h b/include/command.h
index dcde4de814..5482e06e2f 100644
--- a/include/command.h
+++ b/include/command.h
@@ -38,8 +38,8 @@
struct cmd_tbl_s {
char *name; /* Command Name */
+ char **aliases;
int maxargs; /* maximum number of arguments */
- int repeatable; /* autorepeat allowed? */
/* Implementation function */
int (*cmd)(struct cmd_tbl_s *, int, int, char *[]);
char *usage; /* Usage message (short) */
@@ -92,16 +92,18 @@ typedef void command_t (cmd_tbl_t *, int, int, char *[]);
#define Struct_Section __attribute__ ((unused,section (".u_boot_cmd")))
-#ifdef CONFIG_LONGHELP
+#define U_BOOT_CMD_START(_name) \
+const cmd_tbl_t __u_boot_cmd_##_name \
+ Struct_Section = { \
+ .name = #_name,
-#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}
-
-#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_END \
+};
-#endif /* CONFIG_LONGHELP */
+#ifdef CONFIG_LONGHELP
+#define U_BOOT_CMD_HELP(text) .help = text,
+#else
+#define U_BOOT_CMD_HELP(text)
+#endif
#endif /* __COMMAND_H */