tools/build-pkg.c
static char *strtopath(char *s, char **end)
{
    while (*s && isspace(*s)) {
        s++;
    }
    if (!*s) {
        return NULL;
    }

    char *filename = s;
    if (*s++ == '"') {
        filename = s;
        while (*s && *s != '"') {
            if (*s == '\\') {
                if (!s[1]) {
                    fprintf(stderr, "Stray backslash at end of line: %s\n",
                            filename);
                    return NULL;
                }
                memmove(s, s+1, strlen(s+1)+1);
            }
            s++;
        }
        if (!*s) {
            fprintf(stderr, "Unterminated quoted pathname: %s\n", filename);
            return NULL;
        }
        *s++ = 0;
        filename = strdup(filename);
    } else {
        while (*s && !isspace(*s)) {
            s++;
        }
        char c = *s;
        *s = 0;
        filename = strdup(filename);
        *s = c;
    }
    *end = s;
    return filename;
}
/**
 * strtopath:  Read a pathname starting from the first non-whitespace
 * character in "s".  If the first non-whitespace character is a double
 * quote character, the pathname is treated as a quoted string and is
 * terminated by a second (unescaped) double quote character; otherwise,
 * the pathname is terminated by a whitespace character.
 *
 * Note that the portion of the input string following the filename may be
 * moved from its original position by this function.
 *
 * [Parameters]
 *     s: String from which to read pathname.
 *     end: Pointer to variable to receive a pointer to the first character
 *         after the end of the pathname.
 * [Return value]
 *     Parsed pathname (copied with strdup()), or NULL if no pathname was
 *     found.
 */
Read a pathname starting from the first non-whitespace
character in "s".  If the first non-whitespace character is a double
quote character, the pathname is treated as a quoted string and is
terminated by a second (unescaped) double quote character; otherwise,
the pathname is terminated by a whitespace character.

Note that the portion of the input string following the filename may be
moved from its original position by this function.

[Parameters]
s: String from which to read pathname.
end: Pointer to variable to receive a pointer to the first character
after the end of the pathname.
[Return value]
Parsed pathname (copied with strdup()), or NULL if no pathname was
found.
Read a pathname starting from the first non - whitespace character in " s " . If the first non - whitespace character is a double quote character the pathname is treated as a quoted string and is terminated by a second ( unescaped ) double quote character ; otherwise the pathname is terminated by a whitespace character . Note that the portion of the input string following the filename may be moved from its original position by this function . [ Parameters ] s : String from which to read pathname . end : Pointer to variable to receive a pointer to the first character after the end of the pathname . [ Return value ] Parsed pathname ( copied with strdup () ) or NULL if no pathname was found .
static char *strtopath(char *s, char **end)
{
    while (*s && isspace(*s)) {
        s++;
    }
    if (!*s) {
        return NULL;
    }
    char *filename = s;
    if (*s++ == '"') {
        filename = s;
        while (*s && *s != '"') {
            if (*s == '\\') {
                if (!s[1]) {
                    fprintf(stderr, "Stray backslash at end of line: %s\n",
                            filename);
                    return NULL;
                }
                memmove(s, s+1, strlen(s+1)+1);
            }
            s++;
        }
        if (!*s) {
            fprintf(stderr, "Unterminated quoted pathname: %s\n", filename);
            return NULL;
        }
        *s++ = 0;
        filename = strdup(filename);
    } else {
        while (*s && !isspace(*s)) {
            s++;
        }
        char c = *s;
        *s = 0;
        filename = strdup(filename);
        *s = c;
    }
    *end = s;
    return filename;
}
static char * strtopath ( char * s , char * * end ) { while ( * s && isspace ( * s ) ) { s ++ ; } if ( ! * s ) { return NULL ; } char * filename = s ; if ( * s ++ == ' ' ) { filename = s ; while ( * s && * s != ' ' ) { if ( * s == ' \\ ' ) { if ( ! s [ 1 ] ) { fprintf ( stderr , " \n " , filename ) ; return NULL ; } memmove ( s , s + 1 , strlen ( s + 1 ) + 1 ) ; } s ++ ; } if ( ! * s ) { fprintf ( stderr , " \n " , filename ) ; return NULL ; } * s ++ = 0 ; filename = strdup ( filename ) ; } else { while ( * s && ! isspace ( * s ) ) { s ++ ; } char c = * s ; * s = 0 ; filename = strdup ( filename ) ; * s = c ; } * end = s ; return filename ; }
strtopath:  Read a pathname starting from the first non-whitespace
 character in "s".
strtopath : Read a pathname starting from the first non - whitespace character in " s " .