wcmd, external commands, and options

Dan Kegel dank at kegel.com
Wed Apr 9 01:30:18 CDT 2003


I noticed tonight while looking for a different problem
that wcmd doesn't handle batch file lines
consisting of an external command with options but no space
between the commandline and the option, e.g.
   start/wait foo.exe
In this case it does not find start.exe.
Win98 does find start.exe in this case, and wcmd clearly should, too.

I had a quick look at wcmdmain.c, and did the obvious hack

--- wcmdmain.c  5 Mar 2003 02:49:04 -0000       1.26
+++ wcmdmain.c  9 Apr 2003 06:05:40 -0000
@@ -558,7 +560,7 @@ int p = 0;
        case '\0':
          return;
        default:
-       while ((*s != '\0') && (*s != ' ')) {
+       while ((*s != '\0') && (*s != ' ') && (*s != '/')) {
           if (p == 0) *p1++ = *s++;
           else if (p == 1) *p2++ = *s++;
           else s++;

It then realized that /wait was a qualifier, and passed the
right thing to CreateProcess:

F:\>start/wait xx.exe
trace:exec:FindExecutableA File start, Dir -
trace:exec:SHELL_FindExecutable start
trace:exec:SHELL_FindExecutable SearchPathA returned non-zero
trace:exec:SHELL_FindExecutable xlpFile=F:\start.exe,extension=.exe
trace:exec:SHELL_FindExecutable .exe file
trace:exec:SHELL_FindExecutable found F:\start.exe
trace:exec:FindExecutableA returning F:\start.exe
trace:process:CreateProcessA app (null) cmdline "start/wait xx.exe"

but CreateProcess seems to have screwed up handling the /wait parameter:

trace:process:CreateProcessA starting "F:\\start.exe" as Windows binary
trace:process:PROCESS_InitWine starting process name="F:\\start.exe" file=0x4 argv[0]="start/wait"

and that's the last we hear of /wait.  This all works fine if
we put a space before the /, in which case the log looks like:

trace:process:CreateProcessA app (null) cmdline "start /wait xx.exe"
trace:process:CreateProcessA starting "F:\\start.exe" as Windows binary
trace:process:PROCESS_InitWine starting process name="F:\\start.exe" file=0x4 argv[0]="start"

Hrmph.  Guess I should add a print for argv[1] in PROCESS_InitWine.

Or leave this to somebody who understands wcmd better than me :-)
- Dan

-- 
Dan Kegel
http://www.kegel.com
http://counter.li.org/cgi-bin/runscript/display-person.cgi?user=78045




More information about the wine-devel mailing list