cmdlinelib.c now calls system() rather than doing its own tokenisation
[people/mcb30/gpxe.git] / src / commandline / commands / help.c
index 30ab962..3074f18 100644 (file)
@@ -1,7 +1,7 @@
-#include "command.h"
-#include "console.h"
 #include <string.h>
+#include <vsprintf.h>
 #include <gpxe/tables.h>
+#include <gpxe/command.h>
 
 static struct command cmd_start[0] __table_start ( commands );
 static struct command cmd_end[0] __table_end ( commands );
@@ -12,36 +12,19 @@ static int cmd_help_exec ( int argc, char **argv ) {
 
        struct command *ccmd;
        int unknown = 1;
-       if(argc == 1){
-               printf("Built in commands:\n\n\texit, quit\t\tExit the command line and boot\n\nCompiled in commands:\n\n");
-
-               for ( ccmd = cmd_start ; ccmd < cmd_end ; ccmd++ ) {
-                       printf ("\t%s\t\t%s\n", ccmd->name, ccmd->desc );
-               }
-       }else{
-               if(!strcmp(argv[1], "exit") || !strcmp(argv[1], "quit")){
-                       printf("exit, quit - The quit command\n\nUsage:\nquit or exit\n\n\tExample:\n\t\texit\n");
-               }else{
-                       for ( ccmd = cmd_start ; ccmd < cmd_end ; ccmd++ ) {
-                               if(!strcmp(ccmd->name, argv[1])){
-                                       unknown = 0;
-                                       printf ("\t%s - %s\n\nUsage:\n%s\n", ccmd->name, ccmd->desc, ccmd->usage );
-                                       break;
-                               }
-                       }
-                       if(unknown){
-                               printf("\"%s\" isn't compiled in (does it exist?).\n", argv[1]);
-                       }
-               }
-               
+
+
+       printf("Available commands:\n\n  exit - Exit the command line and boot\n");
+
+       for ( ccmd = cmd_start ; ccmd < cmd_end ; ccmd++ ) {
+               printf ("  %s\n", ccmd->name );
        }
+
        return 0;
 }
 
 struct command help_command __command = {
        .name = "help",
-       .usage = "help <command>\n\n\tExample:\n\t\thelp help\n",
-       .desc = "The help command",
        .exec = cmd_help_exec,
 };