src/windows/bin/java_md.c
static char*
unquote(const char *s) {
    const char *p = s;          /* Pointer to the tail of the original string */
    char *un = (char*)JLI_MemAlloc(JLI_StrLen(s) + 1);  /* Ptr to unquoted string */
    char *pun = un;             /* Pointer to the tail of the unquoted string */

    while (*p != '\0') {
        if (*p == '"') {
            p++;
        } else if (*p == '\\') {
            const char *q = p + JLI_StrSpn(p,"\\");
            if (*q == '"')
                do {
                    *pun++ = '\\';
                    p += 2;
                 } while (*p == '\\' && p < q);
            else
                while (p < q)
                    *pun++ = *p++;
        } else {
            *pun++ = *p++;
        }
    }
    *pun = '\0';
    return un;
}
/*
 * Local helper routine to return a string equivalent to the input string
 * s, but with quotes removed so the result is a string as would be found
 * in argv[].  The returned string should be freed by a call to JLI_MemFree().
 *
 * The rules for quoting (and escaped quotes) are:
 *
 *  1 A double quotation mark preceded by a backslash, \", is interpreted as a
 *    literal double quotation mark (").
 *
 *  2 Backslashes are interpreted literally, unless they immediately precede a
 *    double quotation mark.
 *
 *  3 If an even number of backslashes is followed by a double quotation mark,
 *    then one backslash (\) is placed in the argv array for every pair of
 *    backslashes (\\), and the double quotation mark (") is interpreted as a
 *    string delimiter.
 *
 *  4 If an odd number of backslashes is followed by a double quotation mark,
 *    then one backslash (\) is placed in the argv array for every pair of
 *    backslashes (\\) and the double quotation mark is interpreted as an
 *    escape sequence by the remaining backslash, causing a literal double
 *    quotation mark (") to be placed in argv.
 */
Local helper routine to return a string equivalent to the input string
s, but with quotes removed so the result is a string as would be found
in argv[].  The returned string should be freed by a call to JLI_MemFree().

The rules for quoting (and escaped quotes) are.

1 A double quotation mark preceded by a backslash, \", is interpreted as a
literal double quotation mark (").

2 Backslashes are interpreted literally, unless they immediately precede a
double quotation mark.

3 If an even number of backslashes is followed by a double quotation mark,
then one backslash (\) is placed in the argv array for every pair of
backslashes (\\), and the double quotation mark (") is interpreted as a
string delimiter.

4 If an odd number of backslashes is followed by a double quotation mark,
then one backslash (\) is placed in the argv array for every pair of
backslashes (\\) and the double quotation mark is interpreted as an
escape sequence by the remaining backslash, causing a literal double
quotation mark (") to be placed in argv.
Local helper routine to return a string equivalent to the input string s but with quotes removed so the result is a string as would be found in argv [] . The returned string should be freed by a call to JLI_MemFree () . The rules for quoting ( and escaped quotes ) are . 1 A double quotation mark preceded by a backslash \ " is interpreted as a literal double quotation mark ( " ) . 2 Backslashes are interpreted literally unless they immediately precede a double quotation mark . 3 If an even number of backslashes is followed by a double quotation mark then one backslash ( \ ) is placed in the argv array for every pair of backslashes ( \\ ) and the double quotation mark ( " ) is interpreted as a string delimiter . 4 If an odd number of backslashes is followed by a double quotation mark then one backslash ( \ ) is placed in the argv array for every pair of backslashes ( \\ ) and the double quotation mark is interpreted as an escape sequence by the remaining backslash causing a literal double quotation mark ( " ) to be placed in argv .
static char*
unquote(const char *s) {
    const char *p = s;          
    char *un = (char*)JLI_MemAlloc(JLI_StrLen(s) + 1);  
    char *pun = un;             
    while (*p != '\0') {
        if (*p == '"') {
            p++;
        } else if (*p == '\\') {
            const char *q = p + JLI_StrSpn(p,"\\");
            if (*q == '"')
                do {
                    *pun++ = '\\';
                    p += 2;
                 } while (*p == '\\' && p < q);
            else
                while (p < q)
                    *pun++ = *p++;
        } else {
            *pun++ = *p++;
        }
    }
    *pun = '\0';
    return un;
}
static char * unquote ( const char * s ) { const char * p = s ; char * un = ( char * ) JLI_MemAlloc ( JLI_StrLen ( s ) + 1 ) ; char * pun = un ; while ( * p != ' \0 ' ) { if ( * p == ' ' ) { p ++ ; } else if ( * p == ' \\ ' ) { const char * q = p + JLI_StrSpn ( p , " \\ " ) ; if ( * q == ' ' ) do { * pun ++ = ' \\ ' ; p += 2 ; } while ( * p == ' \\ ' && p < q ) ; else while ( p < q ) * pun ++ = * p ++ ; } else { * pun ++ = * p ++ ; } } * pun = ' \0 ' ; return un ; }
Local helper routine to return a string equivalent to the input string
 s, but with quotes removed so the result is a string as would be found
 in argv[].
Local helper routine to return a string equivalent to the input string s but with quotes removed so the result is a string as would be found in argv [] .
/* Pointer to the tail of the original string */ /* Ptr to unquoted string */ /* Pointer to the tail of the unquoted string */