diff loadtools/ltdispatch.c @ 29:dacf45e3d20f

loadtool: scripting functionality implemented
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Sat, 04 May 2013 07:15:51 +0000
parents ae6294b8a015
children 05af070c4b60
line wrap: on
line diff
--- a/loadtools/ltdispatch.c	Sat May 04 06:39:05 2013 +0000
+++ b/loadtools/ltdispatch.c	Sat May 04 07:15:51 2013 +0000
@@ -8,8 +8,7 @@
 #include <strings.h>
 #include <stdlib.h>
 
-extern char loadtool_command[];
-
+extern int cmd_exec();
 extern int cmd_exit();
 extern int loadtool_cmd_passthru();
 
@@ -20,6 +19,7 @@
 	int (*func)();
 } cmdtab[] = {
 	{"dump", 2, 2, loadtool_cmd_passthru},
+	{"exec", 1, 1, cmd_exec},
 	{"exit", 0, 1, cmd_exit},
 	{"quit", 0, 1, cmd_exit},
 	{"r8", 1, 1, loadtool_cmd_passthru},
@@ -31,16 +31,19 @@
 	{0, 0, 0, 0}
 };
 
-loadtool_dispatch_cmd()
+loadtool_dispatch_cmd(cmd, is_script)
+	char *cmd;
 {
 	char *argv[10];
 	char *cp, **ap;
 	struct cmdtab *tp;
 
-	for (cp = loadtool_command; isspace(*cp); cp++)
+	for (cp = cmd; isspace(*cp); cp++)
 		;
 	if (!*cp || *cp == '#')
 		return(0);
+	if (is_script)
+		printf("Script command: %s\n", cp);
 	argv[0] = cp;
 	while (*cp && !isspace(*cp))
 		cp++;