mirror of
https://github.com/reactos/reactos.git
synced 2025-05-25 20:18:22 +00:00
[DISKPART] Support quoted command options in script files
This commit is contained in:
parent
3a72a52ce8
commit
d4a398fb13
1 changed files with 7 additions and 2 deletions
|
@ -185,21 +185,26 @@ InterpretScript(LPWSTR input_line)
|
||||||
LPWSTR args_vector[MAX_ARGS_COUNT];
|
LPWSTR args_vector[MAX_ARGS_COUNT];
|
||||||
INT args_count = 0;
|
INT args_count = 0;
|
||||||
BOOL bWhiteSpace = TRUE;
|
BOOL bWhiteSpace = TRUE;
|
||||||
|
BOOL bQuote = FALSE;
|
||||||
LPWSTR ptr;
|
LPWSTR ptr;
|
||||||
|
|
||||||
memset(args_vector, 0, sizeof(args_vector));
|
memset(args_vector, 0, sizeof(args_vector));
|
||||||
|
|
||||||
|
bQuote = FALSE;
|
||||||
ptr = input_line;
|
ptr = input_line;
|
||||||
while (*ptr != 0)
|
while (*ptr != 0)
|
||||||
{
|
{
|
||||||
if (iswspace(*ptr) || *ptr == L'\n')
|
if (*ptr == L'"')
|
||||||
|
bQuote = !bQuote;
|
||||||
|
|
||||||
|
if ((iswspace(*ptr) && (bQuote == FALSE))|| *ptr == L'\n')
|
||||||
{
|
{
|
||||||
*ptr = 0;
|
*ptr = 0;
|
||||||
bWhiteSpace = TRUE;
|
bWhiteSpace = TRUE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ((bWhiteSpace != FALSE) && (args_count < MAX_ARGS_COUNT))
|
if ((bWhiteSpace != FALSE) && (bQuote == FALSE) && (args_count < MAX_ARGS_COUNT))
|
||||||
{
|
{
|
||||||
args_vector[args_count] = ptr;
|
args_vector[args_count] = ptr;
|
||||||
args_count++;
|
args_count++;
|
||||||
|
|
Loading…
Reference in a new issue