diff options
Diffstat (limited to 'com32/modules/menu.c')
-rw-r--r-- | com32/modules/menu.c | 33 |
1 files changed, 27 insertions, 6 deletions
diff --git a/com32/modules/menu.c b/com32/modules/menu.c index 85ff8d5a..d67f5b55 100644 --- a/com32/modules/menu.c +++ b/com32/modules/menu.c @@ -588,10 +588,11 @@ run_menu(void) static void -execute(const char *cmdline) +execute(char *cmdline) { #ifdef __COM32__ - static com32sys_t ireg; + com32sys_t ireg; + memset(&ireg, 0, sizeof ireg); if ( !strncmp(cmdline, ".localboot", 10) && isspace(cmdline[10]) ) { unsigned long localboot = strtoul(cmdline+10, NULL, 0); @@ -599,10 +600,30 @@ execute(const char *cmdline) ireg.eax.w[0] = 0x0014; /* Local boot */ ireg.edx.w[0] = localboot; } else { - strcpy(__com32.cs_bounce, cmdline); - ireg.eax.w[0] = 0x0003; /* Run command */ - ireg.ebx.w[0] = OFFS(__com32.cs_bounce); - ireg.es = SEG(__com32.cs_bounce); + const char *p; + char *q = __com32.cs_bounce; + const char *kernel, *args; + + kernel = q; + p = cmdline; + while ( *p && !isspace(*p) ) { + *p++ = *q++; + } + *q++ = '\0'; + + args = q; + while ( *p && isspace(*p) ) + p++; + + strcpy(q, p); + + ireg.eax.w[0] = 0x0016; + ireg.esi.w[0] = OFFS(kernel); + ireg.ds = SEG(kernel); + ireg.ebx.w[0] = OFFS(args); + ireg.es = SEG(kernel); + /* ireg.ecx.l = 0; */ /* We do ipappend "manually" */ + /* ireg.edx.l = 0; */ } __intcall(0x22, &ireg, NULL); |