[syslinux:master] rosh: Change rosh_run() to use argc/argv

syslinux-bot for Gene Cumm gene.cumm at gmail.com
Sun Nov 14 12:54:49 PST 2010


Commit-ID:  f45d80d58bc5d5c7ba91fad33fa2dcb57fe333bc
Gitweb:     http://syslinux.zytor.com/commit/f45d80d58bc5d5c7ba91fad33fa2dcb57fe333bc
Author:     Gene Cumm <gene.cumm at gmail.com>
AuthorDate: Sun, 3 Oct 2010 06:59:44 -0400
Committer:  Gene Cumm <gene.cumm at gmail.com>
CommitDate: Sat, 9 Oct 2010 07:33:07 -0400

rosh: Change rosh_run() to use argc/argv



---
 com32/rosh/rosh.c |   27 +++++++++++++--------------
 1 files changed, 13 insertions(+), 14 deletions(-)

diff --git a/com32/rosh/rosh.c b/com32/rosh/rosh.c
index d6a3035..7f08673 100644
--- a/com32/rosh/rosh.c
+++ b/com32/rosh/rosh.c
@@ -1105,22 +1105,21 @@ void rosh_reboot(void)
 }				/* rosh_reboot */
 
 /* Run a boot string, calling syslinux_run_command
- *	cmdstr	command string to process
+ *	argc	Argument count
+ *	argv	Argument values
  */
-void rosh_run(const char *cmdstr)
+void rosh_run(int argc, char *argv[])
 {
-    int cmdpos;
-    char *cmdptr;
+    char cmdstr[ROSH_CMD_SZ];
+    int len;
 
-    cmdpos = 0;
-    ROSH_DEBUG("CMD: '%s'\n", cmdstr);
-    /* skip the first word */
-    cmdpos = rosh_search_sp(cmdstr, cmdpos);
-    /* skip spaces */
-    cmdpos = rosh_search_nonsp(cmdstr, cmdpos);
-    cmdptr = (char *)(cmdstr + cmdpos);
-    printf("--run: '%s'\n", cmdptr);
-    syslinux_run_command(cmdptr);
+    len = rosh_argcat(cmdstr, argc, argv, 0);
+    if (len) {
+	printf("--run: '%s'\n", cmdstr);
+	syslinux_run_command(cmdstr);
+    } else {
+	printf(APP_NAME ":run: No arguments\n");
+    }
 }				/* rosh_run */
 
 /* Process an argc/argv pair and call handling function
@@ -1276,7 +1275,7 @@ char rosh_command(int argc, char *argv[], const char *ipwdstr)
 	case 'u':
 	case 'U':
 	    if (strncasecmp("run", argv[0], tlen) == 0)
-		rosh_run(cmdstr);
+		rosh_run(argc - 1, &argv[1]);
 	    else
 		rosh_help(1, NULL);
 	    break;



More information about the Syslinux-commits mailing list