summaryrefslogtreecommitdiffstats
path: root/src/commandline/commands/help.c
diff options
context:
space:
mode:
authorMichael Brown2006-12-08 02:26:11 +0100
committerMichael Brown2006-12-08 02:26:11 +0100
commit7de5d32ff534191232039a275c68ad3552d8ff58 (patch)
tree0d2e07dda34d72384c30da64b960de8abd567aee /src/commandline/commands/help.c
parentAdded execv() and system(). (diff)
downloadipxe-7de5d32ff534191232039a275c68ad3552d8ff58.tar.gz
ipxe-7de5d32ff534191232039a275c68ad3552d8ff58.tar.xz
ipxe-7de5d32ff534191232039a275c68ad3552d8ff58.zip
cmdlinelib.c now calls system() rather than doing its own tokenisation
(which was extremely heavy on calls to malloc()). Moved include/command.h to include/gpxe/command.h, since it's gPXE-specific.
Diffstat (limited to 'src/commandline/commands/help.c')
-rw-r--r--src/commandline/commands/help.c35
1 files changed, 9 insertions, 26 deletions
diff --git a/src/commandline/commands/help.c b/src/commandline/commands/help.c
index 6ba617533..3074f18d0 100644
--- a/src/commandline/commands/help.c
+++ b/src/commandline/commands/help.c
@@ -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("Available commands:\n\n exit - Exit the command line and boot\n");
-
- for ( ccmd = cmd_start ; ccmd < cmd_end ; ccmd++ ) {
- printf (" %s - %s\n", ccmd->name, ccmd->desc );
- }
- }else{
- if(!strcmp(argv[1], "exit") || !strcmp(argv[1], "quit")){
- printf("exit - Exit the command line and boot\n\nUsage:\n exit\n");
- }else{
- for ( ccmd = cmd_start ; ccmd < cmd_end ; ccmd++ ) {
- if(!strcmp(ccmd->name, argv[1])){
- unknown = 0;
- printf ("%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\nExample:\n help help\n",
- .desc = "The help command",
.exec = cmd_help_exec,
};