summaryrefslogtreecommitdiffstats
path: root/usr.sbin/sysinstall/command.c
diff options
context:
space:
mode:
authorjkh <jkh@FreeBSD.org>1995-05-16 11:37:27 +0000
committerjkh <jkh@FreeBSD.org>1995-05-16 11:37:27 +0000
commit56016c7548b0eaa3e7190993e87b7b8d0a0bd02c (patch)
treeb37ec9f9cf4478f56803d142759b8dc671accdd9 /usr.sbin/sysinstall/command.c
parent3f349e7ec85ac3affae816bfa10292b655d4eb44 (diff)
downloadFreeBSD-src-56016c7548b0eaa3e7190993e87b7b8d0a0bd02c.zip
FreeBSD-src-56016c7548b0eaa3e7190993e87b7b8d0a0bd02c.tar.gz
This will now compile and even scribble helpfully on your disks.
It remains to be seen how successfully. The distribution loading code is still not here yet, but the partition/newfs/mount/cpio-extract cycle is as complete as it's ever going to get, modulo possible bug fixes. The TCP/IP setup screen is also sort of here, albeit in a highly-changing state due to the fact that per-interface information isn't being kept right now but is being added (thanks, Gary!).
Diffstat (limited to 'usr.sbin/sysinstall/command.c')
-rw-r--r--usr.sbin/sysinstall/command.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/usr.sbin/sysinstall/command.c b/usr.sbin/sysinstall/command.c
index 5d59426..03989cc 100644
--- a/usr.sbin/sysinstall/command.c
+++ b/usr.sbin/sysinstall/command.c
@@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
- * $Id: command.c,v 1.2 1995/05/11 09:01:24 jkh Exp $
+ * $Id: command.c,v 1.3 1995/05/16 02:52:56 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -122,7 +122,7 @@ command_func_add(char *key, commandFunc func, void *data)
if (commandStack[i]->ncmds == MAX_NUM_COMMANDS)
msgFatal("More than %d commands stacked up behind %s??",
MAX_NUM_COMMANDS, key);
- commandStack[i]->cmds[commandStack[i]->ncmds].type = CMD_FUNC;
+ commandStack[i]->cmds[commandStack[i]->ncmds].type = CMD_FUNCTION;
commandStack[i]->cmds[commandStack[i]->ncmds].ptr = (void *)func;
commandStack[i]->cmds[commandStack[i]->ncmds].data = data;
++(commandStack[i]->ncmds);
@@ -136,7 +136,7 @@ command_func_add(char *key, commandFunc func, void *data)
commandStack[numCommands] = safe_malloc(sizeof(Command));
strcpy(commandStack[numCommands]->key, key);
commandStack[numCommands]->ncmds = 1;
- commandStack[numCommands]->cmds[0].type = CMD_FUNC;
+ commandStack[numCommands]->cmds[0].type = CMD_FUNCTION;
commandStack[numCommands++]->cmds[0].ptr = (void *)func;
}
@@ -162,7 +162,8 @@ command_execute(void)
for (i = 0; i < numCommands; i++) {
for (j = 0; j < commandStack[i]->ncmds; j++) {
- if (commandStack[i].type == CMD_SHELL) {
+ /* If it's a shell command, run system on it */
+ if (commandStack[i]->cmds[j].type == CMD_SHELL) {
msgNotify("Executing command: %s",
commandStack[i]->cmds[j].ptr);
ret = system((char *)commandStack[i]->cmds[j].ptr);
@@ -170,10 +171,11 @@ command_execute(void)
commandStack[i]->cmds[j].ptr, ret);
}
else {
- func = (commandFunc)commandStack[i]->cmds.ptr;
+ /* It's a function pointer - call it with the key and the data */
+ func = (commandFunc)commandStack[i]->cmds[j].ptr;
msgNotify("Executing internal command @ %0x", func);
- ret = (*func)(commandStack[i]->cmds.key,
- commandStack[i]->cmds.data);
+ ret = (*func)(commandStack[i]->key,
+ commandStack[i]->cmds[j].data);
msgDebug("Function @ %x returns status %d\n",
commandStack[i]->cmds[j].ptr, ret);
}
OpenPOWER on IntegriCloud