Commit cc33095c by Ranjit Mathew Committed by Tom Tromey

Win32Process.java (ConcreteProcess): Surround a command line element with quotes…

Win32Process.java (ConcreteProcess): Surround a command line element with quotes if it contains an embedded space or tab.

2003-07-26  Ranjit Mathew  <rmathew@hotmail.com>

	* java/lang/Win32Process.java (ConcreteProcess): Surround
	a command line element with quotes if it contains an
	embedded space or tab.
	* java/lang/natWin32Process.cc (startProcess): Do not
	surround command line elements with quotes here.

From-SVN: r69844
parent 6eb08535
2003-07-26 Ranjit Mathew <rmathew@hotmail.com> 2003-07-26 Ranjit Mathew <rmathew@hotmail.com>
* java/lang/Win32Process.java (ConcreteProcess): Surround
a command line element with quotes if it contains an
embedded space or tab.
* java/lang/natWin32Process.cc (startProcess): Do not
surround command line elements with quotes here.
* configure.host: Use -fcheck-references and * configure.host: Use -fcheck-references and
-fuse-divide-subroutine for MinGW until we fix -fuse-divide-subroutine for MinGW until we fix
win32_exception_handler( ) in win32.cc w.r.t. Win32 win32_exception_handler( ) in win32.cc w.r.t. Win32
......
...@@ -67,6 +67,14 @@ final class ConcreteProcess extends Process ...@@ -67,6 +67,14 @@ final class ConcreteProcess extends Process
File dir) File dir)
throws IOException throws IOException
{ {
for (int i = 0; i < progarray.length; i++)
{
String s = progarray[i];
if ( (s.indexOf (' ') >= 0) || (s.indexOf ('\t') >= 0))
progarray[i] = "\"" + s + "\"";
}
startProcess (progarray, envp, dir); startProcess (progarray, envp, dir);
} }
......
...@@ -136,7 +136,7 @@ java::lang::ConcreteProcess::startProcess (jstringArray progarray, ...@@ -136,7 +136,7 @@ java::lang::ConcreteProcess::startProcess (jstringArray progarray,
int cmdLineLen = 0; int cmdLineLen = 0;
for (int i = 0; i < progarray->length; ++i) for (int i = 0; i < progarray->length; ++i)
cmdLineLen += (_Jv_GetStringUTFLength (elts[i]) + 3); cmdLineLen += (_Jv_GetStringUTFLength (elts[i]) + 1);
char *cmdLine = (char *) _Jv_Malloc (cmdLineLen + 1); char *cmdLine = (char *) _Jv_Malloc (cmdLineLen + 1);
char *cmdLineCurPos = cmdLine; char *cmdLineCurPos = cmdLine;
...@@ -145,11 +145,9 @@ java::lang::ConcreteProcess::startProcess (jstringArray progarray, ...@@ -145,11 +145,9 @@ java::lang::ConcreteProcess::startProcess (jstringArray progarray,
{ {
if (i > 0) if (i > 0)
*cmdLineCurPos++ = ' '; *cmdLineCurPos++ = ' ';
*cmdLineCurPos++ = '\"';
jsize s = _Jv_GetStringUTFLength (elts[i]); jsize s = _Jv_GetStringUTFLength (elts[i]);
_Jv_GetStringUTFRegion (elts[i], 0, s, cmdLineCurPos); _Jv_GetStringUTFRegion (elts[i], 0, s, cmdLineCurPos);
cmdLineCurPos += s; cmdLineCurPos += s;
*cmdLineCurPos++ = '\"';
} }
*cmdLineCurPos = '\0'; *cmdLineCurPos = '\0';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment