Fix command line handling (mostly double-quoting stuff)

svn path=/trunk/; revision=9355
This commit is contained in:
Gé van Geldorp 2004-05-11 20:44:30 +00:00
parent fc1b4d644e
commit b8c9de400f
3 changed files with 20 additions and 20 deletions

View file

@ -1,4 +1,4 @@
/* $Id: create.c,v 1.82 2004/05/01 18:09:53 tamlin Exp $
/* $Id: create.c,v 1.83 2004/05/11 20:44:29 gvg Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
@ -871,6 +871,7 @@ CreateProcessW
{
return FALSE;
}
DPRINT("TidyCmdLine '%S'\n", TidyCmdLine);
if (lpApplicationName != NULL && lpApplicationName[0] != 0)
{
@ -977,7 +978,7 @@ CreateProcessW
* Process the application name and command line
*/
RtlInitUnicodeString(&ImagePathName_U, ImagePathName);
RtlInitUnicodeString(&CommandLine_U, lpCommandLine);
RtlInitUnicodeString(&CommandLine_U, TidyCmdLine);
DPRINT("ImagePathName_U %S\n", ImagePathName_U.Buffer);
DPRINT("CommandLine_U %S\n", CommandLine_U.Buffer);

View file

@ -1,4 +1,4 @@
/* $Id: dllmain.c,v 1.20 2004/01/31 13:29:19 navaraf Exp $
/* $Id: dllmain.c,v 1.21 2004/05/11 20:44:30 gvg Exp $
*
* dllmain.c
*
@ -14,9 +14,9 @@
* DISCLAMED. This includes but is not limited to warrenties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* $Revision: 1.20 $
* $Author: navaraf $
* $Date: 2004/01/31 13:29:19 $
* $Revision: 1.21 $
* $Author: gvg $
* $Date: 2004/05/11 20:44:30 $
*
*/
@ -90,7 +90,7 @@ DllMain(PVOID hinstDll, ULONG dwReason, PVOID reserved)
if (!CreateThreadData())
return FALSE;
_acmdln = (char *)GetCommandLineA();
_acmdln = strdup(GetCommandLineA());
/* FIXME: This crashes all applications */
if (BlockEnvToEnviron() < 0)

View file

@ -1,4 +1,4 @@
/* $Id: cmd.c,v 1.12 2004/04/30 16:52:41 navaraf Exp $
/* $Id: cmd.c,v 1.13 2004/05/11 20:44:30 gvg Exp $
*
* CMD.C - command-line interface.
*
@ -296,7 +296,7 @@ static BOOL IsConsoleProcess(HANDLE Process)
*/
static VOID
Execute (LPTSTR first, LPTSTR rest)
Execute (LPTSTR full, LPTSTR first, LPTSTR rest)
{
TCHAR szFullName[MAX_PATH];
#ifndef __REACTOS__
@ -352,17 +352,13 @@ Execute (LPTSTR first, LPTSTR rest)
else
{
/* exec the program */
TCHAR szFullCmdLine [CMDLINE_LENGTH];
PROCESS_INFORMATION prci;
STARTUPINFO stui;
#ifdef _DEBUG
DebugPrintf (_T("[EXEC: %s %s]\n"), szFullName, rest);
DebugPrintf (_T("[EXEC: %s %s]\n"), full, rest);
#endif
/* build command line for CreateProcess() */
_tcscpy (szFullCmdLine, first);
_tcscat (szFullCmdLine, _T(" "));
_tcscat (szFullCmdLine, rest);
/* fill startup info */
memset (&stui, 0, sizeof (STARTUPINFO));
@ -373,9 +369,9 @@ Execute (LPTSTR first, LPTSTR rest)
// return console to standard mode
SetConsoleMode (GetStdHandle(STD_INPUT_HANDLE),
ENABLE_LINE_INPUT | ENABLE_PROCESSED_INPUT | ENABLE_ECHO_INPUT );
if (CreateProcess (szFullName,
szFullCmdLine,
full,
NULL,
NULL,
FALSE,
@ -433,7 +429,7 @@ DoCommand (LPTSTR line)
TCHAR com[CMDLINE_LENGTH]; /* the first word in the command */
LPTSTR cp = com;
LPTSTR cstart;
LPTSTR rest = line; /* pointer to the rest of the command line */
LPTSTR rest; /* pointer to the rest of the command line */
INT cl;
LPCOMMAND cmdptr;
@ -442,8 +438,9 @@ DoCommand (LPTSTR line)
#endif /* DEBUG */
/* Skip over initial white space */
while (_istspace (*rest))
rest++;
while (_istspace (*line))
line++;
rest = line;
cstart = rest;
@ -458,6 +455,8 @@ DoCommand (LPTSTR line)
while(*rest != _T('\0') && *rest != _T('"'))
*cp++ = _totlower (*rest++);
if (*rest == _T('"'))
rest++;
}
else
{
@ -486,7 +485,7 @@ DoCommand (LPTSTR line)
/* If end of table execute ext cmd */
if (cmdptr->name == NULL)
{
Execute (com, rest);
Execute (line, com, rest);
break;
}