Index: /trunk/include/iprt/getopt.h
===================================================================
--- /trunk/include/iprt/getopt.h	(revision 55670)
+++ /trunk/include/iprt/getopt.h	(revision 55671)
@@ -402,9 +402,12 @@
  * @param   pcArgs          Where to return the argument count.
  * @param   pszCmdLine      The string to parse.
+ * @param   fFlags          A combination of the RTGETOPTARGV_CNV_XXX flags,
+ *                          except RTGETOPTARGV_CNV_UNQUOTED is not supported.
  * @param   pszSeparators   String containing the argument separators. If NULL,
  *                          then space, tab, line feed (\\n) and return (\\r)
  *                          are used.
  */
-RTDECL(int) RTGetOptArgvFromString(char ***ppapszArgv, int *pcArgs, const char *pszCmdLine, const char *pszSeparators);
+RTDECL(int) RTGetOptArgvFromString(char ***ppapszArgv, int *pcArgs, const char *pszCmdLine, uint32_t fFlags,
+                                   const char *pszSeparators);
 
 /**
Index: /trunk/src/VBox/Additions/common/VBoxService/VBoxServiceControlProcess.cpp
===================================================================
--- /trunk/src/VBox/Additions/common/VBoxService/VBoxServiceControlProcess.cpp	(revision 55670)
+++ /trunk/src/VBox/Additions/common/VBoxService/VBoxServiceControlProcess.cpp	(revision 55671)
@@ -1493,5 +1493,6 @@
     uint32_t uNumArgs = 0; /* Initialize in case of RTGetOptArgvFromString() is failing ... */
     rc = RTGetOptArgvFromString(&papszArgs, (int*)&uNumArgs,
-                                (pProcess->StartupInfo.uNumArgs > 0) ? pProcess->StartupInfo.szArgs : "", NULL);
+                                (pProcess->StartupInfo.uNumArgs > 0) ? pProcess->StartupInfo.szArgs : "",
+                                RTGETOPTARGV_CNV_QUOTE_BOURNE_SH, NULL);
     /* Did we get the same result? */
     Assert(pProcess->StartupInfo.uNumArgs == uNumArgs);
Index: /trunk/src/VBox/Main/src-helper-apps/VBoxExtPackHelperApp.cpp
===================================================================
--- /trunk/src/VBox/Main/src-helper-apps/VBoxExtPackHelperApp.cpp	(revision 55670)
+++ /trunk/src/VBox/Main/src-helper-apps/VBoxExtPackHelperApp.cpp	(revision 55671)
@@ -1938,5 +1938,5 @@
     int    cArgs;
     char **papszArgs;
-    rc = RTGetOptArgvFromString(&papszArgs, &cArgs, pszCmdLine, NULL);
+    rc = RTGetOptArgvFromString(&papszArgs, &cArgs, pszCmdLine, RTGETOPTARGV_CNV_QUOTE_MS_CRT, NULL);
     if (RT_SUCCESS(rc))
     {
Index: /trunk/src/VBox/Runtime/common/misc/getoptargv.cpp
===================================================================
--- /trunk/src/VBox/Runtime/common/misc/getoptargv.cpp	(revision 55670)
+++ /trunk/src/VBox/Runtime/common/misc/getoptargv.cpp	(revision 55671)
@@ -221,5 +221,6 @@
 
 
-RTDECL(int) RTGetOptArgvFromString(char ***ppapszArgv, int *pcArgs, const char *pszCmdLine, const char *pszSeparators)
+RTDECL(int) RTGetOptArgvFromString(char ***ppapszArgv, int *pcArgs, const char *pszCmdLine,
+                                   uint32_t fFlags, const char *pszSeparators)
 {
     /*
@@ -229,4 +230,6 @@
     AssertPtr(pcArgs);
     AssertPtr(ppapszArgv);
+    AssertReturn(   fFlags == RTGETOPTARGV_CNV_QUOTE_BOURNE_SH
+                 || fFlags == RTGETOPTARGV_CNV_QUOTE_MS_CRT, VERR_INVALID_FLAGS);
     if (!pszSeparators)
         pszSeparators = " \t\n\r";
@@ -272,16 +275,65 @@
          * Parse and copy the string over.
          */
-        RTUNICP CpQuote = 0;
         RTUNICP Cp;
-        for (;;)
-        {
-            rc = RTStrGetCpEx(&pszSrc, &Cp);
-            if (RT_FAILURE(rc) || !Cp)
-                break;
-            if (!CpQuote)
+        if ((fFlags & RTGETOPTARGV_CNV_QUOTE_MASK) == RTGETOPTARGV_CNV_QUOTE_BOURNE_SH)
+        {
+            /*
+             * Bourne shell style.
+             */
+            RTUNICP CpQuote = 0;
+            for (;;)
             {
-                if (Cp == '"' || Cp == '\'')
-                    CpQuote = Cp;
-                else if (rtGetOptIsCpInSet(Cp, pszSeparators, cchSeparators))
+                rc = RTStrGetCpEx(&pszSrc, &Cp);
+                if (RT_FAILURE(rc) || !Cp)
+                    break;
+                if (!CpQuote)
+                {
+                    if (Cp == '"' || Cp == '\'')
+                        CpQuote = Cp;
+                    else if (rtGetOptIsCpInSet(Cp, pszSeparators, cchSeparators))
+                        break;
+                    else if (Cp != '\\')
+                        pszDst = RTStrPutCp(pszDst, Cp);
+                    else
+                    {
+                        /* escaped char */
+                        rc = RTStrGetCpEx(&pszSrc, &Cp);
+                        if (RT_FAILURE(rc) || !Cp)
+                            break;
+                        pszDst = RTStrPutCp(pszDst, Cp);
+                    }
+                }
+                else if (CpQuote != Cp)
+                {
+                    if (Cp != '\\' || CpQuote == '\'')
+                        pszDst = RTStrPutCp(pszDst, Cp);
+                    else
+                    {
+                        /* escaped char */
+                        rc = RTStrGetCpEx(&pszSrc, &Cp);
+                        if (RT_FAILURE(rc) || !Cp)
+                            break;
+                        pszDst = RTStrPutCp(pszDst, Cp);
+                    }
+                }
+                else
+                    CpQuote = 0;
+            }
+        }
+        else
+        {
+            /*
+             * Microsoft CRT style.
+             */
+            Assert((fFlags & RTGETOPTARGV_CNV_QUOTE_MASK) == RTGETOPTARGV_CNV_QUOTE_MS_CRT);
+            bool fInQuote;
+            for (;;)
+            {
+                rc = RTStrGetCpEx(&pszSrc, &Cp);
+                if (RT_FAILURE(rc) || !Cp)
+                    break;
+                if (Cp == '"')
+                    fInQuote = !fInQuote;
+                else if (!fInQuote && rtGetOptIsCpInSet(Cp, pszSeparators, cchSeparators))
                     break;
                 else if (Cp != '\\')
@@ -289,27 +341,35 @@
                 else
                 {
-                    /* escaped char */
-                    rc = RTStrGetCpEx(&pszSrc, &Cp);
-                    if (RT_FAILURE(rc) || !Cp)
-                        break;
-                    pszDst = RTStrPutCp(pszDst, Cp);
+                    /* A backslash sequence is only relevant if followed by
+                       a double quote, then it will work like an escape char. */
+                    size_t cQuotes = 1;
+                    while (*pszSrc == '\\')
+                    {
+                        cQuotes++;
+                        pszSrc++;
+                    }
+                    if (*pszSrc != '"')
+                        /* Not an escape sequence.  */
+                        while (cQuotes-- > 0)
+                            pszDst = RTStrPutCp(pszDst, '\\');
+                    else
+                    {
+                        /* Escape sequence.  Output half of the slashes.  If odd
+                           number, output the escaped double quote . */
+                        while (cQuotes >= 2)
+                        {
+                            pszDst = RTStrPutCp(pszDst, '\\');
+                            cQuotes -= 2;
+                        }
+                        if (!cQuotes)
+                            fInQuote = !fInQuote;
+                        else
+                            pszDst = RTStrPutCp(pszDst, '"');
+                        pszSrc++;
+                    }
                 }
             }
-            else if (CpQuote != Cp)
-            {
-                if (Cp != '\\' || CpQuote == '\'')
-                    pszDst = RTStrPutCp(pszDst, Cp);
-                else
-                {
-                    /* escaped char */
-                    rc = RTStrGetCpEx(&pszSrc, &Cp);
-                    if (RT_FAILURE(rc) || !Cp)
-                        break;
-                    pszDst = RTStrPutCp(pszDst, Cp);
-                }
-            }
-            else
-                CpQuote = 0;
-        }
+        }
+
         *pszDst++ = '\0';
         if (RT_FAILURE(rc) || !Cp)
Index: /trunk/src/VBox/Runtime/testcase/tstRTGetOptArgv.cpp
===================================================================
--- /trunk/src/VBox/Runtime/testcase/tstRTGetOptArgv.cpp	(revision 55670)
+++ /trunk/src/VBox/Runtime/testcase/tstRTGetOptArgv.cpp	(revision 55671)
@@ -43,6 +43,8 @@
 static const struct
 {
-    /** The input string. */
-    const char *pszInput;
+    /** The input string, bourne shell. */
+    const char *pszInBourne;
+    /** The input string, MS CRT. */
+    const char *pszInMsCrt;
     /** Separators, NULL if default. */
     const char *pszSeparators;
@@ -53,10 +55,11 @@
     /** Expected quoted string, bourne shell. */
     const char *pszOutBourneSh;
-    /** Expected quoted string, MSC CRT. */
+    /** Expected quoted string, MS CRT. */
     const char *pszOutMsCrt;
-} g_aBourneTests[] =
+} g_aTests[] =
 {
     {
         "0 1 \"\"2'' '3' 4 5 '''''6' 7 8 9 10 11",
+        "0 1 \"\"2 3 4 5 \"6\" 7 8 \"\"\"\"\"\"9\"\"\"\" 10 11",
         NULL,
         12,
@@ -81,4 +84,5 @@
     {
         "\t\" asdf \"  '\"'xyz  \"\t\"  '\n'  '\"'  \"'\"\n\r ",
+        "\t\" asdf \"  \\\"xyz  \"\t\"  \"\n\"  \"\\\"\"  '\n\r ",
         NULL,
         6,
@@ -98,4 +102,5 @@
     {
         ":0::1::::2:3:4:5:",
+        ":0::1::::2:3:4:5:",
         ":",
         6,
@@ -115,4 +120,5 @@
     {
         "0:1;2:3;4:5",
+        "0:1;2:3;4:5",
         ";;;;;;;;;;;;;;;;;;;;;;:",
         6,
@@ -132,4 +138,5 @@
     {
         "abcd 'a ' ' b' ' c '",
+        "abcd \"a \" \" b\" \" c \"",
         NULL,
         4,
@@ -147,4 +154,5 @@
     {
         "'a\n\\b' 'de'\"'\"'fg' h ''\"'\"''",
+        "\"a\n\\b\" de'fg h     \"'\"    ",
         NULL,
         4,
@@ -162,4 +170,5 @@
     {
         "arg1 \"arg2=\\\"zyx\\\"\"  'arg3=\\\\\\'",
+        "arg1 arg2=\\\"zyx\\\"  arg3=\\\\\\",
         NULL,
         3,
@@ -176,4 +185,5 @@
     {
         " a\\\\\\\\b  d\"e f\"g h ij\t",
+        " a\\\\b  d\"e f\"g h ij\t",
         NULL,
         4,
@@ -253,26 +263,108 @@
 
 
-
-static void tst3(void)
-{
-    /*
-     * Bourne shell round-tripping.
-     */
-    RTTestISub("Round-trips / BOURNE_SH");
-    for (unsigned i = 0; i < RT_ELEMENTS(g_aBourneTests); i++)
+static void tst4(void)
+{
+    /*
+     * Microsoft CRT round-tripping.
+     */
+    RTTestISub("Round-trips / MS_CRT");
+    for (unsigned i = 0; i < RT_ELEMENTS(g_aTests); i++)
     {
         /* First */
         char **papszArgs1 = NULL;
         int    cArgs1     = -1;
-        int rc = RTGetOptArgvFromString(&papszArgs1, &cArgs1, g_aBourneTests[i].pszInput, g_aBourneTests[i].pszSeparators);
+        int rc = RTGetOptArgvFromString(&papszArgs1, &cArgs1, g_aTests[i].pszInMsCrt,
+                                        RTGETOPTARGV_CNV_QUOTE_MS_CRT, g_aTests[i].pszSeparators);
         if (rc == VINF_SUCCESS)
         {
-            if (cArgs1 != g_aBourneTests[i].cArgs)
-                RTTestIFailed("g_aBourneTests[%i]: #1=%d, expected %d", i, cArgs1, g_aBourneTests[i].cArgs);
+            if (cArgs1 != g_aTests[i].cArgs)
+                RTTestIFailed("g_aTests[%i]: #1=%d, expected %d", i, cArgs1, g_aTests[i].cArgs);
             for (int iArg = 0; iArg < cArgs1; iArg++)
-                if (strcmp(papszArgs1[iArg], g_aBourneTests[i].apszArgs[iArg]) != 0)
-                    RTTestIFailed("g_aBourneTests[%i]/1: argv[%i] differs: got '%s', expected '%s' (RTGetOptArgvFromString(,,'%s', '%s'))",
-                                  i, iArg, papszArgs1[iArg], g_aBourneTests[i].apszArgs[iArg],
-                                  g_aBourneTests[i].pszInput, g_aBourneTests[i].pszSeparators);
+                if (strcmp(papszArgs1[iArg], g_aTests[i].apszArgs[iArg]) != 0)
+                    RTTestIFailed("g_aTests[%i]/1: argv[%i] differs: got '%s', expected '%s' (RTGetOptArgvFromString(,,'%s', '%s'))",
+                                  i, iArg, papszArgs1[iArg], g_aTests[i].apszArgs[iArg],
+                                  g_aTests[i].pszInMsCrt, g_aTests[i].pszSeparators);
+            RTTESTI_CHECK_RETV(papszArgs1[cArgs1] == NULL);
+            tstCheckNativeMsCrtToArgv(g_aTests[i].pszInMsCrt, g_aTests[i].cArgs, g_aTests[i].apszArgs);
+
+            /* Second */
+            char *pszArgs2 = NULL;
+            rc = RTGetOptArgvToString(&pszArgs2, papszArgs1, RTGETOPTARGV_CNV_QUOTE_MS_CRT);
+            if (rc == VINF_SUCCESS)
+            {
+                if (strcmp(pszArgs2, g_aTests[i].pszOutMsCrt))
+                    RTTestIFailed("g_aTests[%i]/2: '%s', expected '%s'", i, pszArgs2, g_aTests[i].pszOutMsCrt);
+
+                /*
+                 * Third
+                 */
+                char **papszArgs3 = NULL;
+                int    cArgs3     = -1;
+                rc = RTGetOptArgvFromString(&papszArgs3, &cArgs3, pszArgs2, RTGETOPTARGV_CNV_QUOTE_MS_CRT, NULL);
+                if (rc == VINF_SUCCESS)
+                {
+                    if (cArgs3 != g_aTests[i].cArgs)
+                        RTTestIFailed("g_aTests[%i]/3: %d, expected %d", i, cArgs3, g_aTests[i].cArgs);
+                    for (int iArg = 0; iArg < cArgs3; iArg++)
+                        if (strcmp(papszArgs3[iArg], g_aTests[i].apszArgs[iArg]) != 0)
+                            RTTestIFailed("g_aTests[%i]/3: argv[%i] differs: got '%s', expected '%s' (RTGetOptArgvFromString(,,'%s',))",
+                                          i, iArg, papszArgs3[iArg], g_aTests[i].apszArgs[iArg], pszArgs2);
+                    RTTESTI_CHECK_RETV(papszArgs3[cArgs3] == NULL);
+                    tstCheckNativeMsCrtToArgv(pszArgs2, g_aTests[i].cArgs, g_aTests[i].apszArgs);
+
+                    /*
+                     * Fourth
+                     */
+                    char *pszArgs4 = NULL;
+                    rc = RTGetOptArgvToString(&pszArgs4, papszArgs3, RTGETOPTARGV_CNV_QUOTE_MS_CRT);
+                    if (rc == VINF_SUCCESS)
+                    {
+                        if (strcmp(pszArgs4, pszArgs2))
+                            RTTestIFailed("g_aTests[%i]/4: '%s' does not match #4='%s'", i, pszArgs2, pszArgs4);
+                        RTStrFree(pszArgs4);
+                    }
+                    else
+                        RTTestIFailed("g_aTests[%i]/4: RTGetOptArgvToString() -> %Rrc", i, rc);
+                    RTGetOptArgvFree(papszArgs3);
+                }
+                else
+                    RTTestIFailed("g_aTests[%i]/3: RTGetOptArgvFromString() -> %Rrc", i, rc);
+                RTStrFree(pszArgs2);
+            }
+            else
+                RTTestIFailed("g_aTests[%i]/2: RTGetOptArgvToString() -> %Rrc", i, rc);
+            RTGetOptArgvFree(papszArgs1);
+        }
+        else
+            RTTestIFailed("g_aTests[%i]/1: RTGetOptArgvFromString(,,'%s', '%s') -> %Rrc",
+                          i, g_aTests[i].pszInMsCrt, g_aTests[i].pszSeparators, rc);
+    }
+
+}
+
+
+
+static void tst3(void)
+{
+    /*
+     * Bourne shell round-tripping.
+     */
+    RTTestISub("Round-trips / BOURNE_SH");
+    for (unsigned i = 0; i < RT_ELEMENTS(g_aTests); i++)
+    {
+        /* First */
+        char **papszArgs1 = NULL;
+        int    cArgs1     = -1;
+        int rc = RTGetOptArgvFromString(&papszArgs1, &cArgs1, g_aTests[i].pszInBourne,
+                                        RTGETOPTARGV_CNV_QUOTE_BOURNE_SH, g_aTests[i].pszSeparators);
+        if (rc == VINF_SUCCESS)
+        {
+            if (cArgs1 != g_aTests[i].cArgs)
+                RTTestIFailed("g_aTests[%i]: #1=%d, expected %d", i, cArgs1, g_aTests[i].cArgs);
+            for (int iArg = 0; iArg < cArgs1; iArg++)
+                if (strcmp(papszArgs1[iArg], g_aTests[i].apszArgs[iArg]) != 0)
+                    RTTestIFailed("g_aTests[%i]/1: argv[%i] differs: got '%s', expected '%s' (RTGetOptArgvFromString(,,'%s', '%s'))",
+                                  i, iArg, papszArgs1[iArg], g_aTests[i].apszArgs[iArg],
+                                  g_aTests[i].pszInBourne, g_aTests[i].pszSeparators);
             RTTESTI_CHECK_RETV(papszArgs1[cArgs1] == NULL);
 
@@ -282,6 +374,6 @@
             if (rc == VINF_SUCCESS)
             {
-                if (strcmp(pszArgs2, g_aBourneTests[i].pszOutBourneSh))
-                    RTTestIFailed("g_aBourneTests[%i]/2: '%s', expected '%s'", i, pszArgs2, g_aBourneTests[i].pszOutBourneSh);
+                if (strcmp(pszArgs2, g_aTests[i].pszOutBourneSh))
+                    RTTestIFailed("g_aTests[%i]/2: '%s', expected '%s'", i, pszArgs2, g_aTests[i].pszOutBourneSh);
 
                 /*
@@ -290,13 +382,13 @@
                 char **papszArgs3 = NULL;
                 int    cArgs3     = -1;
-                rc = RTGetOptArgvFromString(&papszArgs3, &cArgs3, pszArgs2, NULL);
+                rc = RTGetOptArgvFromString(&papszArgs3, &cArgs3, pszArgs2, RTGETOPTARGV_CNV_QUOTE_BOURNE_SH, NULL);
                 if (rc == VINF_SUCCESS)
                 {
-                    if (cArgs3 != g_aBourneTests[i].cArgs)
-                        RTTestIFailed("g_aBourneTests[%i]/3: %d, expected %d", i, cArgs3, g_aBourneTests[i].cArgs);
+                    if (cArgs3 != g_aTests[i].cArgs)
+                        RTTestIFailed("g_aTests[%i]/3: %d, expected %d", i, cArgs3, g_aTests[i].cArgs);
                     for (int iArg = 0; iArg < cArgs3; iArg++)
-                        if (strcmp(papszArgs3[iArg], g_aBourneTests[i].apszArgs[iArg]) != 0)
-                            RTTestIFailed("g_aBourneTests[%i]/3: argv[%i] differs: got '%s', expected '%s' (RTGetOptArgvFromString(,,'%s',))",
-                                          i, iArg, papszArgs3[iArg], g_aBourneTests[i].apszArgs[iArg], pszArgs2);
+                        if (strcmp(papszArgs3[iArg], g_aTests[i].apszArgs[iArg]) != 0)
+                            RTTestIFailed("g_aTests[%i]/3: argv[%i] differs: got '%s', expected '%s' (RTGetOptArgvFromString(,,'%s',))",
+                                          i, iArg, papszArgs3[iArg], g_aTests[i].apszArgs[iArg], pszArgs2);
                     RTTESTI_CHECK_RETV(papszArgs3[cArgs3] == NULL);
 
@@ -309,24 +401,23 @@
                     {
                         if (strcmp(pszArgs4, pszArgs2))
-                            RTTestIFailed("g_aBourneTests[%i]/4: '%s' does not match #4='%s'", i, pszArgs2, pszArgs4);
+                            RTTestIFailed("g_aTests[%i]/4: '%s' does not match #4='%s'", i, pszArgs2, pszArgs4);
                         RTStrFree(pszArgs4);
                     }
                     else
-                        RTTestIFailed("g_aBourneTests[%i]/4: RTGetOptArgvToString() -> %Rrc", i, rc);
+                        RTTestIFailed("g_aTests[%i]/4: RTGetOptArgvToString() -> %Rrc", i, rc);
                     RTGetOptArgvFree(papszArgs3);
                 }
                 else
-                    RTTestIFailed("g_aBourneTests[%i]/3: RTGetOptArgvFromString() -> %Rrc", i, rc);
+                    RTTestIFailed("g_aTests[%i]/3: RTGetOptArgvFromString() -> %Rrc", i, rc);
                 RTStrFree(pszArgs2);
             }
             else
-                RTTestIFailed("g_aBourneTests[%i]/2: RTGetOptArgvToString() -> %Rrc", i, rc);
+                RTTestIFailed("g_aTests[%i]/2: RTGetOptArgvToString() -> %Rrc", i, rc);
             RTGetOptArgvFree(papszArgs1);
         }
         else
-            RTTestIFailed("g_aBourneTests[%i]/1: RTGetOptArgvFromString(,,'%s', '%s') -> %Rrc",
-                          i, g_aBourneTests[i].pszInput, g_aBourneTests[i].pszSeparators, rc);
-    }
-
+            RTTestIFailed("g_aTests[%i]/1: RTGetOptArgvFromString(,,'%s', '%s') -> %Rrc",
+                          i, g_aTests[i].pszInBourne, g_aTests[i].pszSeparators, rc);
+    }
 }
 
@@ -375,16 +466,16 @@
     }
 
-    for (size_t i = 0; i < RT_ELEMENTS(g_aBourneTests); i++)
+    for (size_t i = 0; i < RT_ELEMENTS(g_aTests); i++)
     {
         char *pszCmdLine = NULL;
-        int rc = RTGetOptArgvToString(&pszCmdLine, g_aBourneTests[i].apszArgs, RTGETOPTARGV_CNV_QUOTE_MS_CRT);
+        int rc = RTGetOptArgvToString(&pszCmdLine, g_aTests[i].apszArgs, RTGETOPTARGV_CNV_QUOTE_MS_CRT);
         RTTESTI_CHECK_RC_RETV(rc, VINF_SUCCESS);
-        if (!strcmp(g_aBourneTests[i].pszOutMsCrt, pszCmdLine))
-            tstCheckNativeMsCrtToArgv(pszCmdLine, g_aBourneTests[i].cArgs, g_aBourneTests[i].apszArgs);
+        if (!strcmp(g_aTests[i].pszOutMsCrt, pszCmdLine))
+            tstCheckNativeMsCrtToArgv(pszCmdLine, g_aTests[i].cArgs, g_aTests[i].apszArgs);
         else
-            RTTestIFailed("g_aBourneTests[%i] failed:\n"
+            RTTestIFailed("g_aTests[%i] failed:\n"
                           " got      |%s|\n"
                           " expected |%s|\n",
-                          i, pszCmdLine, g_aBourneTests[i].pszOutMsCrt);
+                          i, pszCmdLine, g_aTests[i].pszOutMsCrt);
         RTStrFree(pszCmdLine);
     }
@@ -394,14 +485,14 @@
     RTTestISub("RTGetOptArgvToString / BOURNE_SH");
 
-    for (size_t i = 0; i < RT_ELEMENTS(g_aBourneTests); i++)
+    for (size_t i = 0; i < RT_ELEMENTS(g_aTests); i++)
     {
         char *pszCmdLine = NULL;
-        int rc = RTGetOptArgvToString(&pszCmdLine, g_aBourneTests[i].apszArgs, RTGETOPTARGV_CNV_QUOTE_BOURNE_SH);
+        int rc = RTGetOptArgvToString(&pszCmdLine, g_aTests[i].apszArgs, RTGETOPTARGV_CNV_QUOTE_BOURNE_SH);
         RTTESTI_CHECK_RC_RETV(rc, VINF_SUCCESS);
-        if (strcmp(g_aBourneTests[i].pszOutBourneSh, pszCmdLine))
-            RTTestIFailed("g_aBourneTests[%i] failed:\n"
+        if (strcmp(g_aTests[i].pszOutBourneSh, pszCmdLine))
+            RTTestIFailed("g_aTests[%i] failed:\n"
                           " got      |%s|\n"
                           " expected |%s|\n",
-                          i, pszCmdLine, g_aBourneTests[i].pszOutBourneSh);
+                          i, pszCmdLine, g_aTests[i].pszOutBourneSh);
         RTStrFree(pszCmdLine);
     }
@@ -413,5 +504,5 @@
     char **papszArgs = NULL;
     int    cArgs = -1;
-    RTTESTI_CHECK_RC_RETV(RTGetOptArgvFromString(&papszArgs, &cArgs, "", NULL), VINF_SUCCESS);
+    RTTESTI_CHECK_RC_RETV(RTGetOptArgvFromString(&papszArgs, &cArgs, "", RTGETOPTARGV_CNV_QUOTE_BOURNE_SH, NULL), VINF_SUCCESS);
     RTTESTI_CHECK_RETV(cArgs == 0);
     RTTESTI_CHECK_RETV(papszArgs);
@@ -419,5 +510,6 @@
     RTGetOptArgvFree(papszArgs);
 
-    RTTESTI_CHECK_RC_RETV(RTGetOptArgvFromString(&papszArgs, &cArgs, "0 1 \"\"2'' '3' 4 5 '''''6' 7 8 9 10 11", NULL), VINF_SUCCESS);
+    RTTESTI_CHECK_RC_RETV(RTGetOptArgvFromString(&papszArgs, &cArgs, "0 1 \"\"2'' '3' 4 5 '''''6' 7 8 9 10 11",
+                                                 RTGETOPTARGV_CNV_QUOTE_BOURNE_SH, NULL), VINF_SUCCESS);
     RTTESTI_CHECK_RETV(cArgs == 12);
     RTTESTI_CHECK_RETV(!strcmp(papszArgs[0], "0"));
@@ -436,5 +528,6 @@
     RTGetOptArgvFree(papszArgs);
 
-    RTTESTI_CHECK_RC_RETV(RTGetOptArgvFromString(&papszArgs, &cArgs, "\t\" asdf \"  '\"'xyz  \"\t\"  '\n'  '\"'  \"'\"\n\r ", NULL), VINF_SUCCESS);
+    RTTESTI_CHECK_RC_RETV(RTGetOptArgvFromString(&papszArgs, &cArgs, "\t\" asdf \"  '\"'xyz  \"\t\"  '\n'  '\"'  \"'\"\n\r ",
+                                                 RTGETOPTARGV_CNV_QUOTE_BOURNE_SH, NULL), VINF_SUCCESS);
     RTTESTI_CHECK_RETV(cArgs == 6);
     RTTESTI_CHECK_RETV(!strcmp(papszArgs[0], " asdf "));
@@ -447,5 +540,6 @@
     RTGetOptArgvFree(papszArgs);
 
-    RTTESTI_CHECK_RC_RETV(RTGetOptArgvFromString(&papszArgs, &cArgs, ":0::1::::2:3:4:5:", ":"), VINF_SUCCESS);
+    RTTESTI_CHECK_RC_RETV(RTGetOptArgvFromString(&papszArgs, &cArgs, ":0::1::::2:3:4:5:",
+                                                 RTGETOPTARGV_CNV_QUOTE_BOURNE_SH, ":"), VINF_SUCCESS);
     RTTESTI_CHECK_RETV(cArgs == 6);
     RTTESTI_CHECK_RETV(!strcmp(papszArgs[0], "0"));
@@ -458,5 +552,6 @@
     RTGetOptArgvFree(papszArgs);
 
-    RTTESTI_CHECK_RC_RETV(RTGetOptArgvFromString(&papszArgs, &cArgs, "0:1;2:3;4:5", ";;;;;;;;;;;;;;;;;;;;;;:"), VINF_SUCCESS);
+    RTTESTI_CHECK_RC_RETV(RTGetOptArgvFromString(&papszArgs, &cArgs, "0:1;2:3;4:5", RTGETOPTARGV_CNV_QUOTE_BOURNE_SH,
+                                                 ";;;;;;;;;;;;;;;;;;;;;;:"), VINF_SUCCESS);
     RTTESTI_CHECK_RETV(cArgs == 6);
     RTTESTI_CHECK_RETV(!strcmp(papszArgs[0], "0"));
@@ -472,28 +567,29 @@
      * Tests from the list.
      */
-    for (unsigned i = 0; i < RT_ELEMENTS(g_aBourneTests); i++)
+    for (unsigned i = 0; i < RT_ELEMENTS(g_aTests); i++)
     {
         papszArgs = NULL;
         cArgs = -1;
-        int rc = RTGetOptArgvFromString(&papszArgs, &cArgs, g_aBourneTests[i].pszInput, g_aBourneTests[i].pszSeparators);
+        int rc = RTGetOptArgvFromString(&papszArgs, &cArgs, g_aTests[i].pszInBourne, RTGETOPTARGV_CNV_QUOTE_BOURNE_SH,
+                                        g_aTests[i].pszSeparators);
         if (rc == VINF_SUCCESS)
         {
-            if (cArgs == g_aBourneTests[i].cArgs)
+            if (cArgs == g_aTests[i].cArgs)
             {
                 for (int iArg = 0; iArg < cArgs; iArg++)
-                    if (strcmp(papszArgs[iArg], g_aBourneTests[i].apszArgs[iArg]) != 0)
-                        RTTestIFailed("g_aBourneTests[%i]: argv[%i] differs: got '%s', expected '%s' (RTGetOptArgvFromString(,,'%s', '%s'))",
-                                      i, iArg, papszArgs[iArg], g_aBourneTests[i].apszArgs[iArg],
-                                      g_aBourneTests[i].pszInput, g_aBourneTests[i].pszSeparators);
+                    if (strcmp(papszArgs[iArg], g_aTests[i].apszArgs[iArg]) != 0)
+                        RTTestIFailed("g_aTests[%i]: argv[%i] differs: got '%s', expected '%s' (RTGetOptArgvFromString(,,'%s', '%s'))",
+                                      i, iArg, papszArgs[iArg], g_aTests[i].apszArgs[iArg],
+                                      g_aTests[i].pszInBourne, g_aTests[i].pszSeparators);
                 RTTESTI_CHECK_RETV(papszArgs[cArgs] == NULL);
             }
             else
-                RTTestIFailed("g_aBourneTests[%i]: cArgs=%u, expected %u for RTGetOptArgvFromString(,,'%s', '%s')",
-                              i, cArgs, g_aBourneTests[i].cArgs, g_aBourneTests[i].pszInput, g_aBourneTests[i].pszSeparators);
+                RTTestIFailed("g_aTests[%i]: cArgs=%u, expected %u for RTGetOptArgvFromString(,,'%s', '%s')",
+                              i, cArgs, g_aTests[i].cArgs, g_aTests[i].pszInBourne, g_aTests[i].pszSeparators);
             RTGetOptArgvFree(papszArgs);
         }
         else
-            RTTestIFailed("g_aBourneTests[%i]: RTGetOptArgvFromString(,,'%s', '%s') -> %Rrc",
-                          i, g_aBourneTests[i].pszInput, g_aBourneTests[i].pszSeparators, rc);
+            RTTestIFailed("g_aTests[%i]: RTGetOptArgvFromString(,,'%s', '%s') -> %Rrc",
+                          i, g_aTests[i].pszInBourne, g_aTests[i].pszSeparators, rc);
     }
 }
@@ -516,4 +612,5 @@
     tst1();
     tst2();
+    tst4();
     tst3();
 
Index: /trunk/src/bldprogs/scm.cpp
===================================================================
--- /trunk/src/bldprogs/scm.cpp	(revision 55670)
+++ /trunk/src/bldprogs/scm.cpp	(revision 55671)
@@ -482,5 +482,5 @@
     int    cArgs;
     char **papszArgs;
-    int rc = RTGetOptArgvFromString(&papszArgs, &cArgs, pszLine, NULL);
+    int rc = RTGetOptArgvFromString(&papszArgs, &cArgs, pszLine, RTGETOPTARGV_CNV_QUOTE_BOURNE_SH, NULL);
     if (RT_SUCCESS(rc))
     {
