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
This commit is contained in:
Ranjit Mathew 2003-07-27 04:13:03 +00:00 committed by Tom Tromey
parent 6eb085352b
commit cc33095ccf
3 changed files with 15 additions and 3 deletions

View file

@ -67,6 +67,14 @@ final class ConcreteProcess extends Process
File dir)
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);
}

View file

@ -136,7 +136,7 @@ java::lang::ConcreteProcess::startProcess (jstringArray progarray,
int cmdLineLen = 0;
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 *cmdLineCurPos = cmdLine;
@ -145,11 +145,9 @@ java::lang::ConcreteProcess::startProcess (jstringArray progarray,
{
if (i > 0)
*cmdLineCurPos++ = ' ';
*cmdLineCurPos++ = '\"';
jsize s = _Jv_GetStringUTFLength (elts[i]);
_Jv_GetStringUTFRegion (elts[i], 0, s, cmdLineCurPos);
cmdLineCurPos += s;
*cmdLineCurPos++ = '\"';
}
*cmdLineCurPos = '\0';