src/windows/bin/java_md.c
static char*
nextarg(char** s) {
    char    *p = *s;
    char    *head;
    int     slashes = 0;
    int     inquote = 0;

    /*
     * Strip leading whitespace, which MSDN defines as only space or tab.
     * (Hence, no locale specific "isspace" here.)
     */
    while (*p != (char)0 && (*p == ' ' || *p == '\t'))
        p++;
    head = p;                   /* Save the start of the token to return */

    /*
     * Isolate a token from the command line.
     */
    while (*p != (char)0 && (inquote || !(*p == ' ' || *p == '\t'))) {
        if (*p == '\\' && *(p+1) == '"' && slashes % 2 == 0)
            p++;
        else if (*p == '"')
            inquote = !inquote;
        slashes = (*p++ == '\\') ? slashes + 1 : 0;
    }

    /*
     * If the token isolated isn't already terminated in a "char zero",
     * then replace the whitespace character with one and move to the
     * next character.
     */
    if (*p != (char)0)
        *p++ = (char)0;

    /*
     * Update the parameter to point to the head of the remaining string
     * reflecting the command line and return a pointer to the leading
     * token which was isolated from the command line.
     */
    *s = p;
    return (head);
}
/*
 * Local helper routine to isolate a single token (option or argument)
 * from the command line.
 *
 * This routine accepts a pointer to a character pointer.  The first
 * token (as defined by MSDN command-line argument syntax) is isolated
 * from that string.
 *
 * Upon return, the input character pointer pointed to by the parameter s
 * is updated to point to the remainding, unscanned, portion of the string,
 * or to a null character if the entire string has been consummed.
 *
 * This function returns a pointer to a null-terminated string which
 * contains the isolated first token, or to the null character if no
 * token could be isolated.
 *
 * Note the side effect of modifying the input string s by the insertion
 * of a null character, making it two strings.
 *
 * See "Parsing C Command-Line Arguments" in the MSDN Library for the
 * parsing rule details.  The rule summary from that specification is:
 *
 *  * Arguments are delimited by white space, which is either a space or a tab.
 *
 *  * A string surrounded by double quotation marks is interpreted as a single
 *    argument, regardless of white space contained within. A quoted string can
 *    be embedded in an argument. Note that the caret (^) is not recognized as
 *    an escape character or delimiter.
 *
 *  * A double quotation mark preceded by a backslash, \", is interpreted as a
 *    literal double quotation mark (").
 *
 *  * Backslashes are interpreted literally, unless they immediately precede a
 *    double quotation mark.
 *
 *  * 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.
 *
 *  * 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 isolate a single token (option or argument)
from the command line.

This routine accepts a pointer to a character pointer.  The first
token (as defined by MSDN command-line argument syntax) is isolated
from that string.

Upon return, the input character pointer pointed to by the parameter s
is updated to point to the remainding, unscanned, portion of the string,
or to a null character if the entire string has been consummed.

This function returns a pointer to a null-terminated string which
contains the isolated first token, or to the null character if no
token could be isolated.

Note the side effect of modifying the input string s by the insertion
of a null character, making it two strings.

See "Parsing C Command-Line Arguments" in the MSDN Library for the
parsing rule details.  The rule summary from that specification is.

Arguments are delimited by white space, which is either a space or a tab.

A string surrounded by double quotation marks is interpreted as a single
argument, regardless of white space contained within. A quoted string can
be embedded in an argument. Note that the caret (^) is not recognized as
an escape character or delimiter.

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

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

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.

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 isolate a single token ( option or argument ) from the command line . This routine accepts a pointer to a character pointer . The first token ( as defined by MSDN command - line argument syntax ) is isolated from that string . Upon return the input character pointer pointed to by the parameter s is updated to point to the remainding unscanned portion of the string or to a null character if the entire string has been consummed . This function returns a pointer to a null - terminated string which contains the isolated first token or to the null character if no token could be isolated . Note the side effect of modifying the input string s by the insertion of a null character making it two strings . See " Parsing C Command - Line Arguments " in the MSDN Library for the parsing rule details . The rule summary from that specification is . Arguments are delimited by white space which is either a space or a tab . A string surrounded by double quotation marks is interpreted as a single argument regardless of white space contained within . A quoted string can be embedded in an argument . Note that the caret ( ^ ) is not recognized as an escape character or delimiter . A double quotation mark preceded by a backslash \ " is interpreted as a literal double quotation mark ( " ) . Backslashes are interpreted literally unless they immediately precede a double quotation mark . 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 . 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*
nextarg(char** s) {
    char    *p = *s;
    char    *head;
    int     slashes = 0;
    int     inquote = 0;
    while (*p != (char)0 && (*p == ' ' || *p == '\t'))
        p++;
    head = p;                   
    while (*p != (char)0 && (inquote || !(*p == ' ' || *p == '\t'))) {
        if (*p == '\\' && *(p+1) == '"' && slashes % 2 == 0)
            p++;
        else if (*p == '"')
            inquote = !inquote;
        slashes = (*p++ == '\\') ? slashes + 1 : 0;
    }
    if (*p != (char)0)
        *p++ = (char)0;
    *s = p;
    return (head);
}
static char * nextarg ( char * * s ) { char * p = * s ; char * head ; int slashes = 0 ; int inquote = 0 ; while ( * p != ( char ) 0 && ( * p == ' ' || * p == ' \t ' ) ) p ++ ; head = p ; while ( * p != ( char ) 0 && ( inquote || ! ( * p == ' ' || * p == ' \t ' ) ) ) { if ( * p == ' \\ ' && * ( p + 1 ) == ' ' && slashes % 2 == 0 ) p ++ ; else if ( * p == ' ' ) inquote = ! inquote ; slashes = ( * p ++ == ' \\ ' ) ? slashes + 1 : 0 ; } if ( * p != ( char ) 0 ) * p ++ = ( char ) 0 ; * s = p ; return ( head ) ; }
Local helper routine to isolate a single token (option or argument)
 from the command line.
Local helper routine to isolate a single token ( option or argument ) from the command line .
/*
     * Strip leading whitespace, which MSDN defines as only space or tab.
     * (Hence, no locale specific "isspace" here.)
     */ /* Save the start of the token to return */ /*
     * Isolate a token from the command line.
     */ /*
     * If the token isolated isn't already terminated in a "char zero",
     * then replace the whitespace character with one and move to the
     * next character.
     */ /*
     * Update the parameter to point to the head of the remaining string
     * reflecting the command line and return a pointer to the leading
     * token which was isolated from the command line.
     */