https://git.reactos.org/?p=reactos.git;a=commitdiff;h=d4a398fb13ccca1d1a3db7...
commit d4a398fb13ccca1d1a3db735b7e0bf466f991788 Author: Eric Kohl eric.kohl@reactos.org AuthorDate: Sat Jun 25 15:20:40 2022 +0200 Commit: Eric Kohl eric.kohl@reactos.org CommitDate: Sat Jun 25 15:20:40 2022 +0200
[DISKPART] Support quoted command options in script files --- base/system/diskpart/interpreter.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/base/system/diskpart/interpreter.c b/base/system/diskpart/interpreter.c index 7ba17480605..bc18f9f2402 100644 --- a/base/system/diskpart/interpreter.c +++ b/base/system/diskpart/interpreter.c @@ -185,21 +185,26 @@ InterpretScript(LPWSTR input_line) LPWSTR args_vector[MAX_ARGS_COUNT]; INT args_count = 0; BOOL bWhiteSpace = TRUE; + BOOL bQuote = FALSE; LPWSTR ptr;
memset(args_vector, 0, sizeof(args_vector));
+ bQuote = FALSE; ptr = input_line; while (*ptr != 0) { - if (iswspace(*ptr) || *ptr == L'\n') + if (*ptr == L'"') + bQuote = !bQuote; + + if ((iswspace(*ptr) && (bQuote == FALSE))|| *ptr == L'\n') { *ptr = 0; bWhiteSpace = TRUE; } 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_count++;