mirror of
https://github.com/reactos/reactos.git
synced 2024-06-30 01:42:30 +00:00
Fix BatchParams to handle unconventional spacing/quoting properly.
svn path=/trunk/; revision=39836
This commit is contained in:
parent
a784e30920
commit
9ea64ffebb
|
@ -130,28 +130,25 @@ LPTSTR BatchParams (LPTSTR s1, LPTSTR s2)
|
|||
|
||||
while (*s2)
|
||||
{
|
||||
if (_istspace (*s2) || _tcschr (_T(",;"), *s2))
|
||||
{
|
||||
*s1++ = _T('\0');
|
||||
BOOL inquotes = FALSE;
|
||||
|
||||
/* Find next parameter */
|
||||
while (_istspace(*s2) || (*s2 && _tcschr(_T(",;="), *s2)))
|
||||
s2++;
|
||||
while (*s2 && _tcschr (_T(" ,;"), *s2))
|
||||
s2++;
|
||||
continue;
|
||||
}
|
||||
if (!*s2)
|
||||
break;
|
||||
|
||||
if ((*s2 == _T('"')) || (*s2 == _T('\'')))
|
||||
/* Copy it */
|
||||
do
|
||||
{
|
||||
TCHAR st = *s2;
|
||||
|
||||
do
|
||||
*s1++ = *s2++;
|
||||
while (*s2 && (*s2 != st));
|
||||
}
|
||||
|
||||
*s1++ = *s2++;
|
||||
if (!inquotes && (_istspace(*s2) || _tcschr(_T(",;="), *s2)))
|
||||
break;
|
||||
inquotes ^= (*s2 == _T('"'));
|
||||
*s1++ = *s2++;
|
||||
} while (*s2);
|
||||
*s1++ = _T('\0');
|
||||
}
|
||||
|
||||
*s1++ = _T('\0');
|
||||
*s1 = _T('\0');
|
||||
|
||||
return dp;
|
||||
|
|
Loading…
Reference in a new issue