Add function for printing command usage
[oweals/u-boot_mod.git] / u-boot / include / command.h
index 656cc55f6222f658d1999c3d950ddad85dcb1924..d51787f218cbcbe92eb33ef1abbb765c21e9e906 100644 (file)
 #define __COMMAND_H
 
 #ifndef NULL
-#define NULL   0
+  #define NULL 0
 #endif
 
 #ifndef        __ASSEMBLY__
 /*
  * Monitor Command Table
  */
-
-struct cmd_tbl_s {
-       char    *name;                                                                                  /* Command Name                                 */
-       int             maxargs;                                                                                /* maximum number of arguments  */
-       int             repeatable;                                                                             /* autorepeat allowed?                  */
-       int             (*cmd)(struct cmd_tbl_s *, int, int, char *[]); /* Implementation function              */
-       char    *usage;                                                                                 /* Usage message (short)                */
+typedef struct cmd_tbl_s {
+       char    *name;          /* Command Name                */
+       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)       */
 #ifdef CFG_LONGHELP
-       char    *help;                                                                                  /* Help  message (long)                 */
+       char    *help;          /* Help  message (long)        */
 #endif
-};
-
-typedef struct cmd_tbl_s cmd_tbl_t;
+} cmd_tbl_t;
 
 extern cmd_tbl_t __u_boot_cmd_start;
 extern cmd_tbl_t __u_boot_cmd_end;
 
 /* common/command.c */
 cmd_tbl_t *find_cmd(const char *cmd);
+void print_cmd_help(cmd_tbl_t *cmdtp);
 
 /*
  * Monitor Command
@@ -61,14 +60,13 @@ cmd_tbl_t *find_cmd(const char *cmd);
  * void function (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
  */
 typedef void command_t(cmd_tbl_t *, int, int, char *[]);
-
-#endif /* __ASSEMBLY__ */
+#endif /* __ASSEMBLY__ */
 
 /*
  * Command Flags:
  */
-#define CMD_FLAG_REPEAT                0x0001  /* repeat last command          */
-#define CMD_FLAG_BOOTD         0x0002  /* command is from bootd        */
+#define CMD_FLAG_REPEAT        0x0001  /* repeat last command   */
+#define CMD_FLAG_BOOTD 0x0002  /* command is from bootd */
 
 /*
  * Configurable monitor commands definitions have been moved
@@ -77,9 +75,9 @@ typedef void command_t(cmd_tbl_t *, int, int, char *[]);
 #define Struct_Section  __attribute__ ((unused,section (".u_boot_cmd")))
 
 #ifdef CFG_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}
-#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}
-#endif /* CFG_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}
+#else
+  #define U_BOOT_CMD(name,maxargs,rep,cmd,usage,help) cmd_tbl_t __u_boot_cmd_##name Struct_Section = {#name, maxargs, rep, cmd, usage}
+#endif
 
-#endif /* __COMMAND_H */
+#endif /* __COMMAND_H */