summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2000-08-04 05:23:41 +0000
committerjhb <jhb@FreeBSD.org>2000-08-04 05:23:41 +0000
commit0923c0673cce88b292150cd444c23f37f20a2af8 (patch)
treeb5b0efb723c94e666d08071a7c0e69f4bf335e8c /sys
parent11f08cadc6694232ab54cde44f975354c62332a9 (diff)
downloadFreeBSD-src-0923c0673cce88b292150cd444c23f37f20a2af8.zip
FreeBSD-src-0923c0673cce88b292150cd444c23f37f20a2af8.tar.gz
Bring back the perform() function. However, conditionionalize it on
BOOT_FORTH as it is only used if BOOT_FORTH is not defined.
Diffstat (limited to 'sys')
-rw-r--r--sys/boot/common/interp.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/sys/boot/common/interp.c b/sys/boot/common/interp.c
index 4349920..e6bb3cc 100644
--- a/sys/boot/common/interp.c
+++ b/sys/boot/common/interp.c
@@ -48,6 +48,42 @@ extern FICL_VM *bf_vm;
static void prompt(void);
+#ifndef BOOT_FORTH
+static int perform(int argc, char *argv[]);
+
+/*
+ * Perform the command
+ */
+int
+perform(int argc, char *argv[])
+{
+ int result;
+ struct bootblk_command **cmdp;
+ bootblk_cmd_t *cmd;
+
+ if (argc < 1)
+ return(CMD_OK);
+
+ /* set return defaults; a successful command will override these */
+ command_errmsg = command_errbuf;
+ strcpy(command_errbuf, "no error message");
+ cmd = NULL;
+ result = CMD_ERROR;
+
+ /* search the command set for the command */
+ SET_FOREACH(cmdp, Xcommand_set) {
+ if (((*cmdp)->c_name != NULL) && !strcmp(argv[0], (*cmdp)->c_name))
+ cmd = (*cmdp)->c_fn;
+ }
+ if (cmd != NULL) {
+ result = (cmd)(argc, argv);
+ } else {
+ command_errmsg = "unknown command";
+ }
+ RETURN(result);
+}
+#endif /* ! BOOT_FORTH */
+
/*
* Interactive mode
*/
OpenPOWER on IntegriCloud