summaryrefslogtreecommitdiffstats
path: root/src/commandline/commands
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
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')
-rw-r--r--src/commandline/commands/help.c35
-rw-r--r--src/commandline/commands/nvo_cmd.c7
-rw-r--r--src/commandline/commands/test.c6
-rw-r--r--src/commandline/commands/test2.c6
4 files changed, 15 insertions, 39 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,
};
diff --git a/src/commandline/commands/nvo_cmd.c b/src/commandline/commands/nvo_cmd.c
index 662ad7b0d..d859b2c04 100644
--- a/src/commandline/commands/nvo_cmd.c
+++ b/src/commandline/commands/nvo_cmd.c
@@ -3,10 +3,11 @@
#include <string.h>
#include <errno.h>
#include <vsprintf.h>
-#include <command.h>
+#include <getopt.h>
#include <gpxe/nvo.h>
#include <gpxe/dhcp.h>
#include <gpxe/settings.h>
+#include <gpxe/command.h>
void nvo_cmd_req() {}
@@ -41,8 +42,6 @@ static int show_exec ( int argc, char **argv ) {
struct command show_command __command = {
.name = "show",
- .usage = "show <identifier>\n",
- .desc = "Show stored options",
.exec = show_exec,
};
@@ -78,7 +77,5 @@ static int set_exec ( int argc, char **argv ) {
struct command set_command __command = {
.name = "set",
- .usage = "set <identifier> <value>\n",
- .desc = "Set stored option",
.exec = set_exec,
};
diff --git a/src/commandline/commands/test.c b/src/commandline/commands/test.c
index 1d3701247..59b0b72b7 100644
--- a/src/commandline/commands/test.c
+++ b/src/commandline/commands/test.c
@@ -1,5 +1,5 @@
-#include "command.h"
-#include "console.h"
+#include <vsprintf.h>
+#include <gpxe/command.h>
void test_req(){}
@@ -15,8 +15,6 @@ static int cmd_test_exec ( int argc, char **argv ) {
struct command test_command __command = {
.name = "test",
- .usage = "A test command\nIt does nothing at all\n\nExample:\n\ttest",
- .desc = "Does nothing",
.exec = cmd_test_exec,
};
diff --git a/src/commandline/commands/test2.c b/src/commandline/commands/test2.c
index 077933d0e..6cb2ee70b 100644
--- a/src/commandline/commands/test2.c
+++ b/src/commandline/commands/test2.c
@@ -1,5 +1,5 @@
-#include "command.h"
-#include "console.h"
+#include <vsprintf.h>
+#include <gpxe/command.h>
void test2_req(){}
@@ -15,8 +15,6 @@ static int cmd_test2_exec ( int argc, char **argv ) {
struct command test2_command __command = {
.name = "test2",
- .usage = "A test command\nIt does nothing at all\n\nExample:\n\ttest2",
- .desc = "Does nothing",
.exec = cmd_test2_exec,
};